Added base classes to encapsulate metadata in media

This commit is contained in:
watsonb8
2019-05-24 15:59:26 -04:00
parent 93be6dc100
commit 80e9a4543d
12 changed files with 222 additions and 97 deletions

View File

@ -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();
}
}
}

View File

@ -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>