Commit afafbf7f authored by Axelander's avatar Axelander

Adding tracks to a playlist redesigned to fix playlist selection (issue #36)

parent ae3a4cb3
<UserControl
x:Class="SonicStreamer.Controls.AddToPlaylistDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Styles/TextBlockStyles.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/TextBoxStyles.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/ButtonStyles.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/ComboBoxStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<StackPanel DataContext="{StaticResource PlaylistVM}">
<ComboBox
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
PlaceholderText="New Playlist Name"
Style="{StaticResource OrangeTextBoxStyle}"
Text="{Binding NewPlaylistName, Mode=TwoWay}"
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
</Grid>
</UserControl>
using Windows.UI.Xaml.Controls;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
using System.Threading.Tasks;
namespace SonicStreamer.Controls
{
public sealed partial class AddToPlaylistDialog : UserControl
{
public readonly PlaylistViewModel PlaylistVm;
public AddToPlaylistDialog()
{
this.InitializeComponent();
if (ResourceLoader.Current.GetResource(ref PlaylistVm, Constants.ViewModelPlaylist) == false)
PlaylistVm = new PlaylistViewModel();
}
}
}
......@@ -43,46 +43,10 @@
Click="{x:Bind AlbumVm.AddClick}"
Icon="Add"
Label="Add to Playback" />
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
x:Name="PlaylistFlyout"
Closed="PlaylistFlyout_Closed"
Opening="PlaylistFlyout_Opening">
<StackPanel MinWidth="250" DataContext="{StaticResource PlaylistVM}">
<ComboBox
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
Margin="0,0,0,5"
PlaceholderText="New Playlist Name"
Style="{StaticResource OrangeTextBoxStyle}"
Text="{Binding NewPlaylistName, Mode=TwoWay}"
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="{x:Bind AlbumVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton
Click="AddToPlaylist_Click"
Icon="Favorite"
Label="Add to Playlist" />
<AppBarButton
Click="{x:Bind AlbumVm.DownloadTracksClick}"
Icon="Download"
......@@ -95,7 +59,14 @@
<RowDefinition Height="48" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<ContentDialog
x:Name="AddToPlaylistDialog"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
Opened="AddToPlaylistDialog_OnOpened"
PrimaryButtonText="Add To Playlist"
SecondaryButtonText="Cancel" />
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
......
using SonicStreamer.Common.System;
using System;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using SonicStreamer.Controls;
namespace SonicStreamer.Pages
{
......@@ -39,19 +41,21 @@ namespace SonicStreamer.Pages
Frame.Navigate(typeof(TrackListingPage), e.ClickedItem);
}
private async void PlaylistFlyout_Opening(object sender, object e)
private async void AddToPlaylist_Click(object sender, RoutedEventArgs e)
{
await PlaylistVm.LoadFlyoutDataAsync();
AddToPlaylistDialog.Content = new AddToPlaylistDialog();
var dialogResult = await AddToPlaylistDialog.ShowAsync();
if (dialogResult == ContentDialogResult.Primary)
{
await AlbumVm.AddToPlaylistAsync();
}
PlaylistVm.ResetDialogInputs();
}
private void PlaylistFlyout_Closed(object sender, object e)
private async void AddToPlaylistDialog_OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
PlaylistVm.ResetFlyoutInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
{
PlaylistFlyout.Hide();
await PlaylistVm.LoadDialogDataAsync();
}
}
}
\ No newline at end of file
......@@ -43,46 +43,10 @@
Click="{x:Bind ArtistVm.AddClick}"
Icon="Add"
Label="Add to Playback" />
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
x:Name="PlaylistFlyout"
Closed="PlaylistFlyout_Closed"
Opening="PlaylistFlyout_Opening">
<StackPanel MinWidth="250" DataContext="{StaticResource PlaylistVM}">
<ComboBox
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
Margin="0,0,0,5"
PlaceholderText="New Playlist Name"
Style="{StaticResource OrangeTextBoxStyle}"
Text="{Binding NewPlaylistName, Mode=TwoWay}"
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="{x:Bind ArtistVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton
Click="AddToPlaylist_Click"
Icon="Favorite"
Label="Add to Playlist" />
<AppBarButton
Click="{x:Bind ArtistVm.DownloadTracksClick}"
Icon="Download"
......@@ -95,7 +59,14 @@
<RowDefinition Height="48" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<ContentDialog
x:Name="AddToPlaylistDialog"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
Opened="AddToPlaylistDialog_OnOpened"
PrimaryButtonText="Add To Playlist"
SecondaryButtonText="Cancel" />
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
......
using SonicStreamer.Common.System;
using System;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using SonicStreamer.Controls;
namespace SonicStreamer.Pages
{
......@@ -39,19 +41,21 @@ namespace SonicStreamer.Pages
Frame.Navigate(typeof(TrackListingPage), e.ClickedItem);
}
private async void PlaylistFlyout_Opening(object sender, object e)
private async void AddToPlaylist_Click(object sender, RoutedEventArgs e)
{
await PlaylistVm.LoadFlyoutDataAsync();
AddToPlaylistDialog.Content = new AddToPlaylistDialog();
var dialogResult = await AddToPlaylistDialog.ShowAsync();
if (dialogResult == ContentDialogResult.Primary)
{
await ArtistVm.AddToPlaylistAsync();
}
PlaylistVm.ResetDialogInputs();
}
private void PlaylistFlyout_Closed(object sender, object e)
private async void AddToPlaylistDialog_OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
PlaylistVm.ResetFlyoutInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
{
PlaylistFlyout.Hide();
await PlaylistVm.LoadDialogDataAsync();
}
}
}
\ No newline at end of file
......@@ -52,46 +52,10 @@
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
x:Name="PlaylistFlyout"
Closed="PlaylistFlyout_Closed"
Opening="PlaylistFlyout_Opening">
<StackPanel MinWidth="250" DataContext="{StaticResource PlaylistVM}">
<ComboBox
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
Margin="0,0,0,5"
PlaceholderText="New Playlist Name"
Style="{StaticResource OrangeTextBoxStyle}"
Text="{Binding NewPlaylistName, Mode=TwoWay}"
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="{x:Bind FolderVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton
Click="AddToPlaylist_Click"
Icon="Favorite"
Label="Add to Playlist" />
<AppBarButton Icon="Download" Label="Download">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
......@@ -107,7 +71,14 @@
<RowDefinition Height="48" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<ContentDialog
x:Name="AddToPlaylistDialog"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
Opened="AddToPlaylistDialog_OnOpened"
PrimaryButtonText="Add To Playlist"
SecondaryButtonText="Cancel" />
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
......
using SonicStreamer.Common.System;
using System;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using SonicStreamer.Controls;
namespace SonicStreamer.Pages
{
......@@ -33,19 +35,21 @@ namespace SonicStreamer.Pages
listViewBase.ItemsSource = FolderListViewSource.View.CollectionGroups;
}
private async void PlaylistFlyout_Opening(object sender, object e)
private async void AddToPlaylist_Click(object sender, RoutedEventArgs e)
{
await PlaylistVm.LoadFlyoutDataAsync();
}
AddToPlaylistDialog.Content = new AddToPlaylistDialog();
private void PlaylistFlyout_Closed(object sender, object e)
{
PlaylistVm.ResetFlyoutInputs();
var dialogResult = await AddToPlaylistDialog.ShowAsync();
if (dialogResult == ContentDialogResult.Primary)
{
await FolderVm.AddToPlaylistAsync();
}
PlaylistVm.ResetDialogInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
private async void AddToPlaylistDialog_OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
PlaylistFlyout.Hide();
await PlaylistVm.LoadDialogDataAsync();
}
}
}
\ No newline at end of file
......@@ -48,46 +48,10 @@
Click="{x:Bind SearchVm.AddClick}"
Icon="Add"
Label="Add to Playback" />
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
x:Name="PlaylistFlyout"
Closed="PlaylistFlyout_Closed"
Opening="PlaylistFlyout_Opening">
<StackPanel MinWidth="250" DataContext="{StaticResource PlaylistVM}">
<ComboBox
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
Margin="0,0,0,5"
PlaceholderText="New Playlist Name"
Style="{StaticResource OrangeTextBoxStyle}"
Text="{Binding NewPlaylistName, Mode=TwoWay}"
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="{x:Bind SearchVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton
Click="AddToPlaylist_Click"
Icon="Favorite"
Label="Add to Playlist" />
<AppBarButton
Click="{x:Bind SearchVm.DownloadTracksClick}"
Icon="Download"
......@@ -100,7 +64,14 @@
<RowDefinition Height="48" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<ContentDialog
x:Name="AddToPlaylistDialog"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
Opened="AddToPlaylistDialog_OnOpened"
PrimaryButtonText="Add To Playlist"
SecondaryButtonText="Cancel" />
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
......
using SonicStreamer.Common.System;
using System;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using SonicStreamer.Controls;
namespace SonicStreamer.Pages
{
......@@ -34,19 +36,21 @@ namespace SonicStreamer.Pages
Frame.Navigate(typeof(TrackListingPage), e.ClickedItem);
}
private async void PlaylistFlyout_Opening(object sender, object e)
private async void AddToPlaylist_Click(object sender, RoutedEventArgs e)
{
await PlaylistVm.LoadFlyoutDataAsync();
AddToPlaylistDialog.Content = new AddToPlaylistDialog();
var dialogResult = await AddToPlaylistDialog.ShowAsync();
if (dialogResult == ContentDialogResult.Primary)
{
await SearchVm.AddToPlaylistAsync();
}
PlaylistVm.ResetDialogInputs();
}
private void PlaylistFlyout_Closed(object sender, object e)
private async void AddToPlaylistDialog_OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
PlaylistVm.ResetFlyoutInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
{
PlaylistFlyout.Hide();
await PlaylistVm.LoadDialogDataAsync();
}
}
}
\ No newline at end of file
......@@ -44,46 +44,10 @@
Click="{x:Bind TrackListingVm.AddClick}"
Icon="Add"
Label="Add to Playback" />
<AppBarButton Icon="Favorite" Label="Add to Playlist">
<AppBarButton.Flyout>
<Flyout
x:Name="PlaylistFlyout"
Closed="PlaylistFlyout_Closed"
Opening="PlaylistFlyout_Opening">
<StackPanel MinWidth="250" DataContext="{StaticResource PlaylistVM}">
<ComboBox
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
ItemsSource="{Binding AvailablePlaylists}"
PlaceholderText="Select a playlist"
SelectedItem="{Binding SelectedAddToPlaylist, Mode=TwoWay}"
SelectionChanged="{x:Bind PlaylistVm.AddToPlaylistComboBox_SelectionChanged}"
Style="{StaticResource OrangeComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource OrangeComboBoxItemStyle}" TargetType="ComboBoxItem" />
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
Margin="0,0,0,5"
PlaceholderText="New Playlist Name"
Style="{StaticResource OrangeTextBoxStyle}"
Text="{Binding NewPlaylistName, Mode=TwoWay}"
Visibility="{Binding IsNewPlaylistTextBoxVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button
HorizontalAlignment="Center"
Click="{x:Bind TrackListingVm.AddToPlaylistClick}"
Content="Add to Playlist"
IsEnabled="{Binding IsAddToPlaylistButtonEnabled}"
Style="{StaticResource OrangeButtonStyle}" />
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton
Click="AddToPlaylist_Click"
Icon="Favorite"
Label="Add to Playlist" />
<AppBarButton
Click="{x:Bind TrackListingVm.DownloadTracksClick}"
Icon="Download"
......@@ -103,7 +67,14 @@
Opacity="0.2"
Stretch="UniformToFill" />
</Grid.Background>
<Grid>
<ContentDialog
x:Name="AddToPlaylistDialog"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
Opened="AddToPlaylistDialog_OnOpened"
PrimaryButtonText="Add To Playlist"
SecondaryButtonText="Cancel" />
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal">
<RadioButton
x:Name="HamburgerButton"
......
using SonicStreamer.Common.System;
using System;
using SonicStreamer.Common.System;
using SonicStreamer.Subsonic.Data;
using SonicStreamer.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using SonicStreamer.Controls;
namespace SonicStreamer.Pages
{
......@@ -35,19 +37,21 @@ namespace SonicStreamer.Pages
}
}
private async void PlaylistFlyout_Opening(object sender, object e)
private async void AddToPlaylist_Click(object sender, RoutedEventArgs e)
{
await PlaylistVm.LoadFlyoutDataAsync();
}
AddToPlaylistDialog.Content = new AddToPlaylistDialog();
private void PlaylistFlyout_Closed(object sender, object e)
{
PlaylistVm.ResetFlyoutInputs();
var dialogResult = await AddToPlaylistDialog.ShowAsync();
if (dialogResult == ContentDialogResult.Primary)
{
await TrackListingVm.AddToPlaylistAsync();
}
PlaylistVm.ResetDialogInputs();
}
private void AddToPlayback_Click(object sender, RoutedEventArgs e)
private async void AddToPlaylistDialog_OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
{
PlaylistFlyout.Hide();
await PlaylistVm.LoadDialogDataAsync();
}
}
}
\ No newline at end of file
......@@ -122,6 +122,9 @@
<Compile Include="Common\System\PlaybackService.cs" />
<Compile Include="Common\System\ResourceLoader.cs" />
<Compile Include="Common\System\SubsonicConnector.cs" />
<Compile Include="Controls\AddToPlaylistDialog.xaml.cs">
<DependentUpon>AddToPlaylistDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ArtistInfoView.xaml.cs">
<DependentUpon>ArtistInfoView.xaml</DependentUpon>
</Compile>
......@@ -322,6 +325,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Controls\AddToPlaylistDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ArtistInfoView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
......@@ -219,12 +219,12 @@ namespace SonicStreamer.ViewModels
}
/// <summary>
/// Bindable Methode um Tracks zu einer Playlist hinzuzufügen
/// Fügt anhand der Auswahl die Tracks zu einer Playlist hinzu
/// </summary>
public async void AddToPlaylistClick()
public async Task AddToPlaylistAsync()
{
Microsoft.HockeyApp.HockeyClient.Current.TrackEvent(string.Format("{0} - {1}", GetType().Name,
"AddToPlaylistClick"));
"AddToPlaylistAsync"));
var playlistVm = new PlaylistViewModel();
ResourceLoader.Current.GetResource(ref playlistVm, Constants.ViewModelPlaylist);
await playlistVm.AddTracksToPlaylistAsync(await GetTracksAsync());
......
......@@ -440,25 +440,22 @@ namespace SonicStreamer.ViewModels
#endregion
#region Playback and Playlist Handling
#region Playlist Handling
/// <summary>
/// Speichert die markierten Elemente in einer neuen Playlist
/// Fügt anhand der Auswahl die Tracks zu einer Playlist hinzu
/// </summary>
/// <param name="newName">Name der neuen Playlist</param>
public async Task SaveSelectionAsync(string newName)
public async Task AddToPlaylistAsync()
{
var tracks = await GetTracksAsync();
await PlaylistVm.CreatePlaylistAsync(newName, tracks);
}
/// <summary>
/// Speichert die markierten Elemente in der übergebenen Playlist
/// </summary>
public async Task SaveSelectionAsync(Playlist playlist)
{
var tracks = await GetTracksAsync();
await PlaylistVm.AddTracksToPlaylistAsync(playlist.Id, tracks);
Microsoft.HockeyApp.HockeyClient.Current.TrackEvent(string.Format("{0} - {1}", GetType().Name,
"AddToPlaylistAsync"));
var playlistVm = new PlaylistViewModel();
ResourceLoader.Current.GetResource(ref playlistVm, Constants.ViewModelPlaylist);
await playlistVm.AddTracksToPlaylistAsync(await GetTracksAsync());
if (SettingsVm.IsSelectionCleared)
{
SelectionMode = ListViewSelectionMode.None;
}
}
#endregion
......@@ -507,22 +504,6 @@ namespace SonicStreamer.ViewModels
}
}
/// <summary>
/// Bindable Methode um Tracks zu einer Playlist hinzuzufügen
/// </summary>
public async void AddToPlaylistClick()
{
Microsoft.HockeyApp.HockeyClient.Current.TrackEvent(string.Format("{0} - {1}", GetType().Name,
"AddToPlaylistClick"));
var playlistVm = new PlaylistViewModel();
ResourceLoader.Current.GetResource(ref playlistVm, Constants.ViewModelPlaylist);
await playlistVm.AddTracksToPlaylistAsync(await GetTracksAsync());
if (SettingsVm.IsSelectionCleared)
{
SelectionMode = ListViewSelectionMode.None;
}
}
/// <summary>
/// Bindable Methode um die Tracks der markierten Elementen herunterzuladen
/// </summary>
......
......@@ -560,9 +560,9 @@ namespace SonicStreamer.ViewModels
}
/// <summary>
/// Lädt die Daten für das AddToPlaylist-Flyout
/// Lädt die Daten für das AddToPlaylistAsync-Flyout
/// </summary>
public async Task LoadFlyoutDataAsync()
public async Task LoadDialogDataAsync()
{
await LoadDataAsync();
foreach (var item in Playlists)
......@@ -573,9 +573,9 @@ namespace SonicStreamer.ViewModels
}