...
 
Commits (4)
......@@ -2,6 +2,7 @@
The MIT License (MIT)
applies to:
- MusicBrainz C# library, Copyright (c) 2013 avatar29A
- UWP Community Toolkit, Copyright (c) .NET Foundation and Contributors
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy of
......
......@@ -11,6 +11,14 @@ The whole app uses the [Model–view–view-model (MVVM) pattern](https://en.wik
The following 3rd party libraries are used:
### Json.NET Schema
Json.NET Schema is a powerful, complete and easy to use JSON Schema framework for .NET
- Author: [Newtonsoft](http://www.newtonsoft.com/)
- Source: [GitHub](https://github.com/JamesNK/Newtonsoft.Json.Schema)
- License: [GNU Affero General Public License Version 3](http://www.gnu.org/licenses/agpl-3.0.html)
### MusicBrainz
C# library which implements the MusicBrainz API.
......@@ -19,10 +27,10 @@ C# library which implements the MusicBrainz API.
- Source: [GitHub](https://github.com/avatar29A)
- License: [The MIT License (MIT)](https://github.com/avatar29A/MusicBrainz/blob/master/LICENSE.txt)
### Json.NET Schema
### UWP Community Toolkit
Json.NET Schema is a powerful, complete and easy to use JSON Schema framework for .NET
The UWP Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks building UWP apps for Windows 10. The toolkit is part of the .NET Foundation.
- Author: [Newtonsoft](http://www.newtonsoft.com/)
- Source: [GitHub](https://github.com/JamesNK/Newtonsoft.Json.Schema)
- License: [GNU Affero General Public License Version 3](http://www.gnu.org/licenses/agpl-3.0.html)
\ No newline at end of file
- Author: [.NET Foundation and Contributors](https://github.com/Microsoft/UWPCommunityToolkit)
- Source: [GitHub](https://github.com/Microsoft/UWPCommunityToolkit)
- License: [The MIT License (MIT)](https://github.com/Microsoft/UWPCommunityToolkit/blob/master/license.md)
\ No newline at end of file
......@@ -19,7 +19,13 @@ namespace SonicStreamer.Test.ViewModels
[TestMethod]
public async Task CreateArtistInfoTestAsync()
{
var firstArtistTest = await ArtistInfo.CreateAsync("23", "The Dada Weatherman", new FakeDispatcherWrapper());
var activeServices = new ArtistInfo.ActiveServices
{
LastFm = true,
MusicBrainz = true,
Twitter = true
};
var firstArtistTest = await ArtistInfo.CreateAsync("23", "The Dada Weatherman", activeServices, new FakeDispatcherWrapper());
Assert.AreEqual("The Dada Weatherman", firstArtistTest.Name);
Assert.AreEqual("cb974849-8230-483f-869e-643528bb3565", firstArtistTest.Mbid);
Assert.IsTrue(firstArtistTest.HasBiography);
......@@ -53,7 +59,7 @@ namespace SonicStreamer.Test.ViewModels
}
// Test Artist with SubsonicSimilarArtists
var secondArtistTest = await ArtistInfo.CreateAsync("12", "Antígona", new FakeDispatcherWrapper());
var secondArtistTest = await ArtistInfo.CreateAsync("12", "Antígona", activeServices, new FakeDispatcherWrapper());
Assert.AreEqual(3, secondArtistTest.SubsonicSimilarArtists.Count);
foreach (var subsonicSimilarArtist in secondArtistTest.SubsonicSimilarArtists)
{
......
......@@ -19,10 +19,6 @@ namespace SonicStreamer.Test.ViewModels
{
var startVm = new StartViewModel();
await startVm.LoadDataAsync();
Assert.AreEqual(startVm.FrequentAlbums.Count, 12);
Assert.AreEqual(startVm.NewestAlbums.Count, 12);
Assert.AreEqual(startVm.RandomAlbums.Count, 12);
Assert.AreEqual(startVm.RecentAlbums.Count, 12);
}
}
}
\ No newline at end of file
......@@ -57,6 +57,7 @@ namespace SonicStreamer
#endif
await CreateRootFrameAsync(e.PreviousExecutionState, e.Arguments);
await Constants.Secrets.LoadDataAsync();
// Sicherstellen, dass das aktuelle Fenster aktiv ist
Window.Current.Activate();
......
namespace SonicStreamer.Common.System
using System;
using System.IO;
using System.Threading.Tasks;
using Windows.Storage;
namespace SonicStreamer.Common.System
{
public static class Constants
{
......@@ -53,5 +58,46 @@
public const string PlaybackCover = "cover";
public const string PlaybackDuration = "duration";
public const string PlaybackDurationOutput = "durationOutput";
public static class Secrets
{
public static string TwitterConsumerKey;
public static string TwitterConsumerSecret;
public static string TwitterCallback;
public static string LastfmApiKey;
public static async Task LoadDataAsync()
{
var assetFolder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Assets");
var secretFile = await assetFolder.GetFileAsync("Secrets.user");
foreach (var line in await FileIO.ReadLinesAsync(secretFile))
{
if (line.StartsWith("TWITTER_CONSUMER_KEY"))
{
var lineData = line.Split('=');
TwitterConsumerKey = lineData[1];
continue;
}
if (line.StartsWith("TWITTER_CONSUMER_SECRET"))
{
var lineData = line.Split('=');
TwitterConsumerSecret = lineData[1];
continue;
}
if (line.StartsWith("TWITTER_CALLBACK"))
{
var lineData = line.Split('=');
TwitterCallback = lineData[1];
continue;
}
if (line.StartsWith("LASTFM_API_KEY"))
{
var lineData = line.Split('=');
LastfmApiKey = lineData[1];
continue;
}
}
}
}
}
}
\ No newline at end of file
<UserControl
x:Class="SonicStreamer.Controls.ArtistInfoPanels.ArtistBiographyPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:SonicStreamer.Common"
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/ListViewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<common:BooleanToVisibilityConverter x:Key="BoolToVis" />
</ResourceDictionary>
</UserControl.Resources>
<Grid Visibility="{Binding HasBiography, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="Biography" />
<TextBlock
Grid.Row="1"
MaxLines="0"
Style="{StaticResource InfoTextBlockStyle}"
Text="{Binding Biography}" />
</Grid>
</UserControl>
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.ArtistInfoPanels
{
public sealed partial class ArtistBiographyPanel : UserControl
{
public ArtistBiographyPanel()
{
this.InitializeComponent();
}
}
}
<UserControl
x:Class="SonicStreamer.Controls.ArtistInfoPanels.ArtistGeneralInfoPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:SonicStreamer.Common"
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/ListViewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<common:BooleanToVisibilityConverter x:Key="BoolToVis" />
</ResourceDictionary>
</UserControl.Resources>
<Grid Visibility="{Binding HasGeneralInfo, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="General" />
<ListView
Grid.Row="1"
ItemsSource="{Binding Infos}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource InfoDescriptionTextBlockStyle}" Text="{Binding Item1}" />
<TextBlock
Grid.Column="1"
Style="{StaticResource InfoTextBlockStyle}"
Text="{Binding Item2}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Padding" Value="0" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</Grid>
</UserControl>
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.ArtistInfoPanels
{
public sealed partial class ArtistGeneralInfoPanel : UserControl
{
public ArtistGeneralInfoPanel()
{
this.InitializeComponent();
}
}
}
<UserControl
x:Class="SonicStreamer.Controls.ArtistInfoPanels.ArtistSocialLinksPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:SonicStreamer.Common"
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"
xmlns:wrapPanel="using:Microsoft.Toolkit.Uwp.UI.Controls.WrapPanel"
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/ListViewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<common:BooleanToVisibilityConverter x:Key="BoolToVis" />
</ResourceDictionary>
</UserControl.Resources>
<Grid Visibility="{Binding HasSocialLinks, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="Social" />
<GridView
Grid.Row="1"
IsItemClickEnabled="True"
ItemsSource="{Binding SocialLinks}"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Image
Width="32"
Height="32"
Source="{Binding Item1}" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="Padding" Value="5" />
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<wrapPanel:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="SocialLinkClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</GridView>
</Grid>
</UserControl>
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.ArtistInfoPanels
{
public sealed partial class ArtistSocialLinksPanel : UserControl
{
public ArtistSocialLinksPanel()
{
this.InitializeComponent();
}
}
}
<UserControl
x:Class="SonicStreamer.Controls.ArtistInfoPanels.ArtistTagsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:SonicStreamer.Common"
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"
xmlns:wrapPanel="using:Microsoft.Toolkit.Uwp.UI.Controls.WrapPanel"
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/ListViewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<common:BooleanToVisibilityConverter x:Key="BoolToVis" />
</ResourceDictionary>
</UserControl.Resources>
<Grid Visibility="{Binding HasTags, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="Tags" />
<GridView
Grid.Row="1"
IsItemClickEnabled="True"
ItemsSource="{Binding Tags}"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock
Margin="15,10"
Style="{StaticResource InfoTextBlockStyle}"
Text="{Binding Name}" />
<Ellipse
RenderTransformOrigin="0.5,0"
Stroke="Orange"
StrokeThickness="2.5" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="Padding" Value="5" />
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<wrapPanel:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="TagClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</GridView>
</Grid>
</UserControl>
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.ArtistInfoPanels
{
public sealed partial class ArtistTagsPanel : UserControl
{
public ArtistTagsPanel()
{
this.InitializeComponent();
}
}
}
......@@ -2,8 +2,8 @@
x:Class="SonicStreamer.Controls.ArtistInfoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:artistInfoPanels="using:SonicStreamer.Controls.ArtistInfoPanels"
xmlns:common="using:SonicStreamer.Common"
xmlns:controls="using:SonicStreamer.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{StaticResource TrackListingVM}"
......@@ -35,22 +35,6 @@
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Margin" Value="0,10" />
</Style>
<Style
x:Key="InfoTextBlockStyle"
BasedOn="{StaticResource OrangeBodyTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="0,10" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
<Setter Property="MaxLines" Value="2" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style
x:Key="InfoDescriptionTextBlockStyle"
BasedOn="{StaticResource InfoTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Width" Value="80" />
</Style>
</ResourceDictionary>
</UserControl.Resources>
......@@ -66,124 +50,19 @@
</Grid>
<!-- Artist Info -->
<Grid Style="{StaticResource InfoSectionGridStyle}" Visibility="{Binding HasGeneralInfo, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="General" />
<ListView
Grid.Row="1"
ItemsSource="{Binding Infos}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource InfoDescriptionTextBlockStyle}" Text="{Binding Item1}" />
<TextBlock
Grid.Column="1"
Style="{StaticResource InfoTextBlockStyle}"
Text="{Binding Item2}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Padding" Value="0" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
<artistInfoPanels:ArtistGeneralInfoPanel />
</Grid>
<!-- Tags -->
<Grid Style="{StaticResource InfoSectionGridStyle}" Visibility="{Binding HasTags, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="Tags" />
<GridView
Grid.Row="1"
IsItemClickEnabled="True"
ItemClick="{x:Bind TrackListingVm.ArtistInfo.TagClick}"
ItemsSource="{Binding Tags}"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock
Margin="15,10"
Style="{StaticResource InfoTextBlockStyle}"
Text="{Binding Name}" />
<Ellipse
RenderTransformOrigin="0.5,0"
Stroke="Orange"
StrokeThickness="2.5" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="Padding" Value="5" />
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
<artistInfoPanels:ArtistTagsPanel />
</Grid>
<!-- Socila Links -->
<!-- Social Links -->
<Grid Style="{StaticResource InfoSectionGridStyle}" Visibility="{Binding HasSocialLinks, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="Social" />
<GridView
Grid.Row="1"
IsItemClickEnabled="True"
ItemClick="{x:Bind TrackListingVm.ArtistInfo.SocialLinkClick}"
ItemsSource="{Binding SocialLinks}"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Image
Width="32"
Height="32"
Source="{Binding Item1}" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="Padding" Value="5" />
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
<artistInfoPanels:ArtistSocialLinksPanel />
</Grid>
<!-- Biography -->
<Grid Style="{StaticResource InfoSectionGridStyle}" Visibility="{Binding HasBiography, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="Biography" />
<TextBlock
Grid.Row="1"
MaxLines="0"
Style="{StaticResource InfoTextBlockStyle}"
Text="{Binding Biography}" />
<artistInfoPanels:ArtistBiographyPanel />
</Grid>
</StackPanel>
</ScrollViewer>
......
<UserControl
x:Class="SonicStreamer.Controls.SectionViews.AlbumListsSectionView"
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:data="using:SonicStreamer.Subsonic.Data"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sections="using:SonicStreamer.ViewModelItems.Sections"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Styles/ListViewStyles.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/TextBlockStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<GridView
IsItemClickEnabled="True"
IsSwipeEnabled="False"
ItemsSource="{Binding AlbumLists}"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate x:DataType="sections:AlbumList">
<GridView
Header="{Binding Header}"
IsItemClickEnabled="True"
IsSwipeEnabled="False"
ItemTemplate="{StaticResource AlbumTileItemTemplate}"
ItemsSource="{Binding Albums}"
SelectionMode="None">
<GridView.HeaderTemplate>
<DataTemplate>
<TextBlock Style="{StaticResource InfoSectionHeaderTextBlockStyle}" Text="{Binding}" />
</DataTemplate>
</GridView.HeaderTemplate>
</GridView>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</UserControl>
\ No newline at end of file
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.SectionViews
{
public sealed partial class AlbumListsSectionView : UserControl
{
public AlbumListsSectionView()
{
this.InitializeComponent();
}
}
}
<UserControl
x:Class="SonicStreamer.Controls.SectionViews.ArtistSectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:artistInfoPanels="using:SonicStreamer.Controls.ArtistInfoPanels"
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"
d:DesignHeight="600"
d:DesignWidth="450"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Styles/ListViewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel x:Name="LeftPanel">
<artistInfoPanels:ArtistGeneralInfoPanel Margin="5,0" DataContext="{Binding ArtistInfo}" />
<artistInfoPanels:ArtistSocialLinksPanel Margin="5,0" DataContext="{Binding ArtistInfo}" />
<GridView
Margin="5,0"
IsItemClickEnabled="True"
IsSwipeEnabled="False"
ItemTemplate="{StaticResource AlbumTileItemTemplate}"
ItemsSource="{Binding Albums}"
SelectionMode="None">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="Album_ItemClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</GridView>
</StackPanel>
<Grid x:Name="RightPanel">
<ListView
ItemContainerStyle="{StaticResource ListViewItemStyle}"
ItemTemplate="{StaticResource TweetItemTemplate}"
ItemsSource="{Binding ArtistInfo.Tweets}"
SelectionMode="None" />
</Grid>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RightPanel.(Grid.Row)" Value="1" />
<Setter Target="RightPanel.(Grid.Column)" Value="0" />
<Setter Target="LeftPanel.(Grid.ColumnSpan)" Value="2" />
<Setter Target="RightPanel.(Grid.ColumnSpan)" Value="2" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1000" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RightPanel.(Grid.Row)" Value="0" />
<Setter Target="RightPanel.(Grid.Column)" Value="1" />
<Setter Target="LeftPanel.(Grid.ColumnSpan)" Value="1" />
<Setter Target="RightPanel.(Grid.ColumnSpan)" Value="1" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ScrollViewer>
</UserControl>
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.SectionViews
{
public sealed partial class ArtistSectionView : UserControl
{
public ArtistSectionView()
{
this.InitializeComponent();
}
}
}
<UserControl
x:Class="SonicStreamer.Controls.SectionViews.PinnedAlbumsSectionView"
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"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Styles/ListingItemStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<ListView ItemsSource="{Binding Albums}" Style="{StaticResource LargeListingListViewStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="Album_ItemClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</UserControl>
\ No newline at end of file
using Windows.UI.Xaml.Controls;
namespace SonicStreamer.Controls.SectionViews
{
public sealed partial class PinnedAlbumsSectionView : UserControl
{
public PinnedAlbumsSectionView()
{
this.InitializeComponent();
}
}
}
<UserControl
x:Class="SonicStreamer.Controls.SectionViews.PlaylistSectionView"
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"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="ms-appx:///Styles/CommandBarStyles.xaml" />-->
<ResourceDictionary Source="ms-appx:///Styles/TextBlockStyles.xaml" />
<!--<ResourceDictionary Source="ms-appx:///Styles/TextBoxStyles.xaml" />-->
<!--<ResourceDictionary Source="ms-appx:///Styles/ListViewStyles.xaml" />-->
<ResourceDictionary Source="ms-appx:///Styles/ListingItemStyles.xaml" />
<!--<ResourceDictionary Source="ms-appx:///Styles/PivotStyles.xaml" />-->
<ResourceDictionary Source="ms-appx:///Styles/ButtonStyles.xaml" />
<!--<ResourceDictionary Source="ms-appx:///Styles/SplitViewStyles.xaml" />-->
<!--<ResourceDictionary Source="ms-appx:///Styles/ComboBoxStyles.xaml" />-->
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource BaseTextBlockStyle}" TargetType="TextBlock" />
</ResourceDictionary>
</UserControl.Resources>
<GridView
IsItemClickEnabled="True"
IsSwipeEnabled="False"
ItemsSource="{Binding Playlists}"
SelectionMode="None">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Width="100" Height="100">
<Image Source="ms-appx:///Assets/cover.png" />
<Image Canvas.ZIndex="1" Source="{Binding Cover.Uri}" />
<Button
Margin="0,0,5,5"
Canvas.ZIndex="1"
Style="{StaticResource OrangePlayButtonStyle}">
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="PlayAlbumClick" TargetObject="{StaticResource TrackListingVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</Button>
</Grid>
<StackPanel Grid.Column="1" Margin="10">
<TextBlock
Margin="0,0,0,10"
Style="{StaticResource OrangeSubtitleTextBlockStyle}"
Text="{Binding Name}" />
<TextBlock
Margin="0,0,0,10"
Style="{StaticResource OrangeBaseTextBlockStyle}"
Text="{Binding Year}" />
<Button Margin="0,0,5,0" Style="{StaticResource ItemOptionButtonStyle}">
<Button.Flyout>
<MenuFlyout Placement="Bottom">
<MenuFlyoutItem Text="Play">
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="PlayAlbumClick" TargetObject="{StaticResource TrackListingVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</MenuFlyoutItem>
<MenuFlyoutItem Text="Add to Playback">
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="AddAlbumClick" TargetObject="{StaticResource TrackListingVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</MenuFlyoutItem>
<MenuFlyoutItem Text="Download Album">
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="DownloadAlbumClick" TargetObject="{StaticResource TrackListingVM}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</MenuFlyoutItem>
</MenuFlyout>
</Button.Flyout>
</Button>
</StackPanel>
</Grid>
<Button
Grid.Row="1"
Content="{Binding ExpandButtonSymbol}"
Style="{StaticResource ExpandButtonStyle}">
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:CallMethodAction MethodName="ExpandCollapseButtonClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</Button>
<ListView
Grid.Row="2"
IsMultiSelectCheckBoxEnabled="False"
ItemContainerStyle="{StaticResource ListViewItemStyle}"
ItemTemplate="{StaticResource TrackListItemTemplate}"
ItemsSource="{Binding Tracks}"
SelectionMode="{Binding TracksSelectionMode, Source={StaticResource TrackListingVM}}"
Visibility="{Binding IsTrackListVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:CallMethodAction MethodName="Tracks_SelectionChanged" TargetObject="{Binding Source={StaticResource TrackListingVM}}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</ListView>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<!--<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:CallMethodAction MethodName="Album_ItemClick" TargetObject="{Binding Mode=OneWay}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>-->
</GridView>
</UserControl>
using Windows.UI.Xaml.Controls;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
namespace SonicStreamer.Controls.SectionViews
{
public sealed partial class PlaylistSectionView : UserControl
{
public readonly PlaylistViewModel PlaylistVm;
public PlaylistSectionView()
{
this.InitializeComponent();
if (ResourceLoader.Current.GetResource(ref PlaylistVm, Constants.ViewModelPlaylist) == false)
PlaylistVm = new PlaylistViewModel();
}
}
}
......@@ -12,8 +12,6 @@ namespace SonicStreamer.LastFM.Server
{
public class LastFmConnection : BaseXmlServerConnection
{
private const string LastfmApiKey = "9284f6d4293182e442db5d86a73d3de4";
#region BaseServerConnection Implementation
/// <summary>
......@@ -23,7 +21,7 @@ namespace SonicStreamer.LastFM.Server
/// <param name="param">Zu übergebene Parameter</param>
public override string GetApiMethodUri(string method, List<KeyValuePair<string, string>> param)
{
var result = string.Format("http://ws.audioscrobbler.com/2.0/?api_key={0}&method={1}", LastfmApiKey, method);
var result = string.Format("http://ws.audioscrobbler.com/2.0/?api_key={0}&method={1}", Constants.Secrets.LastfmApiKey, method);
return param.Aggregate(result, (current, item) => current + $"&{item.Key}={item.Value}");
}
......
......@@ -2,9 +2,9 @@
x:Class="SonicStreamer.Pages.FolderPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:SonicStreamer.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wrapPanel="using:Microsoft.Toolkit.Uwp.UI.Controls.WrapPanel"
DataContext="{StaticResource FolderVM}"
mc:Ignorable="d">
......@@ -117,7 +117,7 @@
</ListView.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel Orientation="Horizontal" />
<wrapPanel:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
......
This diff is collapsed.
using SonicStreamer.Common.System;
using Windows.UI.Xaml;
using SonicStreamer.Common.System;
using SonicStreamer.ViewModels;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
......@@ -23,12 +24,20 @@ namespace SonicStreamer.Pages
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Microsoft.HockeyApp.HockeyClient.Current.TrackPageView(GetType().Name);
await StartVm.LoadDataAsync();
}
private void ItemView_ItemClick(object sender, ItemClickEventArgs e)
{
Frame.Navigate(typeof(TrackListingPage), e.ClickedItem);
var task = StartVm.LoadDataAsync();
HomePivot.Items.Clear();
await task;
foreach (var startVmSection in StartVm.Sections)
{
HomePivot.Items.Add(new PivotItem
{
Header = startVmSection.Title,
ContentTemplate = (DataTemplate)Resources[startVmSection.ContentTemplateResourceKey],
DataContext = startVmSection
});
}
}
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using SonicStreamer.ViewModelItems;
using SonicStreamer.ViewModelItems.Sections;
namespace SonicStreamer.SampleData
{
......
......@@ -125,17 +125,36 @@
<Compile Include="Controls\AddToPlaylistDialog.xaml.cs">
<DependentUpon>AddToPlaylistDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ArtistInfoPanels\ArtistBiographyPanel.xaml.cs">
<DependentUpon>ArtistBiographyPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ArtistInfoPanels\ArtistGeneralInfoPanel.xaml.cs">
<DependentUpon>ArtistGeneralInfoPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ArtistInfoPanels\ArtistSocialLinksPanel.xaml.cs">
<DependentUpon>ArtistSocialLinksPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ArtistInfoPanels\ArtistTagsPanel.xaml.cs">
<DependentUpon>ArtistTagsPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ArtistInfoView.xaml.cs">
<DependentUpon>ArtistInfoView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\MobilePlaybackView.xaml.cs">
<DependentUpon>MobilePlaybackView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SectionViews\AlbumListsSectionView.xaml.cs">
<DependentUpon>AlbumListsSectionView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SectionViews\ArtistSectionView.xaml.cs">
<DependentUpon>ArtistSectionView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SectionViews\PinnedAlbumsSectionView.xaml.cs">
<DependentUpon>PinnedAlbumsSectionView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\SimilarArtistsView.xaml.cs">
<DependentUpon>SimilarArtistsView.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\WrapGrid\OrientedSize.cs" />
<Compile Include="Controls\WrapGrid\WrapPanel.cs" />
<Compile Include="LastFM\Data\LastFMAlbum.cs" />
<Compile Include="LastFM\Data\LastFMArtist.cs" />
<Compile Include="LastFM\Data\LastFMImage.cs" />
......@@ -235,6 +254,10 @@
<Compile Include="ViewModelItems\GroupedFolderCollection.cs" />
<Compile Include="ViewModelItems\ListingItem.cs" />
<Compile Include="ViewModelItems\PodcastEpisodeListingItem.cs" />
<Compile Include="ViewModelItems\Sections\AlbumListsSection.cs" />
<Compile Include="ViewModelItems\Sections\ArtistSection.cs" />
<Compile Include="ViewModelItems\Sections\BaseSection.cs" />
<Compile Include="ViewModelItems\Sections\PinnedAlbumsSection.cs" />
<Compile Include="ViewModelItems\TrackListingItem.cs" />
<Compile Include="ViewModels\AbstractListingViewModel.cs" />
<Compile Include="ViewModels\AlbumsViewModel.cs" />
......@@ -262,6 +285,7 @@
<Content Include="Assets\folder.png" />
<Content Include="Assets\LoginPage Logo.png" />
<Content Include="Assets\logo.png" />
<Content Include="Assets\Secrets.user" />
<Content Include="Assets\SocialIcons\Apple.png" />
<Content Include="Assets\SocialIcons\Bandcamp.png" />
<Content Include="Assets\SocialIcons\Facebook.png" />
......@@ -329,6 +353,22 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ArtistInfoPanels\ArtistBiographyPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ArtistInfoPanels\ArtistGeneralInfoPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ArtistInfoPanels\ArtistSocialLinksPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ArtistInfoPanels\ArtistTagsPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ArtistInfoView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -337,6 +377,23 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\SectionViews\AlbumListsSectionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\SectionViews\ArtistSectionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\SectionViews\PinnedAlbumsSectionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\SectionStyles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Controls\SimilarArtistsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
......@@ -378,6 +378,32 @@
<Setter Property="Padding" Value="12" />
</Style>
<DataTemplate x:Key="AlbumTileItemTemplate">
<Grid
Width="140"
Height="140"
HorizontalAlignment="Center">
<Grid>
<Image Source="ms-appx:///Assets/cover.png" />
<Image Canvas.ZIndex="1" Source="{Binding Cover.Uri}" />
</Grid>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock
Height="40"
Margin="15,0,15,0"
Foreground="{ThemeResource ListViewItemOverlayForegroundThemeBrush}"
Style="{StaticResource BodyTextBlockStyle}"
Text="{Binding Name}" />
<TextBlock
Margin="15,0,15,10"
Foreground="{ThemeResource ListViewItemOverlaySecondaryForegroundThemeBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Artist}"
TextWrapping="NoWrap" />
</StackPanel>
</Grid>
</DataTemplate>
<DataTemplate x:Key="TrackListItemTemplate">
<UserControl>
<Grid>
......@@ -648,4 +674,79 @@
Visibility="{Binding IsDescriptionVisible, Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="TweetItemTemplate">
<Border
Margin="12,0,12,12"
Padding="12"
Background="#FF151515"
BorderBrush="#FF565656"
BorderThickness="2"
CornerRadius="4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image
Grid.RowSpan="2"
Width="50"
Height="50"
Margin="0,0,12,0"
VerticalAlignment="Top"
Source="{Binding User.ProfileImageUrl}"
Stretch="Uniform" />
<TextBlock
Grid.Row="0"
Grid.Column="1"
FontWeight="SemiBold"
Text="{Binding User.Name}" />
<TextBlock
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Top"
FontWeight="Light"
Text="{Binding User.ScreenName}" />
<Image
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="2"
Width="24"
Height="24"
VerticalAlignment="Top"
Source="ms-appx:///Assets/SocialIcons/Twitter.png"
Stretch="Uniform" />
</Grid>
<TextBlock
Grid.Row="1"
FontWeight="SemiBold"
Text="{Binding Text}"
TextTrimming="CharacterEllipsis"
TextWrapping="WrapWholeWords" />
<StackPanel
Grid.Row="2"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock FontWeight="ExtraLight" Text="{Binding CreationDate}" />
<TextBlock
Margin="4,0,0,0"
FontWeight="ExtraLight"
Text="{Binding GeoData.DisplayCoordinates}" />
</StackPanel>
<Image Grid.Row="3" Source="{Binding Entities.Media[0].MediaUrl}" />
</Grid>
</Border>
</DataTemplate>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sectionViews="using:SonicStreamer.Controls.SectionViews">
<DataTemplate x:Key="AlbumListsSectionTemplate">
<Frame>
<sectionViews:AlbumListsSectionView />
</Frame>
</DataTemplate>
<DataTemplate x:Key="ArtistSectionTemplate">
<Frame>
<sectionViews:ArtistSectionView />
</Frame>
</DataTemplate>
<DataTemplate x:Key="PinnedAlbumsSectionTemplate">
<Frame>
<sectionViews:PinnedAlbumsSectionView />
</Frame>
</DataTemplate>
</ResourceDictionary>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="SelectedColor" Color="#FF965000" />
<!--<SolidColorBrush x:Key="SelectedPointerOverColor" Color="#CCFFA500"/>
......@@ -8,40 +6,61 @@
<SolidColorBrush x:Key="SelectedPointerOverColor" Color="#CC965000" />
<SolidColorBrush x:Key="SelectedPressedColor" Color="#E5965000" />
<Style x:Key="OrangeHeaderTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource HeaderTextBlockStyle}">
<Style
x:Key="OrangeHeaderTextBlockStyle"
BasedOn="{StaticResource HeaderTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangeSubHeaderTextBlockStyle" TargetType="TextBlock"
BasedOn="{StaticResource SubheaderTextBlockStyle}">
<Style
x:Key="OrangeSubHeaderTextBlockStyle"
BasedOn="{StaticResource SubheaderTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangeTitleTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextBlockStyle}">
<Style
x:Key="OrangeTitleTextBlockStyle"
BasedOn="{StaticResource TitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangeSubtitleTextBlockStyle" TargetType="TextBlock"
BasedOn="{StaticResource SubtitleTextBlockStyle}">
<Style
x:Key="OrangeSubtitleTextBlockStyle"
BasedOn="{StaticResource SubtitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
<Setter Property="MaxLines" Value="2" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style x:Key="OrangeBaseTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
<Style
x:Key="OrangeBaseTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangeBodyTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}">
<Style
x:Key="OrangeBodyTextBlockStyle"
BasedOn="{StaticResource BodyTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangeCaptionTextBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource CaptionTextBlockStyle}">
<Style
x:Key="OrangeCaptionTextBlockStyle"
BasedOn="{StaticResource CaptionTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangePageHeaderTextBlockStyle" TargetType="TextBlock"
BasedOn="{StaticResource HeaderTextBlockStyle}">
<Style
x:Key="OrangePageHeaderTextBlockStyle"
BasedOn="{StaticResource HeaderTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontSize" Value="25" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Foreground" Value="Orange" />
......@@ -50,7 +69,7 @@
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<!--Werden für Collections genutzt und dürfen nicht von OrangeStyles ableiten-->
<!-- Werden für Collections genutzt und dürfen nicht von OrangeStyles ableiten -->
<Style x:Key="ItemTitleTextBlockStyle" TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="MaxLines" Value="2" />
......@@ -63,12 +82,42 @@
<Setter Property="FontSize" Value="13" />
</Style>
<Style x:Key="OrangeItemTitleTextBlockStyle" TargetType="TextBlock"
BasedOn="{StaticResource ItemTitleTextBlockStyle}">
<Style
x:Key="OrangeItemTitleTextBlockStyle"
BasedOn="{StaticResource ItemTitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<Style x:Key="OrangeItemSubtitleTextBlockStyle" TargetType="TextBlock"
BasedOn="{StaticResource ItemSubtitleTextBlockStyle}">
<Style
x:Key="OrangeItemSubtitleTextBlockStyle"
BasedOn="{StaticResource ItemSubtitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Foreground" Value="Orange" />
</Style>
<!-- Section TextBlock Styles -->
<Style
x:Key="InfoSectionHeaderTextBlockStyle"
BasedOn="{StaticResource OrangeSubtitleTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Margin" Value="0,10" />
</Style>
<Style
x:Key="InfoTextBlockStyle"
BasedOn="{StaticResource OrangeBodyTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="0,10" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
<Setter Property="MaxLines" Value="2" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style
x:Key="InfoDescriptionTextBlockStyle"
BasedOn="{StaticResource InfoTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Width" Value="80" />
</Style>
</ResourceDictionary>
\ No newline at end of file
This diff is collapsed.
......@@ -221,7 +221,7 @@ namespace SonicStreamer.ViewModelItems
/// </summary>
public async Task PlayAsync()
{
PlaybackService.Current.AddToPlaybackAsync(await GetTracksAsync());
PlaybackService.Current.AddToPlaybackAsync(await GetTracksAsync());
}
/// <summary>
......
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 Windows.UI.Xaml.Controls;
using SonicStreamer.Common.System;
using SonicStreamer.Pages;
using SonicStreamer.Subsonic.Data;
using SonicStreamer.Subsonic.Server;
using SonicStreamer.ViewModels;
namespace SonicStreamer.ViewModelItems.Sections
{
public class AlbumListsSection : BaseSection
{
#region Properties
public ObservableCollection<AlbumList> AlbumLists { get; set; }
#endregion
public AlbumListsSection()
{
ContentTemplateResourceKey = "AlbumListsSectionTemplate";
AlbumLists = new ObservableCollection<AlbumList>();
}
public AlbumListsSection(string title, int index) : this()
{
Title = title;
Index = index;
}
public override async Task LoadDataAsync()
{
var albumListCreationTasks = new List<Task<AlbumList>>
{
AlbumList.CreateAsync(BaseSubsonicConnection.AlbumListType.Random, "random albums", 12, 0),
AlbumList.CreateAsync(BaseSubsonicConnection.AlbumListType.Recent, "recent albums", 12, 0),
AlbumList.CreateAsync(BaseSubsonicConnection.AlbumListType.Frequent, "frequent albums", 12, 0),
AlbumList.CreateAsync(BaseSubsonicConnection.AlbumListType.Newest, "newest albums", 12, 0)
};
var orderedAlbumList = from albumList in await Task.WhenAll(albumListCreationTasks) orderby albumList.Index select albumList;
foreach (var albumList in orderedAlbumList)
{
AlbumLists.Add(albumList);
}
}
}
public class AlbumList
{
#region Properties
public Guid Id { get; private set; }
public int Index { get; private set; }
private int _maxItemCount;
public int MaxItemCount
{
get { return _maxItemCount; }
set { Set(ref _maxItemCount, value); }
}
private string _header;
public string Header
{
get { return _header; }
set { Set(ref _header, value); }
}
public ObservableCollection<Album> Albums { get; set; }
#endregion
public AlbumList()
{
Albums = new ObservableCollection<Album>();
}
protected bool Set<T>(ref T field, T value, [CallerMemberName] string propertyName = "")
{
if (EqualityComparer<T>.Default.Equals(field, value))
{
return false;
}
field = value;
NotifyPropertyChanged(propertyName);
return true;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public static async Task<AlbumList> CreateAsync(BaseSubsonicConnection.AlbumListType type, string title,
int count, int index)
{
var result = new AlbumList
{
Id = new Guid(),
Index = index,
Header = title,
MaxItemCount = count
};
foreach (var album in await SubsonicConnector.Current.CurrentConnection.GetAlbumSectionAsync(type, count))
{
result.Albums.Add(album);
}
return result;
}
public void Album_ItemClick(object sender, ItemClickEventArgs e)
{
MainViewModel mainVm = null;
if (ResourceLoader.Current.GetResource(ref mainVm, Constants.ViewModelMain) == false)
mainVm = new MainViewModel();
mainVm.MainFrame.Navigate(typeof(TrackListingPage), e.ClickedItem);
}
}
}
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using SonicStreamer.Common.System;
using SonicStreamer.Subsonic.Data;
using Microsoft.Toolkit.Uwp.Services.Twitter;
namespace SonicStreamer.ViewModelItems.Sections
{
public class ArtistSection : BaseSection
{
#region Properties & Fields
private ArtistInfo _artistInfo;
public ArtistInfo ArtistInfo
{
get { return _artistInfo; }
set { Set(ref _artistInfo, value); }
}
public ObservableCollection<Album> Albums { get; set; }
private readonly string _artistId, _artistName;
#endregion
public ArtistSection()
{
ContentTemplateResourceKey = "ArtistSectionTemplate";
Albums = new ObservableCollection<Album>();
}
public ArtistSection(string title, string artistId, string artistName, int index) : this()
{
Index = index;
Title = title;
_artistId = artistId;
_artistName = artistName;
}
public override async Task LoadDataAsync()
{
ArtistInfo = await ArtistInfo.CreateAsync(_artistId, _artistName, new ArtistInfo.ActiveServices
{
LastFm = true,
MusicBrainz = true,
Twitter = true
});
Albums = (await SubsonicConnector.Current.CurrentConnection.GetArtistAsync(_artistId)).Albums;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace SonicStreamer.ViewModelItems.Sections
{
public abstract class BaseSection : INotifyPropertyChanged
{
#region Properties
public Guid Id { get; protected set; }
private int _index;