See commit description for changes
Added PageContainer to dynamically load pages within the main content. Added player component to control music playback(Half functional). Added playback changed event not the player service.
This commit is contained in:
@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:views="clr-namespace:Aurora.Frontend.Views.Songs"
|
||||
xmlns:views="clr-namespace:Aurora.Frontend.Views.MainView"
|
||||
xmlns:navigation="clr-namespace:Aurora.Frontend.Components.NavigationMenu"
|
||||
x:Class="Aurora.Frontend.Views.Main.MainView"
|
||||
MasterBehavior="Split">
|
||||
|
||||
<MasterDetailPage.Master>
|
||||
<navigation:NavigationMenu x:Name="MasterPage" Items="{Binding Pages}"/>
|
||||
</MasterDetailPage.Master>
|
||||
|
||||
<MasterDetailPage.Detail>
|
||||
<NavigationPage>
|
||||
<x:Arguments>
|
||||
<views:SongsView />
|
||||
</x:Arguments>
|
||||
</NavigationPage>
|
||||
</MasterDetailPage.Detail>
|
||||
<MasterDetailPage.Master>
|
||||
<navigation:NavigationMenu x:Name="MasterPage" Items="{Binding Pages}"/>
|
||||
</MasterDetailPage.Master>
|
||||
|
||||
<MasterDetailPage.Detail>
|
||||
<NavigationPage>
|
||||
<x:Arguments>
|
||||
<views:PageContainer x:Name="ContentPage" />
|
||||
</x:Arguments>
|
||||
</NavigationPage>
|
||||
</MasterDetailPage.Detail>
|
||||
|
||||
</MasterDetailPage>
|
@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Aurora.Frontend.Components.NavigationMenu;
|
||||
using Aurora.Frontend.Views.MainView;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Aurora.Frontend.Views.Main
|
||||
{
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class MainView : MasterDetailPage
|
||||
{
|
||||
@ -15,6 +16,13 @@ namespace Aurora.Frontend.Views.Main
|
||||
InitializeComponent();
|
||||
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;
|
||||
}
|
||||
|
||||
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
||||
@ -23,10 +31,10 @@ namespace Aurora.Frontend.Views.Main
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
var page = (Page)Activator.CreateInstance(item.TargetType);
|
||||
page.Title = item.Title;
|
||||
var view = (View)Activator.CreateInstance(item.TargetType);
|
||||
|
||||
Detail = new NavigationPage(page);
|
||||
ContentPresenter viewContent = (ContentPresenter)ContentPage.Content.FindByName("ViewContent");
|
||||
viewContent.Content = view;
|
||||
|
||||
MasterPage.ListView.SelectedItem = null;
|
||||
}
|
||||
|
9
Aurora/Frontend/Views/MainView/PageContainer.xaml
Normal file
9
Aurora/Frontend/Views/MainView/PageContainer.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<?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.Content>
|
||||
<StackLayout>
|
||||
<ContentPresenter x:Name="ViewContent"/>
|
||||
<mp:Player HorizontalOptions="CenterAndExpand" VerticalOptions="End" HeightRequest="200"/>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
15
Aurora/Frontend/Views/MainView/PageContainer.xaml.cs
Normal file
15
Aurora/Frontend/Views/MainView/PageContainer.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Views.MainView
|
||||
{
|
||||
public partial class PageContainer : ContentPage
|
||||
{
|
||||
public PageContainer()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user