Commit 0fd91de4 authored by Axelander's avatar Axelander

Replaced methode binding using x:Bind

parent 99c54585
......@@ -2,9 +2,7 @@
x:Class="SonicStreamer.Pages.AlbumsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
DataContext="{Binding Source={StaticResource AlbumVM}}"
NavigationCacheMode="Required"
......@@ -37,20 +35,14 @@
<CommandBar.Resources>
<Style BasedOn="{StaticResource OrangeAppBarButtonStyle}" TargetType="AppBarButton" />
</CommandBar.Resources>
<AppBarButton Icon="Play" Label="Play Selection">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="PlayClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton Icon="Add" Label="Add to Playback">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="AddClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton
Click="{x:Bind AlbumVm.PlayClick}"
Icon="Play"
Label="Play Selection" />
<AppBarButton
Click="{x:Bind AlbumVm.AddClick}"
Icon="Add"
Label="Add to Playback" />
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
......@@ -64,6 +56,7 @@
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
......@@ -73,11 +66,6 @@
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="AddToPlaylistComboBox_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ComboBox>
<TextBox
Margin="0,0,0,5"
......@@ -87,27 +75,18 @@
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="AddToPlayback_Click"
Click="{x:Bind AlbumVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="AddToPlaylistClick" TargetObject="{StaticResource AlbumVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton Icon="Download" Label="Download">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="DownloadTracksClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton
Click="{x:Bind AlbumVm.DownloadTracksClick}"
Icon="Download"
Label="Download" />
</CommandBar>
</Page.BottomAppBar>
......@@ -124,14 +103,9 @@
<StackPanel Orientation="Horizontal">
<RadioButton
x:Name="HamburgerButton"
Click="{x:Bind MainVm.HamburgerButtonClick}"
DataContext="{StaticResource MainVM}"
Style="{StaticResource SplitViewHamburgerButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="HamburgerButtonClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</RadioButton>
Style="{StaticResource SplitViewHamburgerButtonStyle}" />
<TextBlock Style="{StaticResource OrangePageHeaderTextBlockStyle}" Text="albums" />
</StackPanel>
<Grid Grid.Column="1" HorizontalAlignment="Right">
......@@ -155,15 +129,11 @@
IsItemClickEnabled="{Binding IsItemClickEnabled}"
ItemClick="listingItemsView_ItemClick"
ItemsSource="{Binding Source={StaticResource ListViewSource}}"
SelectionChanged="{x:Bind AlbumVm.ListingItems_SelectionChanged}"
SelectionMode="{Binding SelectionMode}">
<ListView.GroupStyle>
<GroupStyle HeaderTemplate="{StaticResource ListingGroupHeaderStyle}" />
</ListView.GroupStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="ListingItems_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</SemanticZoom.ZoomedInView>
</SemanticZoom>
......
......@@ -8,24 +8,27 @@ namespace SonicStreamer.Pages
{
public sealed partial class AlbumsPage : Page
{
readonly AlbumViewModel _albumVm;
readonly PlaylistViewModel _playlistVm;
public readonly AlbumViewModel AlbumVm;
public readonly PlaylistViewModel PlaylistVm;
public readonly MainViewModel MainVm;
public AlbumsPage()
{
InitializeComponent();
if (ResourceLoader.Current.GetResource(ref _albumVm, Constants.ViewModelAlbum) == false)
_albumVm = new AlbumViewModel();
if (ResourceLoader.Current.GetResource(ref _playlistVm, Constants.ViewModelPlaylist) == false)
_playlistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref AlbumVm, Constants.ViewModelAlbum) == false)
AlbumVm = new AlbumViewModel();
if (ResourceLoader.Current.GetResource(ref PlaylistVm, Constants.ViewModelPlaylist) == false)
PlaylistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref MainVm, Constants.ViewModelMain) == false)
MainVm = new MainViewModel();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Microsoft.HockeyApp.HockeyClient.Current.TrackPageView(GetType().Name);
await _albumVm.LoadDataAsync();
ListViewSource.Source = _albumVm.Items;
await AlbumVm.LoadDataAsync();
ListViewSource.Source = AlbumVm.Items;
var listViewBase = SemanticZoomContainer.ZoomedOutView as ListViewBase;
if (listViewBase != null)
listViewBase.ItemsSource = ListViewSource.View.CollectionGroups;
......@@ -38,12 +41,12 @@ namespace SonicStreamer.Pages
private async void PlaylistFlyout_Opening(object sender, object e)
{
await _playlistVm.LoadFlyoutDataAsync();
await PlaylistVm.LoadFlyoutDataAsync();
}
private void PlaylistFlyout_Closed(object sender, object e)
{
_playlistVm.ResetFlyoutInputs();
PlaylistVm.ResetFlyoutInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
......
......@@ -2,9 +2,7 @@
x:Class="SonicStreamer.Pages.ArtistsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
DataContext="{Binding Source={StaticResource ArtistVM}}"
NavigationCacheMode="Required"
......@@ -37,20 +35,14 @@
<CommandBar.Resources>
<Style BasedOn="{StaticResource OrangeAppBarButtonStyle}" TargetType="AppBarButton" />
</CommandBar.Resources>
<AppBarButton Icon="Play" Label="Play Selection">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="PlayClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton Icon="Add" Label="Add to Playback">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="AddClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton
Click="{x:Bind ArtistVm.PlayClick}"
Icon="Play"
Label="Play Selection" />
<AppBarButton
Click="{x:Bind ArtistVm.AddClick}"
Icon="Add"
Label="Add to Playback" />
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
......@@ -64,6 +56,7 @@
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
......@@ -73,11 +66,6 @@
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="AddToPlaylistComboBox_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ComboBox>
<TextBox
Margin="0,0,0,5"
......@@ -87,27 +75,18 @@
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="AddToPlayback_Click"
Click="{x:Bind ArtistVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="AddToPlaylistClick" TargetObject="{StaticResource ArtistVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton Icon="Download" Label="Download">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="DownloadTracksClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton
Click="{x:Bind ArtistVm.DownloadTracksClick}"
Icon="Download"
Label="Download" />
</CommandBar>
</Page.BottomAppBar>
......@@ -124,14 +103,9 @@
<StackPanel Orientation="Horizontal">
<RadioButton
x:Name="HamburgerButton"
Click="{x:Bind MainVm.HamburgerButtonClick}"
DataContext="{StaticResource MainVM}"
Style="{StaticResource SplitViewHamburgerButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="HamburgerButtonClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</RadioButton>
Style="{StaticResource SplitViewHamburgerButtonStyle}" />
<TextBlock Style="{StaticResource OrangePageHeaderTextBlockStyle}" Text="artists" />
</StackPanel>
<Grid Grid.Column="1" HorizontalAlignment="Right">
......@@ -155,15 +129,11 @@
IsItemClickEnabled="{Binding IsItemClickEnabled}"
ItemClick="listingItemsView_ItemClick"
ItemsSource="{Binding Source={StaticResource ListViewSource}}"
SelectionChanged="{x:Bind ArtistVm.ListingItems_SelectionChanged}"
SelectionMode="{Binding SelectionMode}">
<ListView.GroupStyle>
<GroupStyle HeaderTemplate="{StaticResource ListingGroupHeaderStyle}" />
</ListView.GroupStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="ListingItems_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</SemanticZoom.ZoomedInView>
</SemanticZoom>
......
......@@ -8,24 +8,27 @@ namespace SonicStreamer.Pages
{
public sealed partial class ArtistsPage : Page
{
readonly ArtistsViewModel _artistVm;
readonly PlaylistViewModel _playlistVm;
public readonly ArtistsViewModel ArtistVm;
public readonly PlaylistViewModel PlaylistVm;
public readonly MainViewModel MainVm;
public ArtistsPage()
{
InitializeComponent();
if (ResourceLoader.Current.GetResource(ref _artistVm, Constants.ViewModelArtist) == false)
_artistVm = new ArtistsViewModel();
if (ResourceLoader.Current.GetResource(ref _playlistVm, Constants.ViewModelPlaylist) == false)
_playlistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref ArtistVm, Constants.ViewModelArtist) == false)
ArtistVm = new ArtistsViewModel();
if (ResourceLoader.Current.GetResource(ref PlaylistVm, Constants.ViewModelPlaylist) == false)
PlaylistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref MainVm, Constants.ViewModelMain) == false)
MainVm = new MainViewModel();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Microsoft.HockeyApp.HockeyClient.Current.TrackPageView(GetType().Name);
await _artistVm.LoadDataAsync();
ListViewSource.Source = _artistVm.Items;
await ArtistVm.LoadDataAsync();
ListViewSource.Source = ArtistVm.Items;
var listViewBase = SemanticZoomContainer.ZoomedOutView as ListViewBase;
if (listViewBase != null)
listViewBase.ItemsSource = ListViewSource.View.CollectionGroups;
......@@ -38,12 +41,12 @@ namespace SonicStreamer.Pages
private async void PlaylistFlyout_Opening(object sender, object e)
{
await _playlistVm.LoadFlyoutDataAsync();
await PlaylistVm.LoadFlyoutDataAsync();
}
private void PlaylistFlyout_Closed(object sender, object e)
{
_playlistVm.ResetFlyoutInputs();
PlaylistVm.ResetFlyoutInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
......
......@@ -65,6 +65,7 @@
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
......@@ -74,11 +75,6 @@
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="AddToPlaylistComboBox_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ComboBox>
<TextBox
Margin="0,0,0,5"
......@@ -88,16 +84,10 @@
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="AddToPlayback_Click"
Click="{x:Bind FolderVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="AddToPlaylistClick" TargetObject="{StaticResource FolderVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
......@@ -125,14 +115,9 @@
<StackPanel Orientation="Horizontal">
<RadioButton
x:Name="HamburgerButton"
Click="{x:Bind MainVm.HamburgerButtonClick}"
DataContext="{StaticResource MainVM}"
Style="{StaticResource SplitViewHamburgerButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="HamburgerButtonClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</RadioButton>
Style="{StaticResource SplitViewHamburgerButtonStyle}" />
<TextBlock Style="{StaticResource OrangePageHeaderTextBlockStyle}" Text="folder" />
</StackPanel>
<Grid Grid.Column="1" HorizontalAlignment="Right">
......@@ -151,13 +136,9 @@
Padding="5,0,0,0"
HorizontalAlignment="Left"
IsItemClickEnabled="True"
ItemClick="{x:Bind FolderVm.Folder_Click}"
ItemsSource="{Binding History}"
SelectionMode="None">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="Folder_Click" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
......@@ -194,7 +175,9 @@
<SemanticZoom.ZoomedInView>
<ListView
IsItemClickEnabled="{Binding IsItemClickEnabled}"
ItemClick="{x:Bind FolderVm.Folder_Click}"
ItemsSource="{Binding Source={StaticResource FolderListViewSource}}"
SelectionChanged="{x:Bind FolderVm.FolderItem_SelectionChanged}"
SelectionMode="{Binding SelectionMode}">
<ListView.GroupStyle>
<GroupStyle HeaderTemplate="{StaticResource ListingGroupHeaderStyle}" />
......@@ -239,14 +222,6 @@
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="Folder_Click" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="FolderItem_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</SemanticZoom.ZoomedInView>
</SemanticZoom>
......@@ -257,17 +232,13 @@
IsMultiSelectCheckBoxEnabled="False"
ItemTemplate="{StaticResource TrackListItemTemplate}"
ItemsSource="{Binding Current.Tracks}"
SelectionChanged="{x:Bind FolderVm.FolderItem_SelectionChanged}"
SelectionMode="{Binding TracksSelectionMode}">
<ListView.ItemContainerStyle>
<Style BasedOn="{StaticResource ListViewItemStyle}" TargetType="ListViewItem">
<Setter Property="Margin" Value="0,0,10,0" />
</Style>
</ListView.ItemContainerStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="FolderItem_SelectionChanged" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</PivotItem>
</Pivot>
......
......@@ -8,23 +8,26 @@ namespace SonicStreamer.Pages
{
public sealed partial class FolderPage : Page
{
private readonly FolderViewModel _folderVm;
private readonly PlaylistViewModel _playlistVm;
public readonly FolderViewModel FolderVm;
public readonly PlaylistViewModel PlaylistVm;
public readonly MainViewModel MainVm;
public FolderPage()
{
InitializeComponent();
if (ResourceLoader.Current.GetResource(ref _folderVm, Constants.ViewModelFolder) == false)
_folderVm = new FolderViewModel();
if (ResourceLoader.Current.GetResource(ref _playlistVm, Constants.ViewModelPlaylist) == false)
_playlistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref FolderVm, Constants.ViewModelFolder) == false)
FolderVm = new FolderViewModel();
if (ResourceLoader.Current.GetResource(ref PlaylistVm, Constants.ViewModelPlaylist) == false)
PlaylistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref MainVm, Constants.ViewModelMain) == false)
MainVm = new MainViewModel();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Microsoft.HockeyApp.HockeyClient.Current.TrackPageView(GetType().Name);
await _folderVm.LoadDataAsync();
await FolderVm.LoadDataAsync();
var listViewBase = SemanticZoomContainer.ZoomedOutView as ListViewBase;
if (listViewBase != null)
listViewBase.ItemsSource = FolderListViewSource.View.CollectionGroups;
......@@ -32,12 +35,12 @@ namespace SonicStreamer.Pages
private async void PlaylistFlyout_Opening(object sender, object e)
{
await _playlistVm.LoadFlyoutDataAsync();
await PlaylistVm.LoadFlyoutDataAsync();
}
private void PlaylistFlyout_Closed(object sender, object e)
{
_playlistVm.ResetFlyoutInputs();
PlaylistVm.ResetFlyoutInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
......
......@@ -2,9 +2,7 @@
x:Class="SonicStreamer.Pages.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
......@@ -67,14 +65,9 @@
<StackPanel Orientation="Horizontal">
<RadioButton
x:Name="HamburgerButton"
Click="{x:Bind MainVm.HamburgerButtonClick}"
DataContext="{StaticResource MainVM}"
Style="{StaticResource SplitViewHamburgerButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="HamburgerButtonClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</RadioButton>
Style="{StaticResource SplitViewHamburgerButtonStyle}" />
<TextBlock Style="{StaticResource OrangePageHeaderTextBlockStyle}" Text="home" />
</StackPanel>
</Grid>
......
......@@ -7,20 +7,23 @@ namespace SonicStreamer.Pages
{
public sealed partial class HomePage : Page
{
private readonly StartViewModel _startVm;
public readonly StartViewModel StartVm;
public readonly MainViewModel MainVm;
public HomePage()
{
InitializeComponent();
if (ResourceLoader.Current.GetResource(ref _startVm, Constants.ViewModelStart) == false)
_startVm = new StartViewModel();
if (ResourceLoader.Current.GetResource(ref StartVm, Constants.ViewModelStart) == false)
StartVm = new StartViewModel();
if (ResourceLoader.Current.GetResource(ref MainVm, Constants.ViewModelMain) == false)
MainVm = new MainViewModel();
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Microsoft.HockeyApp.HockeyClient.Current.TrackPageView(GetType().Name);
await _startVm.LoadDataAsync();
await StartVm.LoadDataAsync();
}
private void ItemView_ItemClick(object sender, ItemClickEventArgs e)
......
This diff is collapsed.
......@@ -9,9 +9,9 @@ namespace SonicStreamer
{
public sealed partial class MainPage : Page
{
readonly MainViewModel _mainVm;
readonly LoginViewModel _loginVm;
readonly PlaybackViewModel _playbackVm;
public readonly MainViewModel MainVm;
public readonly LoginViewModel LoginVm;
public readonly PlaybackViewModel PlaybackVm;
public MainPage()
{
......@@ -20,18 +20,18 @@ namespace SonicStreamer
Loaded += MainPage_Loaded;
Unloaded += MainPage_Unloaded;
if (ResourceLoader.Current.GetResource(ref _mainVm, Constants.ViewModelMain) == false)
_mainVm = new MainViewModel();
if (ResourceLoader.Current.GetResource(ref _loginVm, Constants.ViewModelLogin) == false)
_loginVm = new LoginViewModel();
if (ResourceLoader.Current.GetResource(ref _playbackVm, Constants.ViewModelPlayback) == false)
_playbackVm = new PlaybackViewModel();
if (ResourceLoader.Current.GetResource(ref MainVm, Constants.ViewModelMain) == false)
MainVm = new MainViewModel();
if (ResourceLoader.Current.GetResource(ref LoginVm, Constants.ViewModelLogin) == false)
LoginVm = new LoginViewModel();
if (ResourceLoader.Current.GetResource(ref PlaybackVm, Constants.ViewModelPlayback) == false)
PlaybackVm = new PlaybackViewModel();
}
private async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
_mainVm.LoadData();
await _playbackVm.LoadDataAsync();
MainVm.LoadData();
await PlaybackVm.LoadDataAsync();
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
AppViewBackButtonVisibility.Visible;
SystemNavigationManager.GetForCurrentView().BackRequested += Navigation_BackRequested;
......@@ -48,10 +48,10 @@ namespace SonicStreamer
{
var handled = e.Handled;
if (_mainVm.MainFrame.CanGoBack && !handled)
if (MainVm.MainFrame.CanGoBack && !handled)
{
handled = true;
_mainVm.MainFrame.GoBack();
MainVm.MainFrame.GoBack();
}
e.Handled = handled;
......@@ -59,7 +59,7 @@ namespace SonicStreamer
private void LogoutButtonClick(object sender, RoutedEventArgs e)
{
_loginVm.Logout();
LoginVm.Logout();
Frame.Navigate(typeof(LoginPage), true);
}
......
......@@ -40,14 +40,9 @@
<StackPanel Orientation="Horizontal">
<RadioButton
x:Name="HamburgerButton"
Click="{x:Bind MainVm.HamburgerButtonClick}"
DataContext="{StaticResource MainVM}"
Style="{StaticResource SplitViewHamburgerButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="HamburgerButtonClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</RadioButton>
Style="{StaticResource SplitViewHamburgerButtonStyle}" />
<TextBlock Style="{StaticResource OrangePageHeaderTextBlockStyle}" Text="playback" />
</StackPanel>
</Grid>
......@@ -56,6 +51,7 @@
<ListView
MaxWidth="800"
IsItemClickEnabled="True"
ItemClick="{x:Bind PlaybackVm.PlaybackTracks_ItemClick}"
ItemsSource="{Binding Tracks}"
SelectedItem="{Binding CurrentTrack, Mode=TwoWay}"
SelectionChanged="PlaybackTracks_SelectionChanged">
......@@ -105,11 +101,6 @@
<ListView.ItemContainerStyle>
<Style BasedOn="{StaticResource ListViewItemStyle}" TargetType="ListViewItem" />
</ListView.ItemContainerStyle>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="PlaybackTracks_ItemClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</PivotItem>
<PivotItem Header="artist info">
......
......@@ -9,24 +9,27 @@ namespace SonicStreamer.Pages
{
public sealed partial class PlaybackPage : Page
{
readonly PlaybackViewModel _playbackVm;
public readonly PlaybackViewModel PlaybackVm;
public readonly MainViewModel MainVm;
public PlaybackPage()
{
InitializeComponent();
if (ResourceLoader.Current.GetResource(ref _playbackVm, Constants.ViewModelPlayback) == false)
_playbackVm = new PlaybackViewModel();
if (ResourceLoader.Current.GetResource(ref PlaybackVm, Constants.ViewModelPlayback) == false)
PlaybackVm = new PlaybackViewModel();
if (ResourceLoader.Current.GetResource(ref MainVm, Constants.ViewModelMain) == false)
MainVm = new MainViewModel();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Microsoft.HockeyApp.HockeyClient.Current.TrackPageView(GetType().Name);
if (!_playbackVm.IsSmallPlaybackEnabled) return;
if (!PlaybackVm.IsSmallPlaybackEnabled) return;
_playbackVm.PanelStaus = PlaybackViewModel.PlaybackPanelStatus.Page;
_playbackVm.IsPlaybackPanelVisible = false;
PlaybackVm.PanelStaus = PlaybackViewModel.PlaybackPanelStatus.Page;
PlaybackVm.IsPlaybackPanelVisible = false;
var firstPivotItem = PlaybackPivot.Items.First() as PivotItem;
if (firstPivotItem?.Header as string == "playing") return;
var playbackView = new PivotItem
......@@ -39,9 +42,9 @@ namespace SonicStreamer.Pages
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (!_playbackVm.IsSmallPlaybackEnabled) return;
_playbackVm.PanelStaus = PlaybackViewModel.PlaybackPanelStatus.Small;
_playbackVm.IsPlaybackPanelVisible = true;
if (!PlaybackVm.IsSmallPlaybackEnabled) return;
PlaybackVm.PanelStaus = PlaybackViewModel.PlaybackPanelStatus.Small;
PlaybackVm.IsPlaybackPanelVisible = true;
}
private void PlaybackTracks_SelectionChanged(object sender, SelectionChangedEventArgs e)
......
This diff is collapsed.
......@@ -8,20 +8,23 @@ namespace SonicStreamer.Pages
{
public sealed partial class PlaylistPage : Page
{
private readonly PlaylistViewModel _playlistVm;
public readonly PlaylistViewModel PlaylistVm;
public readonly MainViewModel MainVm;
public PlaylistPage()
{
InitializeComponent();
if (ResourceLoader.Current.GetResource(ref _playlistVm, Constants.ViewModelPlaylist) == false)
_playlistVm = new PlaylistViewModel();
if (ResourceLoader.Current.GetResource(ref PlaylistVm, Constants.ViewModelPlaylist) == false)