diff --git a/Aurora/Aurora.csproj b/Aurora/Aurora.csproj index 05ac152..03abbe3 100644 --- a/Aurora/Aurora.csproj +++ b/Aurora/Aurora.csproj @@ -19,8 +19,12 @@ - + + + + + \ No newline at end of file diff --git a/Aurora/Frontend/Views/MainView/NavigationItem.cs b/Aurora/Frontend/Components/NavigationMenu/NavigationItem.cs similarity index 71% rename from Aurora/Frontend/Views/MainView/NavigationItem.cs rename to Aurora/Frontend/Components/NavigationMenu/NavigationItem.cs index 707201f..27933f7 100644 --- a/Aurora/Frontend/Views/MainView/NavigationItem.cs +++ b/Aurora/Frontend/Components/NavigationMenu/NavigationItem.cs @@ -3,17 +3,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Aurora.Frontend.Views.Main; -namespace Aurora.Frontend.Views.Main +namespace Aurora.Frontend.Views.Components.NavigationMenu { public class NavigationItem { public NavigationItem() { - TargetType = typeof(MainContentPage); } public int Id { get; set; } public string Title { get; set; } + public string Group { get; set; } public Type TargetType { get; set; } } diff --git a/Aurora/Frontend/Components/NavigationMenu/NavigationMenu.xaml b/Aurora/Frontend/Components/NavigationMenu/NavigationMenu.xaml new file mode 100644 index 0000000..fc4032a --- /dev/null +++ b/Aurora/Frontend/Components/NavigationMenu/NavigationMenu.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Aurora/Frontend/Components/NavigationMenu/NavigationMenu.xaml.cs b/Aurora/Frontend/Components/NavigationMenu/NavigationMenu.xaml.cs new file mode 100644 index 0000000..c5c0426 --- /dev/null +++ b/Aurora/Frontend/Components/NavigationMenu/NavigationMenu.xaml.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Aurora.Frontend.Views.Components.NavigationMenu; +using Xamarin.Forms; + +namespace Aurora.Frontend.Components.NavigationMenu +{ + public partial class NavigationMenu : ContentPage + { + public NavigationMenu() + { + InitializeComponent(); + ListView = MenuItemsListView; + } + + public ListView ListView; + + public static readonly BindableProperty ItemsProperty = + BindableProperty.Create(propertyName: nameof(Items), + returnType: typeof(ObservableCollection), + declaringType: typeof(NavigationMenu), + defaultBindingMode: BindingMode.TwoWay, + propertyChanged: OnItemsChanged); + + public ObservableCollection Items + { + get + { + return (ObservableCollection)GetValue(ItemsProperty); + } + set + { + SetValue(ItemsProperty, value); + } + } + + private static void OnItemsChanged(BindableObject bindable, object oldValue, object newValue) + { + var control = (NavigationMenu)bindable; + control.MenuItemsListView.ItemsSource = (ObservableCollection)newValue; + } + + } +} diff --git a/Aurora/Frontend/Views/Albums/AlbumsView.xaml b/Aurora/Frontend/Views/Albums/AlbumsView.xaml new file mode 100644 index 0000000..3ac2daf --- /dev/null +++ b/Aurora/Frontend/Views/Albums/AlbumsView.xaml @@ -0,0 +1,6 @@ + + + + + diff --git a/Aurora/Frontend/Views/Albums/AlbumsView.xaml.cs b/Aurora/Frontend/Views/Albums/AlbumsView.xaml.cs new file mode 100644 index 0000000..9da7656 --- /dev/null +++ b/Aurora/Frontend/Views/Albums/AlbumsView.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Aurora.Frontend.Views.Albums +{ + public partial class AlbumsView : ContentPage + { + public AlbumsView() + { + InitializeComponent(); + } + } +} diff --git a/Aurora/Frontend/Views/Albums/AlbumsViewModel.cs b/Aurora/Frontend/Views/Albums/AlbumsViewModel.cs new file mode 100644 index 0000000..b301c62 --- /dev/null +++ b/Aurora/Frontend/Views/Albums/AlbumsViewModel.cs @@ -0,0 +1,10 @@ +using System; +namespace Aurora.Frontend.Views.Albums +{ + public class AlbumsViewModel + { + public AlbumsViewModel() + { + } + } +} diff --git a/Aurora/Frontend/Views/Artists/ArtistsView.xaml b/Aurora/Frontend/Views/Artists/ArtistsView.xaml new file mode 100644 index 0000000..da15e25 --- /dev/null +++ b/Aurora/Frontend/Views/Artists/ArtistsView.xaml @@ -0,0 +1,5 @@ + + + + + diff --git a/Aurora/Frontend/Views/Artists/ArtistsView.xaml.cs b/Aurora/Frontend/Views/Artists/ArtistsView.xaml.cs new file mode 100644 index 0000000..bd520a5 --- /dev/null +++ b/Aurora/Frontend/Views/Artists/ArtistsView.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Aurora.Frontend.Views.Artists +{ + public partial class ArtistsView : ContentPage + { + public ArtistsView() + { + InitializeComponent(); + } + } +} diff --git a/Aurora/Frontend/Views/Artists/ArtistsViewModel.cs b/Aurora/Frontend/Views/Artists/ArtistsViewModel.cs new file mode 100644 index 0000000..c8455e0 --- /dev/null +++ b/Aurora/Frontend/Views/Artists/ArtistsViewModel.cs @@ -0,0 +1,10 @@ +using System; +namespace Aurora.Frontend.Views.Artists +{ + public class ArtistsViewModel + { + public ArtistsViewModel() + { + } + } +} diff --git a/Aurora/Frontend/Views/BaseViewModel.cs b/Aurora/Frontend/Views/BaseViewModel.cs new file mode 100644 index 0000000..76b6588 --- /dev/null +++ b/Aurora/Frontend/Views/BaseViewModel.cs @@ -0,0 +1,24 @@ +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Aurora.Frontend.Views +{ + public class BaseViewModel + { + public BaseViewModel() + { + } + + #region INotifyPropertyChanged Implementation + public event PropertyChangedEventHandler PropertyChanged; + public void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (PropertyChanged == null) + return; + + PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + #endregion + } +} diff --git a/Aurora/Frontend/Views/MainView/MainContentPage.xaml b/Aurora/Frontend/Views/MainView/MainContentPage.xaml deleted file mode 100644 index 6d2c554..0000000 --- a/Aurora/Frontend/Views/MainView/MainContentPage.xaml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/Aurora/Frontend/Views/MainView/MainContentPage.xaml.cs b/Aurora/Frontend/Views/MainView/MainContentPage.xaml.cs deleted file mode 100644 index 2f3801d..0000000 --- a/Aurora/Frontend/Views/MainView/MainContentPage.xaml.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Aurora.Frontend.Views.Main -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class MainContentPage : ContentPage - { - public MainContentPage() - { - InitializeComponent(); - } - } -} diff --git a/Aurora/Frontend/Views/MainView/MainView.xaml b/Aurora/Frontend/Views/MainView/MainView.xaml index 080e29b..7098895 100644 --- a/Aurora/Frontend/Views/MainView/MainView.xaml +++ b/Aurora/Frontend/Views/MainView/MainView.xaml @@ -1,36 +1,20 @@ - - + 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:navigation="clr-namespace:Aurora.Frontend.Components.NavigationMenu" + x:Class="Aurora.Frontend.Views.Main.MainView" + MasterBehavior="Split"> - + - + diff --git a/Aurora/Frontend/Views/MainView/MainView.xaml.cs b/Aurora/Frontend/Views/MainView/MainView.xaml.cs index 1d05951..686cff4 100644 --- a/Aurora/Frontend/Views/MainView/MainView.xaml.cs +++ b/Aurora/Frontend/Views/MainView/MainView.xaml.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using Aurora.Frontend.Views.Components.NavigationMenu; +using Aurora.Frontend.Views.MainView; using Xamarin.Forms; using Xamarin.Forms.Xaml; @@ -11,7 +13,7 @@ namespace Aurora.Frontend.Views.Main public MainView() { InitializeComponent(); - + BindingContext = new MainViewModel(); MasterPage.ListView.ItemSelected += ListView_ItemSelected; } diff --git a/Aurora/Frontend/Views/MainView/MainViewModel.cs b/Aurora/Frontend/Views/MainView/MainViewModel.cs new file mode 100644 index 0000000..af90e05 --- /dev/null +++ b/Aurora/Frontend/Views/MainView/MainViewModel.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Aurora.Frontend.Views.Albums; +using Aurora.Frontend.Views.Artists; +using Aurora.Frontend.Views.Components.NavigationMenu; +using Aurora.Frontend.Views.Songs; +using Aurora.Frontend.Views.Stations; + +namespace Aurora.Frontend.Views.MainView +{ + public class MainViewModel : BaseViewModel + { + private ObservableCollection _pages; + public ObservableCollection Pages + { + get { return _pages; } + set + { + if(value != _pages) + { + _pages = value; + OnPropertyChanged("Pages"); + } + + } + } + public MainViewModel() + { + _pages = new ObservableCollection(new[] + { + new NavigationItem { Id = 0, Title = "Songs", Group="Library", TargetType = typeof(SongsView) }, + new NavigationItem { Id = 1, Title = "Artists", Group="Library", TargetType = typeof(ArtistsView)}, + new NavigationItem { Id = 2, Title = "Albums", Group="Library", TargetType = typeof(AlbumsView)}, + new NavigationItem { Id = 3, Title = "Stations", Group="Library", TargetType = typeof(StationsView)}, + + }); + + } + + } +} diff --git a/Aurora/Frontend/Views/MainView/NavigationMenu.xaml b/Aurora/Frontend/Views/MainView/NavigationMenu.xaml deleted file mode 100644 index 647fd53..0000000 --- a/Aurora/Frontend/Views/MainView/NavigationMenu.xaml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Aurora/Frontend/Views/MainView/NavigationMenu.xaml.cs b/Aurora/Frontend/Views/MainView/NavigationMenu.xaml.cs deleted file mode 100644 index e6f197e..0000000 --- a/Aurora/Frontend/Views/MainView/NavigationMenu.xaml.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -using Xamarin.Forms; -using Xamarin.Forms.Xaml; - -namespace Aurora.Frontend.Views.Main -{ - [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class NavigationMenu : ContentPage - { - public ListView ListView; - - public NavigationMenu() - { - InitializeComponent(); - - BindingContext = new MainViewMasterViewModel(); - ListView = MenuItemsListView; - } - - class MainViewMasterViewModel : INotifyPropertyChanged - { - public ObservableCollection MenuItems { get; set; } - - public MainViewMasterViewModel() - { - MenuItems = new ObservableCollection(new[] - { - new NavigationItem { Id = 0, Title = "Page 1" }, - new NavigationItem { Id = 1, Title = "Page 2" }, - new NavigationItem { Id = 2, Title = "Page 3" }, - new NavigationItem { Id = 3, Title = "Page 4" }, - new NavigationItem { Id = 4, Title = "Page 5" }, - }); - } - - #region INotifyPropertyChanged Implementation - public event PropertyChangedEventHandler PropertyChanged; - void OnPropertyChanged([CallerMemberName] string propertyName = "") - { - if (PropertyChanged == null) - return; - - PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - #endregion - } - } -} diff --git a/Aurora/Frontend/Views/Songs/SongsView.xaml b/Aurora/Frontend/Views/Songs/SongsView.xaml new file mode 100644 index 0000000..f6276ef --- /dev/null +++ b/Aurora/Frontend/Views/Songs/SongsView.xaml @@ -0,0 +1,6 @@ + + + + + diff --git a/Aurora/Frontend/Views/Songs/SongsView.xaml.cs b/Aurora/Frontend/Views/Songs/SongsView.xaml.cs new file mode 100644 index 0000000..24e46e8 --- /dev/null +++ b/Aurora/Frontend/Views/Songs/SongsView.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Aurora.Frontend.Views.Songs +{ + public partial class SongsView : ContentPage + { + public SongsView() + { + InitializeComponent(); + } + } +} diff --git a/Aurora/Frontend/Views/Songs/SongsViewModel.cs b/Aurora/Frontend/Views/Songs/SongsViewModel.cs new file mode 100644 index 0000000..ac83454 --- /dev/null +++ b/Aurora/Frontend/Views/Songs/SongsViewModel.cs @@ -0,0 +1,10 @@ +using System; +namespace Aurora.Frontend.Views.Songs +{ + public class SongsViewModel + { + public SongsViewModel() + { + } + } +} diff --git a/Aurora/Frontend/Views/Stations/StationsViewModel.xaml b/Aurora/Frontend/Views/Stations/StationsViewModel.xaml new file mode 100644 index 0000000..b89c794 --- /dev/null +++ b/Aurora/Frontend/Views/Stations/StationsViewModel.xaml @@ -0,0 +1,5 @@ + + + + + diff --git a/Aurora/Frontend/Views/Stations/StationsViewModel.xaml.cs b/Aurora/Frontend/Views/Stations/StationsViewModel.xaml.cs new file mode 100644 index 0000000..d9a76de --- /dev/null +++ b/Aurora/Frontend/Views/Stations/StationsViewModel.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Aurora.Frontend.Views.Stations +{ + public partial class StationsView : ContentPage + { + public StationsView() + { + InitializeComponent(); + } + } +} diff --git a/Aurora/Frontend/Views/Stations/StatiosnViewModel.cs b/Aurora/Frontend/Views/Stations/StatiosnViewModel.cs new file mode 100644 index 0000000..18b7392 --- /dev/null +++ b/Aurora/Frontend/Views/Stations/StatiosnViewModel.cs @@ -0,0 +1,10 @@ +using System; +namespace Aurora.Frontend.Views.Stations +{ + public class StationsViewModel + { + public StationsViewModel() + { + } + } +}