Added base classes to encapsulate metadata in media
This commit is contained in:
@ -1,10 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Aurora.Frontend.Components.MediaPlayer.Player">
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Aurora.Frontend.Components.MediaPlayer.Player">
|
||||
<ContentView.Content>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button Text="Previous" Command="{Binding PreviousCommand}" WidthRequest="100" HeightRequest="50"/>
|
||||
<Button Text="{Binding PlayButtonText}" Command="{Binding PlayCommand}" WidthRequest="100" HeightRequest="50"/>
|
||||
<Button Text="Next" Command="{Binding NextCommand}" WidthRequest="100" HeightRequest="50"/>
|
||||
</StackLayout>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition
|
||||
Width="100"/>
|
||||
<ColumnDefinition
|
||||
Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackLayout
|
||||
Grid.Column="0">
|
||||
<Label
|
||||
Text="{Binding SongName}"/>
|
||||
<Label
|
||||
Text="{Binding ArtistName}"/>
|
||||
</StackLayout>
|
||||
<StackLayout
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Text="Previous"
|
||||
Command="{Binding PreviousCommand}"
|
||||
WidthRequest="100"
|
||||
HeightRequest="50"/>
|
||||
<Button
|
||||
Text="{Binding PlayButtonText}"
|
||||
Command="{Binding PlayCommand}"
|
||||
WidthRequest="100"
|
||||
HeightRequest="50"/>
|
||||
<Button
|
||||
Text="Next"
|
||||
Command="{Binding NextCommand}"
|
||||
WidthRequest="100"
|
||||
HeightRequest="50"/>
|
||||
</StackLayout>
|
||||
</Grid>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
@ -17,12 +17,11 @@ namespace Aurora.Frontend.Views.Main
|
||||
BindingContext = new MainViewModel();
|
||||
MasterPage.ListView.ItemSelected += ListView_ItemSelected;
|
||||
|
||||
//Set initial view from first item in list
|
||||
ObservableCollection<NavigationGroupItem> screenList = (ObservableCollection<NavigationGroupItem>)MasterPage.ListView.ItemsSource;
|
||||
var view = (View)Activator.CreateInstance(screenList.FirstOrDefault().FirstOrDefault().TargetType);
|
||||
|
||||
ContentPresenter viewContent = (ContentPresenter)ContentPage.Content.FindByName("ViewContent");
|
||||
viewContent.Content = view;
|
||||
Appearing += OnAppearing;
|
||||
}
|
||||
~MainView()
|
||||
{
|
||||
Appearing -= OnAppearing;
|
||||
}
|
||||
|
||||
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
||||
@ -38,6 +37,23 @@ namespace Aurora.Frontend.Views.Main
|
||||
|
||||
MasterPage.ListView.SelectedItem = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for page appearing.
|
||||
/// </summary>
|
||||
/// <param name="sender">The object that fired the event.</param>
|
||||
/// <param name="args">The event arguments</param>
|
||||
private void OnAppearing(object sender, EventArgs args)
|
||||
{
|
||||
//Set initial view from first item in list
|
||||
ObservableCollection<NavigationGroupItem> screenList = (ObservableCollection<NavigationGroupItem>)MasterPage.ListView.ItemsSource;
|
||||
var view = (View)Activator.CreateInstance(screenList.FirstOrDefault().FirstOrDefault().TargetType);
|
||||
|
||||
ContentPresenter viewContent = (ContentPresenter)ContentPage.Content.FindByName("ViewContent");
|
||||
viewContent.Content = view;
|
||||
|
||||
MasterPage.ListView.SelectedItem = screenList.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:components="clr-namespace:Aurora.Frontend.Components" xmlns:mp="clr-namespace:Aurora.Frontend.Components.MediaPlayer" x:Class="Aurora.Frontend.Views.MainView.PageContainer">
|
||||
<ContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:components="clr-namespace:Aurora.Frontend.Components"
|
||||
xmlns:mp="clr-namespace:Aurora.Frontend.Components.MediaPlayer"
|
||||
x:Class="Aurora.Frontend.Views.MainView.PageContainer">
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<ContentPresenter x:Name="ViewContent"/>
|
||||
<mp:Player HorizontalOptions="CenterAndExpand" VerticalOptions="End" HeightRequest="200"/>
|
||||
</StackLayout>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition
|
||||
Height="*"/>
|
||||
<RowDefinition
|
||||
Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ContentPresenter
|
||||
Grid.Row="0"
|
||||
x:Name="ViewContent"/>
|
||||
<mp:Player
|
||||
Grid.Row="1"
|
||||
HorizontalOptions="CenterAndExpand"
|
||||
VerticalOptions="End"
|
||||
HeightRequest="200"/>
|
||||
</Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -1,50 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:songs="clr-namespace:Aurora.Frontend.Views.Songs"
|
||||
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
|
||||
x:Class="Aurora.Frontend.Views.Songs.SongsView">
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:songs="clr-namespace:Aurora.Frontend.Views.Songs"
|
||||
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
|
||||
x:Class="Aurora.Frontend.Views.Songs.SongsView">
|
||||
<ContentPage.BindingContext>
|
||||
<songs:SongsViewModel x:Name="songsViewModel"/>
|
||||
<songs:SongsViewModel
|
||||
x:Name="songsViewModel"/>
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.Content>
|
||||
<dg:DataGrid ItemsSource="{Binding SongsList}" SelectionEnabled="True" SelectedItem="{Binding SelectedSong}"
|
||||
RowHeight="30" HeaderHeight="50" BorderColor="#CCCCCC" HeaderBackground="#E0E6F8" >
|
||||
|
||||
<!-- Header -->
|
||||
<dg:DataGrid
|
||||
ItemsSource="{Binding SongsList}"
|
||||
SelectionEnabled="True"
|
||||
SelectedItem="{Binding SelectedSong}"
|
||||
RowHeight="30"
|
||||
HeaderHeight="50"
|
||||
BorderColor="#CCCCCC"
|
||||
HeaderBackground="#E0E6F8"><!-- Header -->
|
||||
<dg:DataGrid.HeaderFontSize>
|
||||
<OnIdiom x:TypeArguments="x:Double">
|
||||
<OnIdiom
|
||||
x:TypeArguments="x:Double">
|
||||
<OnIdiom.Tablet>15</OnIdiom.Tablet>
|
||||
<OnIdiom.Phone>13</OnIdiom.Phone>
|
||||
<OnIdiom.Desktop>20</OnIdiom.Desktop>
|
||||
</OnIdiom>
|
||||
</dg:DataGrid.HeaderFontSize>
|
||||
|
||||
<!-- Columns -->
|
||||
</dg:DataGrid.HeaderFontSize><!-- Columns -->
|
||||
<dg:DataGrid.Columns>
|
||||
<dg:DataGridColumn Title="" Width="40">
|
||||
<dg:DataGridColumn
|
||||
Title=""
|
||||
Width="40">
|
||||
<dg:DataGridColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Text="Play" Command="{Binding PlayCommand}" BindingContext="{x:Reference songsViewModel}" />
|
||||
<Button
|
||||
Text="Play"
|
||||
Command="{Binding PlayCommand}"
|
||||
BindingContext="{x:Reference songsViewModel}"/>
|
||||
</DataTemplate>
|
||||
</dg:DataGridColumn.CellTemplate>
|
||||
</dg:DataGridColumn>
|
||||
<dg:DataGridColumn Title="Title" PropertyName="Title" Width="2*" />
|
||||
<dg:DataGridColumn Title="Album" PropertyName="Album" Width="0.95*"/>
|
||||
<dg:DataGridColumn Title="Artist" PropertyName="Artist" Width="1*"/>
|
||||
<dg:DataGridColumn Title="Duration" PropertyName="Duration"/>
|
||||
</dg:DataGrid.Columns>
|
||||
|
||||
<!-- Row Colors -->
|
||||
<dg:DataGridColumn
|
||||
Title="Title"
|
||||
PropertyName="Metadata.Title"
|
||||
Width="2*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Album"
|
||||
PropertyName="Metadata.Album"
|
||||
Width="0.95*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Artist"
|
||||
PropertyName="Metadata.Artist"
|
||||
Width="1*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Duration"
|
||||
PropertyName="Metadata.Duration"/>
|
||||
</dg:DataGrid.Columns><!-- Row Colors -->
|
||||
<dg:DataGrid.RowsBackgroundColorPalette>
|
||||
<dg:PaletteCollection>
|
||||
<Color>#F2F2F2</Color>
|
||||
<Color>#FFFFFF</Color>
|
||||
</dg:PaletteCollection>
|
||||
</dg:DataGrid.RowsBackgroundColorPalette>
|
||||
|
||||
|
||||
</dg:DataGrid>
|
||||
</ContentPage.Content>
|
||||
</ContentView>
|
||||
</ContentView>
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Aurora.Backend.Models;
|
||||
using Aurora.Backend.Models.Media;
|
||||
using Aurora.Backend.Services;
|
||||
using Aurora.Backend.Services.PlayerService;
|
||||
using Xamarin.Forms;
|
||||
|
Reference in New Issue
Block a user