93be6dc100
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.
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System;
|
|
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
|
|
{
|
|
public MainView()
|
|
{
|
|
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)
|
|
{
|
|
var item = e.SelectedItem as NavigationItem;
|
|
if (item == null)
|
|
return;
|
|
|
|
var view = (View)Activator.CreateInstance(item.TargetType);
|
|
|
|
ContentPresenter viewContent = (ContentPresenter)ContentPage.Content.FindByName("ViewContent");
|
|
viewContent.Content = view;
|
|
|
|
MasterPage.ListView.SelectedItem = null;
|
|
}
|
|
}
|
|
|
|
}
|