Merge branch 'Backdrop_music_app'
|
@ -0,0 +1,61 @@
|
|||
using Music.PCL.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Music.PCL.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Music.PCL
|
||||
{
|
||||
public class ClientViewModel : MainViewModel
|
||||
{
|
||||
|
||||
private ObservableCollection<Song> _userSongs = new ObservableCollection<Song>();
|
||||
|
||||
public ObservableCollection<Song> UserSongs
|
||||
{
|
||||
get { return _userSongs; }
|
||||
set
|
||||
{
|
||||
_userSongs = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ClientViewModel()
|
||||
{
|
||||
SongCollection = DataService.Instance.Playlist;
|
||||
CloudService.Instance.PartyStateUpdated += Instance_PartyStateUpdated;
|
||||
}
|
||||
|
||||
private void Instance_PartyStateUpdated(object sender, PartyStatus e)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
CurrentItem = SongCollection.ElementAt(e.TrackIndex);
|
||||
CurrentItemIndex = e.TrackIndex;
|
||||
Duration = e.Duration;
|
||||
Position = e.Progress;
|
||||
PlayerState = e.State;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddSong(Song song)
|
||||
{
|
||||
CloudService.Instance.RequestSongAdd(song);
|
||||
}
|
||||
|
||||
public async Task LoadUserSongs()
|
||||
{
|
||||
var tracks = await SC.API.Instance.GetTracksForUser(Keys.SC_USER_ID);
|
||||
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
UserSongs.Add(SC.API.GetSong(track));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL
|
||||
{
|
||||
public interface IDispatcher
|
||||
{
|
||||
void BeginInvoke(Action action);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL
|
||||
{
|
||||
public static class Keys
|
||||
{
|
||||
public const string SERVICE_URL = "";
|
||||
public const string SC_CLIENT_ID = "";
|
||||
public const string SC_CLIENT_SECRET = "";
|
||||
public const string SC_REDIRECT_URL = "";
|
||||
public const string SC_STARTING_PLAYLIST = "253944240";
|
||||
public const string SC_USER_ID = "3238389";
|
||||
public const string TW_CONSUMERKEY = "";
|
||||
public const string TW_CONSUMERSECRET = "";
|
||||
public const string TW_CALLBACKURI = "";
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL
|
||||
{
|
||||
public class MTObservableCollection<T> : ObservableCollection<T>
|
||||
{
|
||||
public IDispatcher Dispatcher { get; set; }
|
||||
|
||||
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (Dispatcher != null)
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
base.OnCollectionChanged(e));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
using Music.PCL.Models;
|
||||
using Music.PCL.Services;
|
||||
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;
|
||||
|
||||
namespace Music.PCL
|
||||
{
|
||||
public abstract class MainViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public IDispatcher Dispatcher;
|
||||
|
||||
private ObservableCollection<Song> _songCollection;
|
||||
|
||||
public virtual ObservableCollection<Song> SongCollection
|
||||
{
|
||||
get { return _songCollection; }
|
||||
set
|
||||
{
|
||||
_songCollection = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int _currentItemIndex;
|
||||
|
||||
public virtual int CurrentItemIndex
|
||||
{
|
||||
get { return _currentItemIndex; }
|
||||
set
|
||||
{
|
||||
_currentItemIndex = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private Song _currentItem;
|
||||
|
||||
public virtual Song CurrentItem
|
||||
{
|
||||
get { return _currentItem; }
|
||||
set
|
||||
{
|
||||
_currentItem = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int _position = 0;
|
||||
|
||||
public int Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
{
|
||||
_position = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int _duration = 0;
|
||||
|
||||
public int Duration
|
||||
{
|
||||
get { return _duration; }
|
||||
set
|
||||
{
|
||||
_duration = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private PlaybackState _playerState = PlaybackState.Other;
|
||||
|
||||
public PlaybackState PlayerState
|
||||
{
|
||||
get { return _playerState; }
|
||||
set
|
||||
{
|
||||
_playerState = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _playButtonEnabled;
|
||||
|
||||
public bool PlayButtonEnabled
|
||||
{
|
||||
get { return _playButtonEnabled; }
|
||||
set {
|
||||
_playButtonEnabled = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName] String propertyName = null)
|
||||
{
|
||||
if (Dispatcher == null)
|
||||
return;
|
||||
|
||||
Dispatcher.BeginInvoke( () =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Music.PCL.Models
|
||||
{
|
||||
public class ChatMessage
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL.Models
|
||||
{
|
||||
public class PartyJoinResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public List<Song> Songs { get; set; }
|
||||
public PartyStatus Status { get; set; }
|
||||
public List<User> Users { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL.Models
|
||||
{
|
||||
public class PartyStatus
|
||||
{
|
||||
public int TrackIndex { get; set; }
|
||||
public int Duration { get; set; }
|
||||
public int Progress { get; set; }
|
||||
public PlaybackState State { get; set; }
|
||||
}
|
||||
|
||||
public enum PlaybackState
|
||||
{
|
||||
Playing,
|
||||
Paused,
|
||||
Other
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL.Models
|
||||
{
|
||||
public class Song
|
||||
{
|
||||
public string ItemId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string StreamUrl { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string AlbumArt { get; set; }
|
||||
public string AlbumArtMedium { get; set; }
|
||||
public string AlbumArtLarge { get; set; }
|
||||
public int Duration { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ProfileImage { get; set; }
|
||||
public string TwitterId { get; set; }
|
||||
public string ConnectionId { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{54A56057-7C5A-4655-8F80-DD4816E26139}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Music.PCL</RootNamespace>
|
||||
<AssemblyName>Music.PCL</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ClientViewModel.cs" />
|
||||
<Compile Include="IDispatcher.cs" />
|
||||
<Compile Include="Keys.cs" />
|
||||
<Compile Include="MainViewModel.cs" />
|
||||
<Compile Include="Models\ChatMessage.cs" />
|
||||
<Compile Include="Models\PartyJoinResult.cs" />
|
||||
<Compile Include="Models\PartyStatus.cs" />
|
||||
<Compile Include="Models\Song.cs" />
|
||||
<Compile Include="Models\User.cs" />
|
||||
<Compile Include="MTObservableCollection.cs" />
|
||||
<Compile Include="SC\Models\Categories.cs" />
|
||||
<Compile Include="SC\Models\Comment.cs" />
|
||||
<Compile Include="SC\Models\DesignTimeClass.cs" />
|
||||
<Compile Include="SC\Models\Playlist.cs" />
|
||||
<Compile Include="SC\Models\SCUser.cs" />
|
||||
<Compile Include="SC\Models\StreamSource.cs" />
|
||||
<Compile Include="SC\Models\Track.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SC\API.cs" />
|
||||
<Compile Include="SC\StreamObjects.cs" />
|
||||
<Compile Include="Services\CloudService.cs" />
|
||||
<Compile Include="Services\DataService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Client, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Client.2.2.1\lib\portable-net45+sl50+win+wpa81+wp80\Microsoft.AspNet.SignalR.Client.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.28\lib\portable-net45+win8\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.28\lib\portable-net45+win8\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Windows.Foundation.UniversalApiContract">
|
||||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\3.0.0.0\Windows.Foundation.UniversalApiContract.winmd</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,30 @@
|
|||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Music.PCL")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Music.PCL")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,126 @@
|
|||
using Newtonsoft.Json;
|
||||
using Music.SC.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using Music.PCL.Models;
|
||||
using Music.PCL;
|
||||
|
||||
namespace Music.SC
|
||||
{
|
||||
public class API
|
||||
{
|
||||
private string BASEURL = "https://api.soundcloud.com";
|
||||
|
||||
private string clientId;
|
||||
private string clientSecret;
|
||||
private string redirectUri;
|
||||
|
||||
private static API _instance;
|
||||
|
||||
public static API Instance { get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new API(Keys.SC_CLIENT_ID, Keys.SC_CLIENT_SECRET, Keys.SC_REDIRECT_URL);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Init(string clientId, string clientSecret, string redirectUri)
|
||||
{
|
||||
_instance = new SC.API(clientId, clientSecret, redirectUri);
|
||||
}
|
||||
|
||||
public API(string clientId, string clientSecret, string redirectUri)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
this.clientSecret = clientSecret;
|
||||
this.redirectUri = redirectUri;
|
||||
}
|
||||
|
||||
private async Task<string> callAPI(string url)
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
HttpResponseMessage response = await client.GetAsync(new Uri(url));
|
||||
HttpResponseMessage v = new HttpResponseMessage();
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<Track>> GetTracksForUser(string user)
|
||||
{
|
||||
string url = $"http://api.soundcloud.com/users/{user}/tracks?client_id={clientId}";
|
||||
var responseString = await this.callAPI(url);
|
||||
|
||||
try
|
||||
{
|
||||
List<Track> tracks = JsonConvert.DeserializeObject<List<Track>>(responseString);
|
||||
return tracks;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<Track>> GetPlaylistTracks(string playlistId)
|
||||
{
|
||||
string url = $"http://api.soundcloud.com/playlists/{playlistId}?client_id={clientId}";
|
||||
var responseString = await this.callAPI(url);
|
||||
|
||||
try
|
||||
{
|
||||
List<Track> tracks = JsonConvert.DeserializeObject<Playlist>(responseString).tracks;
|
||||
return tracks;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Uri getStreamUrl(Track track)
|
||||
{
|
||||
return new Uri(track.stream_url + "?client_id=" + this.clientId);
|
||||
}
|
||||
|
||||
public string getStreamUrl(string url)
|
||||
{
|
||||
return url + "?client_id=" + this.clientId;
|
||||
}
|
||||
|
||||
public async Task<SCUser> GetUser(string userID)
|
||||
{
|
||||
var url = BASEURL + "/users/" + userID + ".json?client_id=" + this.clientId;
|
||||
var responseString = await this.callAPI(url);
|
||||
|
||||
SCUser user = JsonConvert.DeserializeObject<SCUser>(responseString);
|
||||
return user;
|
||||
}
|
||||
|
||||
public static Song GetSong(Track track)
|
||||
{
|
||||
return new Song()
|
||||
{
|
||||
ItemId = track.id.ToString(),
|
||||
Artist = track.user.username,
|
||||
Title = track.title,
|
||||
AlbumArt = track.artwork_url,
|
||||
AlbumArtMedium = track.artwork_url.Replace("large", "t300x300"),
|
||||
AlbumArtLarge = track.artwork_url.Replace("large", "t500x500"),
|
||||
Duration = track.duration / 1000,
|
||||
StreamUrl = SC.API.Instance.getStreamUrl(track).ToString()
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
public class SuggestedTracks
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links
|
||||
{
|
||||
public SuggestedTracks suggested_tracks { get; set; }
|
||||
}
|
||||
|
||||
public class Music
|
||||
{
|
||||
public string title { get; set; }
|
||||
public Links _links { get; set; }
|
||||
}
|
||||
|
||||
public class SuggestedTracks2
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links2
|
||||
{
|
||||
public SuggestedTracks2 suggested_tracks { get; set; }
|
||||
}
|
||||
|
||||
public class Audio
|
||||
{
|
||||
public string title { get; set; }
|
||||
public Links2 _links { get; set; }
|
||||
}
|
||||
|
||||
public class PopularAudio
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class PopularMusic
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links3
|
||||
{
|
||||
public PopularAudio popular_audio { get; set; }
|
||||
public PopularMusic popular_music { get; set; }
|
||||
}
|
||||
|
||||
public class Categories
|
||||
{
|
||||
public List<Music> music { get; set; }
|
||||
public List<Audio> audio { get; set; }
|
||||
public string tracking_tag { get; set; }
|
||||
public Links3 _links { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
public class Comment
|
||||
{
|
||||
public string kind { get; set; }
|
||||
public int id { get; set; }
|
||||
public string created_at { get; set; }
|
||||
public int user_id { get; set; }
|
||||
public int track_id { get; set; }
|
||||
public int? timestamp { get; set; }
|
||||
public string body { get; set; }
|
||||
public string uri { get; set; }
|
||||
public SCUser user { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
public class DesignTimeClass
|
||||
{
|
||||
private static DesignTimeClass _dataSource = new DesignTimeClass();
|
||||
|
||||
public static DesignTimeClass AppDataSource
|
||||
{
|
||||
get { return _dataSource; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DesignTimeClass()
|
||||
{
|
||||
Track track = new Track();
|
||||
|
||||
track.title = "temp";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
public class Playlist
|
||||
{
|
||||
public int duration { get; set; }
|
||||
public object release_day { get; set; }
|
||||
public string permalink_url { get; set; }
|
||||
public object genre { get; set; }
|
||||
public string permalink { get; set; }
|
||||
public object purchase_url { get; set; }
|
||||
public object release_month { get; set; }
|
||||
public object description { get; set; }
|
||||
public string uri { get; set; }
|
||||
public object label_name { get; set; }
|
||||
public string tag_list { get; set; }
|
||||
public object release_year { get; set; }
|
||||
public int track_count { get; set; }
|
||||
public int user_id { get; set; }
|
||||
public string last_modified { get; set; }
|
||||
public string license { get; set; }
|
||||
public List<Track> tracks { get; set; }
|
||||
public object playlist_type { get; set; }
|
||||
public int id { get; set; }
|
||||
public bool downloadable { get; set; }
|
||||
public string sharing { get; set; }
|
||||
public string created_at { get; set; }
|
||||
public object release { get; set; }
|
||||
public string kind { get; set; }
|
||||
public string title { get; set; }
|
||||
public object type { get; set; }
|
||||
public object purchase_title { get; set; }
|
||||
public CreatedWith created_with { get; set; }
|
||||
public object artwork_url { get; set; }
|
||||
public object ean { get; set; }
|
||||
public bool streamable { get; set; }
|
||||
public SCUser user { get; set; }
|
||||
public string embeddable_by { get; set; }
|
||||
public object label_id { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
public class SCUser
|
||||
{
|
||||
public string urn { get; set; }
|
||||
public int id { get; set; }
|
||||
public string kind { get; set; }
|
||||
public string permalink { get; set; }
|
||||
public string name { get; set; }
|
||||
public string username { get; set; }
|
||||
public string last_modified { get; set; }
|
||||
public string uri { get; set; }
|
||||
public string permalink_url { get; set; }
|
||||
public string avatar_url { get; set; }
|
||||
public string country { get; set; }
|
||||
public string first_name { get; set; }
|
||||
public string last_name { get; set; }
|
||||
public string full_name { get; set; }
|
||||
public string description { get; set; }
|
||||
public string city { get; set; }
|
||||
public object discogs_name { get; set; }
|
||||
public object myspace_name { get; set; }
|
||||
public string website { get; set; }
|
||||
public string website_title { get; set; }
|
||||
public bool online { get; set; }
|
||||
public int track_count { get; set; }
|
||||
public int playlist_count { get; set; }
|
||||
public string plan { get; set; }
|
||||
public int public_favorites_count { get; set; }
|
||||
public int followers_count { get; set; }
|
||||
public int followings_count { get; set; }
|
||||
public List<object> subscriptions { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
public class StreamSource
|
||||
{
|
||||
public String Name { get; set; }
|
||||
public String Url { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Music.SC.Models
|
||||
{
|
||||
|
||||
public class CreatedWith
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string kind { get; set; }
|
||||
public string name { get; set; }
|
||||
public string uri { get; set; }
|
||||
public string permalink_url { get; set; }
|
||||
public string external_url { get; set; }
|
||||
}
|
||||
|
||||
public class Track
|
||||
{
|
||||
public string kind { get; set; }
|
||||
public int id { get; set; }
|
||||
public string created_at { get; set; }
|
||||
public int user_id { get; set; }
|
||||
public int duration { get; set; }
|
||||
public bool commentable { get; set; }
|
||||
public string state { get; set; }
|
||||
public int original_content_size { get; set; }
|
||||
public string last_modified { get; set; }
|
||||
public string sharing { get; set; }
|
||||
public string tag_list { get; set; }
|
||||
public string permalink { get; set; }
|
||||
public bool streamable { get; set; }
|
||||
public string embeddable_by { get; set; }
|
||||
public bool downloadable { get; set; }
|
||||
public string purchase_url { get; set; }
|
||||
public object label_id { get; set; }
|
||||
public object purchase_title { get; set; }
|
||||
public string genre { get; set; }
|
||||
public string title { get; set; }
|
||||
public string description { get; set; }
|
||||
public string label_name { get; set; }
|
||||
public string release { get; set; }
|
||||
public string track_type { get; set; }
|
||||
public string key_signature { get; set; }
|
||||
public string isrc { get; set; }
|
||||
public string video_url { get; set; }
|
||||
public double? bpm { get; set; }
|
||||
public object release_year { get; set; }
|
||||
public object release_month { get; set; }
|
||||
public object release_day { get; set; }
|
||||
public string original_format { get; set; }
|
||||
public string license { get; set; }
|
||||
public string uri { get; set; }
|
||||
public SCUser user { get; set; }
|
||||
public string permalink_url { get; set; }
|
||||
public string artwork_url { get; set; }
|
||||
public string waveform_url { get; set; }
|
||||
public string stream_url { get; set; }
|
||||
public string download_url { get; set; }
|
||||
public int playback_count { get; set; }
|
||||
public int download_count { get; set; }
|
||||
public int favoritings_count { get; set; }
|
||||
public int comment_count { get; set; }
|
||||
public string attachments_uri { get; set; }
|
||||
public string policy { get; set; }
|
||||
public CreatedWith created_with { get; set; }
|
||||
|
||||
|
||||
public bool monetizable { get; set; }
|
||||
public Embedded _embedded { get; set; }
|
||||
public List<object> user_tags { get; set; }
|
||||
public string urn { get; set; }
|
||||
public LinksTemp _links { get; set; }
|
||||
|
||||
public Track() { }
|
||||
|
||||
}
|
||||
|
||||
public class Stats
|
||||
{
|
||||
public int playback_count { get; set; }
|
||||
public int likes_count { get; set; }
|
||||
public int reposts_count { get; set; }
|
||||
public int comments_count { get; set; }
|
||||
}
|
||||
|
||||
public class Embedded
|
||||
{
|
||||
public SCUser user { get; set; }
|
||||
public Stats stats { get; set; }
|
||||
}
|
||||
|
||||
public class Related
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class LinksTemp
|
||||
{
|
||||
public Related related { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using Music.SC.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.SC
|
||||
{
|
||||
public class Next
|
||||
{
|
||||
public string href { get; set; }
|
||||
}
|
||||
|
||||
public class Links2
|
||||
{
|
||||
public Next next { get; set; }
|
||||
}
|
||||
|
||||
public class Waveform
|
||||
{
|
||||
public int width { get; set; }
|
||||
public int height { get; set; }
|
||||
public List<int> samples { get; set; }
|
||||
}
|
||||
|
||||
public class Stream
|
||||
{
|
||||
public List<Track> collection { get; set; }
|
||||
public string tracking_tag { get; set; }
|
||||
public Links2 _links { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
using Microsoft.AspNet.SignalR.Client;
|
||||
using Music.PCL.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Music.PCL
|
||||
{
|
||||
public class CloudService
|
||||
{
|
||||
|
||||
private HubConnection _connection { get; set; }
|
||||
private IHubProxy _proxy { get; set; }
|
||||
|
||||
private static CloudService _instance;
|
||||
|
||||
public User User { get; private set; }
|
||||
|
||||
public ServiceState State { get; private set; } = ServiceState.NotInitialized;
|
||||
public ParticipationType ParticipationType { get; private set; } = ParticipationType.None;
|
||||
|
||||
public static CloudService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new CloudService();
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
// host
|
||||
public event EventHandler<Song> SongRequested;
|
||||
|
||||
// both
|
||||
public event EventHandler<string> SomeoneDisconnected;
|
||||
public event EventHandler<User> SomeoneConnected;
|
||||
|
||||
// client
|
||||
public event EventHandler<SongAddedEventArgs> SongAdded;
|
||||
public event EventHandler PartyEnded;
|
||||
public event EventHandler<PartyStatus> PartyStateUpdated;
|
||||
|
||||
public event EventHandler Connected;
|
||||
|
||||
private CloudService()
|
||||
{
|
||||
_connection = new HubConnection(Keys.SERVICE_URL);
|
||||
_connection.StateChanged += Conn_StateChanged;
|
||||
_connection.Error += Conn_Error; ;
|
||||
|
||||
_proxy = _connection.CreateHubProxy("PartyHub");
|
||||
|
||||
// Party owner
|
||||
_proxy.On<Song>("UserRequestedSong", (song) => {
|
||||
SongRequested?.Invoke(this, song);
|
||||
});
|
||||
|
||||
// both
|
||||
_proxy.On<string>("UserDisconnected", (userId) => { SomeoneDisconnected?.Invoke(this, userId); });
|
||||
_proxy.On<User>("UserAddedToParty", (user) => { SomeoneConnected?.Invoke(this, user); });
|
||||
|
||||
// party user
|
||||
_proxy.On("PartyOver", () => { PartyEnded?.Invoke(this, null); });
|
||||
_proxy.On<PartyStatus>("StateUpdate", (status) => { PartyStateUpdated?.Invoke(this, status); });
|
||||
_proxy.On<Song, int>("SongUpdate", (song, index) =>
|
||||
{
|
||||
SongAdded?.Invoke(this, new SongAddedEventArgs()
|
||||
{
|
||||
Song = song,
|
||||
Index = index
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public bool Init(User currentUser)
|
||||
{
|
||||
if (string.IsNullOrEmpty(currentUser.TwitterId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
User = currentUser;
|
||||
_connection.Headers.Add("twitterId", currentUser.TwitterId);
|
||||
|
||||
State = ServiceState.Disconnected;
|
||||
|
||||
_connection.Start();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Conn_Error(Exception obj)
|
||||
{
|
||||
Debug.WriteLine(obj.Message);
|
||||
if (State == ServiceState.NotInitialized)
|
||||
return;
|
||||
|
||||
State = ServiceState.Disconnected;
|
||||
_connection.Start();
|
||||
}
|
||||
|
||||
private void Conn_StateChanged(StateChange obj)
|
||||
{
|
||||
Debug.WriteLine(obj.NewState);
|
||||
if (obj.NewState == ConnectionState.Connected)
|
||||
{
|
||||
Connected?.Invoke(this, null);
|
||||
State = ServiceState.Connected;
|
||||
}
|
||||
else
|
||||
{
|
||||
State = ServiceState.Disconnected;
|
||||
if (obj.NewState == ConnectionState.Disconnected)
|
||||
{
|
||||
_connection.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// host
|
||||
public Task<string> StartParty(List<Song> songs, PartyStatus status)
|
||||
{
|
||||
if (State == ServiceState.NotInitialized)
|
||||
return null;
|
||||
|
||||
ParticipationType = ParticipationType.Host;
|
||||
return _proxy.Invoke<string>("StartParty", User, songs, status);
|
||||
}
|
||||
|
||||
public void SendStatusUpdate(PartyStatus status)
|
||||
{
|
||||
if (State == ServiceState.NotInitialized ||
|
||||
ParticipationType != ParticipationType.Host)
|
||||
return;
|
||||
|
||||
_proxy.Invoke("StatusUpdate", status);
|
||||
}
|
||||
|
||||
public void SendSongAdded(Song song, int index)
|
||||
{
|
||||
if (State == ServiceState.NotInitialized ||
|
||||
ParticipationType != ParticipationType.Host)
|
||||
return;
|
||||
|
||||
_proxy.Invoke("SongAdded", song, index);
|
||||
}
|
||||
|
||||
|
||||
//client
|
||||
public Task<PartyJoinResult> JoinParty(string code)
|
||||
{
|
||||
if (State == ServiceState.NotInitialized)
|
||||
return null;
|
||||
|
||||
ParticipationType = ParticipationType.Participant;
|
||||
return _proxy.Invoke<PartyJoinResult>("JoinParty", User, code);
|
||||
}
|
||||
|
||||
public void RequestSongAdd(Song song)
|
||||
{
|
||||
if (State == ServiceState.NotInitialized ||
|
||||
ParticipationType != ParticipationType.Participant)
|
||||
return;
|
||||
|
||||
_proxy.Invoke<bool>("AddSong", song);
|
||||
}
|
||||
}
|
||||
|
||||
public class SongAddedEventArgs
|
||||
{
|
||||
public Song Song { get; set; }
|
||||
public int Index{ get; set; }
|
||||
}
|
||||
|
||||
public enum ParticipationType
|
||||
{
|
||||
None,
|
||||
Host,
|
||||
Participant
|
||||
}
|
||||
|
||||
public enum ServiceState
|
||||
{
|
||||
Connected,
|
||||
Disconnected,
|
||||
NotInitialized
|
||||
}
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Music.PCL.Models;
|
||||
using System.Diagnostics;
|
||||
using System.ServiceModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Music.PCL.Services
|
||||
{
|
||||
public class DataService : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private IDispatcher _dispatcher;
|
||||
|
||||
public IDispatcher Dispatcher {
|
||||
get
|
||||
{
|
||||
return _dispatcher;
|
||||
}
|
||||
set
|
||||
{
|
||||
_dispatcher = value;
|
||||
Users.Dispatcher = value;
|
||||
Playlist.Dispatcher = value;
|
||||
}
|
||||
}
|
||||
|
||||
private static DataService _instance;
|
||||
|
||||
public static DataService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new DataService();
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public MTObservableCollection<User> Users { get; set; } = new MTObservableCollection<User>();
|
||||
|
||||
public MTObservableCollection<Song> Playlist { get; set; } = new MTObservableCollection<Song>();
|
||||
|
||||
private string _partyCode;
|
||||
|
||||
public string PartyCode
|
||||
{
|
||||
get { return _partyCode; }
|
||||
set
|
||||
{
|
||||
_partyCode = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private DataService()
|
||||
{
|
||||
CloudService.Instance.PartyEnded += Instance_PartyEnded;
|
||||
CloudService.Instance.SomeoneConnected += Instance_SomeoneConnected;
|
||||
CloudService.Instance.SomeoneDisconnected += Instance_SomeoneDisconnected;
|
||||
CloudService.Instance.SongAdded += Instance_SongAdded;
|
||||
CloudService.Instance.SongRequested += Instance_SongRequested;
|
||||
|
||||
if (CloudService.Instance.User != null)
|
||||
Users.Add(CloudService.Instance.User);
|
||||
}
|
||||
|
||||
public async Task InitDataServiceAsHost(bool reset = false)
|
||||
{
|
||||
if (Playlist.Count == 0 || reset)
|
||||
{
|
||||
var tracks = await SC.API.Instance.GetPlaylistTracks(Keys.SC_STARTING_PLAYLIST); // ADX playlist
|
||||
|
||||
Playlist.Clear();
|
||||
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
Playlist.Add(SC.API.GetSong(track));
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(PartyCode) || reset)
|
||||
{
|
||||
PartyCode = await CloudService.Instance.StartParty(Playlist.ToList(), null);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> InitDataServiceAsClient(string code)
|
||||
{
|
||||
if (CloudService.Instance.State != ServiceState.Connected)
|
||||
return false;
|
||||
|
||||
var result = await CloudService.Instance.JoinParty(code);
|
||||
|
||||
if (!result.Success) return false;
|
||||
|
||||
foreach (var song in result.Songs)
|
||||
{
|
||||
Playlist.Add(song);
|
||||
}
|
||||
|
||||
foreach (var user in result.Users)
|
||||
{
|
||||
Users.Add(user);
|
||||
}
|
||||
|
||||
PartyCode = code;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Instance_SongRequested(object sender, Song e)
|
||||
{
|
||||
if (!Playlist.Contains(e))
|
||||
{
|
||||
Playlist.Add(e);
|
||||
CloudService.Instance.SendSongAdded(e, Playlist.IndexOf(e));
|
||||
}
|
||||
|
||||
Debug.WriteLine("Song Requested " + e.Title);
|
||||
}
|
||||
|
||||
private void Instance_SongAdded(object sender, SongAddedEventArgs e)
|
||||
{
|
||||
Playlist.Insert(e.Index, e.Song);
|
||||
Debug.WriteLine("Song Added " + e.Song.Title);
|
||||
}
|
||||
|
||||
private void Instance_SomeoneDisconnected(object sender, string e)
|
||||
{
|
||||
var user = Users.FirstOrDefault(u => u.TwitterId == e);
|
||||
if (user != null)
|
||||
Users.Remove(user);
|
||||
|
||||
Debug.WriteLine("Someone disconnected " + e);
|
||||
}
|
||||
|
||||
private void Instance_SomeoneConnected(object sender, User user)
|
||||
{
|
||||
if (!Users.Contains(user))
|
||||
Users.Add(user);
|
||||
}
|
||||
|
||||
private void Instance_PartyEnded(object sender, EventArgs e)
|
||||
{
|
||||
Debug.WriteLine("Party ended");
|
||||
}
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName] String propertyName = null)
|
||||
{
|
||||
if (Dispatcher == null)
|
||||
return;
|
||||
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.28.0" newVersion="2.2.28.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.AspNet.SignalR.Client" version="2.2.1" targetFramework="portable45-net45+win8" />
|
||||
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="portable45-net45+win8" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="portable45-net45+win8" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8" />
|
||||
</packages>
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectTypeGuids>{06FA79CB-D6CD-4721-BB4B-1BD202089C55};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{468A2146-57EF-4362-8A79-71057FD60129}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Music.Shared.tvOS</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>MusicSharedtvOS</AssemblyName>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Client, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Client.2.2.1\lib\portable-net45+sl50+win+wpa81+wp80\Microsoft.AspNet.SignalR.Client.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.TVOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Music.PCL\ClientViewModel.cs">
|
||||
<Link>ClientViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\IDispatcher.cs">
|
||||
<Link>IDispatcher.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Keys.cs">
|
||||
<Link>Keys.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\MainViewModel.cs">
|
||||
<Link>MainViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Models\ChatMessage.cs">
|
||||
<Link>Models\ChatMessage.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Models\PartyJoinResult.cs">
|
||||
<Link>Models\PartyJoinResult.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Models\PartyStatus.cs">
|
||||
<Link>Models\PartyStatus.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Models\Song.cs">
|
||||
<Link>Models\Song.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Models\User.cs">
|
||||
<Link>Models\User.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\MTObservableCollection.cs">
|
||||
<Link>MTObservableCollection.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\API.cs">
|
||||
<Link>SC\API.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\Categories.cs">
|
||||
<Link>SC\Models\Categories.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\Comment.cs">
|
||||
<Link>SC\Models\Comment.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\DesignTimeClass.cs">
|
||||
<Link>SC\Models\DesignTimeClass.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\Playlist.cs">
|
||||
<Link>SC\Models\Playlist.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\SCUser.cs">
|
||||
<Link>SC\Models\SCUser.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\StreamSource.cs">
|
||||
<Link>SC\Models\StreamSource.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\Models\Track.cs">
|
||||
<Link>SC\Models\Track.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\SC\StreamObjects.cs">
|
||||
<Link>SC\StreamObjects.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Services\CloudService.cs">
|
||||
<Link>Services\CloudService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Music.PCL\Services\DataService.cs">
|
||||
<Link>Services\DataService.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\TVOS\Xamarin.TVOS.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Music.Shared.tvOS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Music.Shared.tvOS")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("468a2146-57ef-4362-8a79-71057fd60129")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.AspNet.SignalR.Client" version="2.2.1" targetFramework="xamarintvos10" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="xamarintvos10" />
|
||||
</packages>
|
|
@ -0,0 +1,894 @@
|
|||
<Application
|
||||
x:Class="Music.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Music"
|
||||
RequestedTheme="Dark">
|
||||
|
||||
<Application.Resources>
|
||||
|
||||
<Style TargetType="Button" x:Key="RootMainButtons">
|
||||
<Setter Property="Background" Value="#17192B" />
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundTransparentBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="9px" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
<Storyboard>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="LightGray" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="FocusStates">
|
||||
<VisualState x:Name="Focused">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Unfocused">
|
||||
<Storyboard>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ContentPresenter x:Name="ContentPresenter"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Foreground="White"
|
||||
/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Default style for Windows.UI.Xaml.Controls.Button -->
|
||||
<Style TargetType="Button" x:Key="TransportControllButton">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundTransparentBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontFamily" Value="Segoe MDL2 Assets" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="9px" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
<Storyboard>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentTransform"
|
||||
Storyboard.TargetProperty="ScaleX">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="1.1" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentTransform"
|
||||
Storyboard.TargetProperty="ScaleY">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="1.1" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
|
||||
</ObjectAnimationUsingKeyFrames>-->
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentTransform"
|
||||
Storyboard.TargetProperty="ScaleX">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="0.9" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentTransform"
|
||||
Storyboard.TargetProperty="ScaleY">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="0.9" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="FocusStates">
|
||||
<VisualState x:Name="Focused">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Black" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Unfocused">
|
||||
<Storyboard>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ContentPresenter x:Name="ContentPresenter"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Foreground="White"
|
||||
>
|
||||
<ContentPresenter.RenderTransform>
|
||||
<CompositeTransform x:Name="ContentTransform" CenterX="32" CenterY="32" ScaleX="1" ScaleY="1"></CompositeTransform>
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- Default style for Windows.UI.Xaml.Controls.Slider -->
|
||||
<Style TargetType="Slider" x:Key="ProgressSliderXbox">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="ManipulationMode" Value="None" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Slider">
|
||||
<Grid Margin="{TemplateBinding Padding}">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Thumb" x:Key="SliderThumbStyle">
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
<Setter Property="BorderBrush" Value="Black"></Setter>
|
||||
<Setter Property="Background" Value="Black" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalDecreaseRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalDecreaseRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LeftTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RightTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeAltLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeAltLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ContentPresenter x:Name="HeaderContentPresenter"
|
||||
x:DeferLoadStrategy="Lazy"
|
||||
Visibility="Collapsed"
|
||||
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
|
||||
Margin="{ThemeResource SliderHeaderThemeMargin}"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
FontWeight="{ThemeResource SliderHeaderThemeFontWeight}"
|
||||
TextWrapping="Wrap" />
|
||||
<Grid x:Name="SliderContainer" Background="Transparent" Grid.Row="1" Control.IsTemplateFocusTarget="True">
|
||||
<Grid x:Name="HorizontalTemplate" MinHeight="44">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="18" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="18" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle x:Name="HorizontalTrackRect"
|
||||
Fill="{TemplateBinding Background}"
|
||||
Height="2"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3" />
|
||||
<Rectangle x:Name="HorizontalDecreaseRect"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Row="1" />
|
||||
<TickBar x:Name="TopTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Height="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,0,4"
|
||||
Grid.ColumnSpan="3" />
|
||||
<TickBar x:Name="HorizontalInlineTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlBackgroundAltHighBrush}"
|
||||
Height="2"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3" />
|
||||
<TickBar x:Name="BottomTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Height="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,4,0,0"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3" />
|
||||
<Thumb x:Name="HorizontalThumb"
|
||||
Style="{StaticResource SliderThumbStyle}"
|
||||
DataContext="{TemplateBinding Value}"
|
||||
Height="10"
|
||||
Width="10"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Grid.Column="1"
|
||||
AutomationProperties.AccessibilityView="Raw" />
|
||||
</Grid>
|
||||
<Grid x:Name="VerticalTemplate" MinWidth="44" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="18" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="18" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle x:Name="VerticalTrackRect"
|
||||
Fill="{TemplateBinding Background}"
|
||||
Width="{ThemeResource SliderTrackThemeHeight}"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="3" />
|
||||
<Rectangle x:Name="VerticalDecreaseRect"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2" />
|
||||
<TickBar x:Name="LeftTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Width="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,4,0"
|
||||
Grid.RowSpan="3" />
|
||||
<TickBar x:Name="VerticalInlineTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlBackgroundAltHighBrush}"
|
||||
Width="{ThemeResource SliderTrackThemeHeight}"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="3" />
|
||||
<TickBar x:Name="RightTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Width="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="4,0,0,0"
|
||||
Grid.Column="2"
|
||||
Grid.RowSpan="3" />
|
||||
<Thumb x:Name="VerticalThumb"
|
||||
Background="{ThemeResource SystemControlForegroundAccentBrush}"
|
||||
Style="{StaticResource SliderThumbStyle}"
|
||||
DataContext="{TemplateBinding Value}"
|
||||
Width="24"
|
||||
Height="8"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
AutomationProperties.AccessibilityView="Raw"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Slider" x:Key="ProgressSlider">
|
||||
<Setter Property="Background" Value="#AFFFFFFF" />
|
||||
<Setter Property="BorderThickness" Value="2" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="ManipulationMode" Value="None" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Slider">
|
||||
<Grid Margin="{TemplateBinding Padding}">
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Thumb" x:Key="SliderThumbStyle">
|
||||
<Setter Property="BorderThickness" Value="3" />
|
||||
<Setter Property="BorderBrush" Value="White"></Setter>
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Thumb">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalDecreaseRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalDecreaseRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledChromeDisabledHighBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LeftTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RightTickBar"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseMediumLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
|
||||
Storyboard.TargetProperty="Fill">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeAltLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalThumb"
|
||||
Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightChromeAltLowBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ContentPresenter x:Name="HeaderContentPresenter"
|
||||
x:DeferLoadStrategy="Lazy"
|
||||
Visibility="Collapsed"
|
||||
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
|
||||
Margin="{ThemeResource SliderHeaderThemeMargin}"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
FontWeight="{ThemeResource SliderHeaderThemeFontWeight}"
|
||||
TextWrapping="Wrap" />
|
||||
<Grid x:Name="SliderContainer" Background="Transparent" Grid.Row="1" Control.IsTemplateFocusTarget="True">
|
||||
<Grid x:Name="HorizontalTemplate" MinHeight="44">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="18" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="18" />
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle x:Name="HorizontalTrackRect"
|
||||
Fill="{TemplateBinding Background}"
|
||||
Height="2"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3" />
|
||||
<Rectangle x:Name="HorizontalDecreaseRect"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Row="1" />
|
||||
<TickBar x:Name="TopTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Height="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,0,4"
|
||||
Grid.ColumnSpan="3" />
|
||||
<TickBar x:Name="HorizontalInlineTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlBackgroundAltHighBrush}"
|
||||
Height="2"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3" />
|
||||
<TickBar x:Name="BottomTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Height="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,4,0,0"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3" />
|
||||
<Thumb x:Name="HorizontalThumb"
|
||||
Style="{StaticResource SliderThumbStyle}"
|
||||
DataContext="{TemplateBinding Value}"
|
||||
Height="12"
|
||||
Width="12"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Grid.Column="1"
|
||||
AutomationProperties.AccessibilityView="Raw" />
|
||||
</Grid>
|
||||
<Grid x:Name="VerticalTemplate" MinWidth="44" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="18" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="18" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle x:Name="VerticalTrackRect"
|
||||
Fill="{TemplateBinding Background}"
|
||||
Width="{ThemeResource SliderTrackThemeHeight}"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="3" />
|
||||
<Rectangle x:Name="VerticalDecreaseRect"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2" />
|
||||
<TickBar x:Name="LeftTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Width="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,4,0"
|
||||
Grid.RowSpan="3" />
|
||||
<TickBar x:Name="VerticalInlineTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlBackgroundAltHighBrush}"
|
||||
Width="{ThemeResource SliderTrackThemeHeight}"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="3" />
|
||||
<TickBar x:Name="RightTickBar"
|
||||
Visibility="Collapsed"
|
||||
Fill="{ThemeResource SystemControlForegroundBaseMediumLowBrush}"
|
||||
Width="{ThemeResource SliderOutsideTickBarThemeHeight}"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="4,0,0,0"
|
||||
Grid.Column="2"
|
||||
Grid.RowSpan="3" />
|
||||
<Thumb x:Name="VerticalThumb"
|
||||
Background="{ThemeResource SystemControlForegroundAccentBrush}"
|
||||
Style="{StaticResource SliderThumbStyle}"
|
||||
DataContext="{TemplateBinding Value}"
|
||||
Width="24"
|
||||
Height="8"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
AutomationProperties.AccessibilityView="Raw"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="RadioButton" x:Key="LikedRadioButton">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
||||
<Setter Property="Padding" Value="8,6,0,0" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<Grid Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Height">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="22" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Height">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="18" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="0.6" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="CheckStates">
|
||||
<VisualState x:Name="Checked">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Source">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Assets/liked.png" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Unchecked" />
|
||||
<VisualState x:Name="Indeterminate" />
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image x:Name="ImageContainer" Height="20" VerticalAlignment="Center" HorizontalAlignment="Center" Source="Assets/like.png"></Image>
|
||||
|
||||
<Ellipse x:Name="OuterEllipse" Visibility="Collapsed"
|
||||
Width="20"
|
||||
Height="20"
|
||||
UseLayoutRounding="False"
|
||||
Stroke="{ThemeResource SystemControlForegroundBaseMediumHighBrush}"
|
||||
StrokeThickness="{ThemeResource RadioButtonBorderThemeThickness}" />
|
||||
<Ellipse x:Name="CheckOuterEllipse" Visibility="Collapsed"
|
||||
Width="20"
|
||||
Height="20"
|
||||
UseLayoutRounding="False"
|
||||
Stroke="{ThemeResource SystemControlHighlightAltAccentBrush}"
|
||||
Fill="{ThemeResource SystemControlHighlightTransparentBrush}"
|
||||
Opacity="0"
|
||||
StrokeThickness="{ThemeResource RadioButtonBorderThemeThickness}" />
|
||||
<Ellipse x:Name="CheckGlyph" Visibility="Collapsed"
|
||||
Width="10"
|
||||
Height="10"
|
||||
UseLayoutRounding="False"
|
||||
Opacity="0"
|
||||
Fill="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}" />
|
||||
</Grid>
|
||||
<ContentPresenter x:Name="ContentPresenter" Visibility="Collapsed"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Grid.Column="1"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Default style for Windows.UI.Xaml.Controls.RadioButton -->
|
||||
<Style TargetType="RadioButton" x:Key="DislikedRadioButton">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
|
||||
<Setter Property="Padding" Value="8,6,0,0" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<Grid Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Height">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="22" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Height">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="18" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="0.6" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="CheckStates">
|
||||
<VisualState x:Name="Checked">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ImageContainer"
|
||||
Storyboard.TargetProperty="Source">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Assets/disliked.png" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Unchecked" />
|
||||
<VisualState x:Name="Indeterminate" />
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image x:Name="ImageContainer" Height="20" VerticalAlignment="Center" HorizontalAlignment="Center" Source="Assets/dislike.png"></Image>
|
||||
|
||||
<Ellipse x:Name="OuterEllipse" Visibility="Collapsed"
|
||||
Width="20"
|
||||
Height="20"
|
||||
UseLayoutRounding="False"
|
||||
Stroke="{ThemeResource SystemControlForegroundBaseMediumHighBrush}"
|
||||
StrokeThickness="{ThemeResource RadioButtonBorderThemeThickness}" />
|
||||
<Ellipse x:Name="CheckOuterEllipse" Visibility="Collapsed"
|
||||
Width="20"
|
||||
Height="20"
|
||||
UseLayoutRounding="False"
|
||||
Stroke="{ThemeResource SystemControlHighlightAltAccentBrush}"
|
||||
Fill="{ThemeResource SystemControlHighlightTransparentBrush}"
|
||||
Opacity="0"
|
||||
StrokeThickness="{ThemeResource RadioButtonBorderThemeThickness}" />
|
||||
<Ellipse x:Name="CheckGlyph" Visibility="Collapsed"
|
||||
Width="10"
|
||||
Height="10"
|
||||
UseLayoutRounding="False"
|
||||
Opacity="0"
|
||||
Fill="{ThemeResource SystemControlHighlightAltBaseMediumHighBrush}" />
|
||||
</Grid>
|
||||
<ContentPresenter x:Name="ContentPresenter" Visibility="Collapsed"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Grid.Column="1"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
</Application.Resources>
|
||||
|
||||
</Application>
|
|
@ -0,0 +1,257 @@
|
|||
using Microsoft.AspNet.SignalR.Client;
|
||||
using Microsoft.WindowsAzure.MobileServices;
|
||||
using Music.PCL.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.Foundation.Metadata;
|
||||
using Windows.Storage;
|
||||
using Windows.System;
|
||||
using Windows.UI;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Music
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
{
|
||||
public static PCL.Models.User Me;
|
||||
bool _isInBackgroundMode = false;
|
||||
static string deviceFamily;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
EnteredBackground += App_EnteredBackground;
|
||||
LeavingBackground += App_LeavingBackground;
|
||||
|
||||
App.Current.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested;
|
||||
|
||||
MemoryManager.AppMemoryUsageLimitChanging += MemoryManager_AppMemoryUsageLimitChanging;
|
||||
MemoryManager.AppMemoryUsageIncreased += MemoryManager_AppMemoryUsageIncreased;
|
||||
}
|
||||
|
||||
public static bool IsXbox()
|
||||
{
|
||||
|
||||
if (deviceFamily == null)
|
||||
deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
|
||||
|
||||
return deviceFamily == "Windows.Xbox";
|
||||
}
|
||||
|
||||
private void MemoryManager_AppMemoryUsageIncreased(object sender, object e)
|
||||
{
|
||||
var level = MemoryManager.AppMemoryUsageLevel;
|
||||
|
||||
if (level == AppMemoryUsageLevel.OverLimit || level == AppMemoryUsageLevel.High)
|
||||
{
|
||||
ReduceMemoryUsage(MemoryManager.AppMemoryUsageLimit);
|
||||
}
|
||||
|
||||
Debug.WriteLine("Memory Usage Increader: " + MemoryManager.AppMemoryUsage.ToString());
|
||||
}
|
||||
|
||||
private void MemoryManager_AppMemoryUsageLimitChanging(object sender, AppMemoryUsageLimitChangingEventArgs e)
|
||||
{
|
||||
if (MemoryManager.AppMemoryUsage >= e.NewLimit)
|
||||
{
|
||||
ReduceMemoryUsage(e.NewLimit);
|
||||
}
|
||||
Debug.WriteLine("Memory usage limit changing from "
|
||||
+ (e.OldLimit / 1024 / 1024) + "M to "
|
||||
+ (e.NewLimit / 1024 / 1024) + "K");
|
||||
}
|
||||
|
||||
private void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e)
|
||||
{
|
||||
_isInBackgroundMode = false;
|
||||
|
||||
// Restore view content if it was previously unloaded.
|
||||
if (Window.Current != null && Window.Current.Content == null)
|
||||
{
|
||||
CreateRootFrame(ApplicationExecutionState.Running, string.Empty);
|
||||
}
|
||||
|
||||
Debug.WriteLine("Leaving Background");
|
||||
}
|
||||
|
||||
private void App_EnteredBackground(object sender, EnteredBackgroundEventArgs e)
|
||||
{
|
||||
Debug.WriteLine("Entered Background");
|
||||
var deferral = e.GetDeferral();
|
||||
try
|
||||
{
|
||||
_isInBackgroundMode = true;
|
||||
#if DEBUG
|
||||
//If we are in debug mode free memory here because the memory limits are turned off
|
||||
//In release builds defer the actual reduction of memory to the limit changing event so we don't
|
||||
//unnecessarily throw away the UI
|
||||
ReduceMemoryUsage(0);
|
||||
#endif
|
||||
}
|
||||
finally
|
||||
{
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
public void ReduceMemoryUsage(ulong limit)
|
||||
{
|
||||
if (_isInBackgroundMode && Window.Current != null && Window.Current.Content != null)
|
||||
{
|
||||
ApplicationData.Current.LocalSettings.Values["navState"] = (Window.Current.Content as Frame).GetNavigationState();
|
||||
|
||||
var frame = Window.Current.Content as Frame;
|
||||
if (frame != null)
|
||||
{
|
||||
frame.NavigationFailed -= OnNavigationFailed;
|
||||
frame.Navigated -= RootFrame_Navigated;
|
||||
|
||||
Window.Current.Content = null;
|
||||
}
|
||||
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
if (App.IsXbox())
|
||||
{
|
||||
ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
|
||||
}
|
||||
|
||||
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
|
||||
{
|
||||
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
|
||||
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
||||
if (titleBar != null)
|
||||
{
|
||||
titleBar.ButtonForegroundColor = Colors.White;
|
||||
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||
titleBar.BackgroundColor = Color.FromArgb(255, 13, 15, 30);
|
||||
}
|
||||
}
|
||||
|
||||
CreateRootFrame(e.PreviousExecutionState, e.Arguments, e.PrelaunchActivated);
|
||||
}
|
||||
|
||||
void CreateRootFrame(ApplicationExecutionState previousExecutionState, string arguments, bool prelaunchActivated = false)
|
||||
{
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == null)
|
||||
{
|
||||
// Create a Frame to act as the navigation context and navigate to the first page
|
||||
rootFrame = new Frame();
|
||||
|
||||
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||
rootFrame.Navigated += RootFrame_Navigated;
|
||||
|
||||
if (previousExecutionState == ApplicationExecutionState.Running)
|
||||
{
|
||||
var state = ApplicationData.Current.LocalSettings.Values["navState"];
|
||||
|
||||
if (state != null)
|
||||
{
|
||||
rootFrame.SetNavigationState(state as string);
|
||||
}
|
||||
}
|
||||
|
||||
// Place the frame in the current Window
|
||||
Window.Current.Content = rootFrame;
|
||||
|
||||
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
|
||||
|
||||
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
|
||||
rootFrame.CanGoBack ?
|
||||
AppViewBackButtonVisibility.Visible :
|
||||
AppViewBackButtonVisibility.Collapsed;
|
||||
}
|
||||
|
||||
if (prelaunchActivated == false)
|
||||
{
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
rootFrame.Navigate(typeof(RootPage), arguments);
|
||||
}
|
||||
// Ensure the current window is active
|
||||
Window.Current.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBackRequested(object sender, BackRequestedEventArgs e)
|
||||
{
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
if (rootFrame != null && rootFrame.CanGoBack)
|
||||
{
|
||||
e.Handled = true;
|
||||
rootFrame.GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
private void RootFrame_Navigated(object sender, NavigationEventArgs e)
|
||||
{
|
||||
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
|
||||
((Frame)sender).CanGoBack ?
|
||||
AppViewBackButtonVisibility.Visible :
|
||||
AppViewBackButtonVisibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when Navigation to a certain page fails
|
||||
/// </summary>
|
||||
/// <param name="sender">The Frame which failed navigation</param>
|
||||
/// <param name="e">Details about the navigation failure</param>
|
||||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when application execution is being suspended. Application state is saved
|
||||
/// without knowing whether the application will be terminated or resumed with the contents
|
||||
/// of memory still intact.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//TODO: Save application state and stop any background activity
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 490 B |
После Ширина: | Высота: | Размер: 676 B |
После Ширина: | Высота: | Размер: 754 B |
После Ширина: | Высота: | Размер: 965 B |
После Ширина: | Высота: | Размер: 1.9 KiB |
После Ширина: | Высота: | Размер: 3.5 KiB |
После Ширина: | Высота: | Размер: 4.3 KiB |
После Ширина: | Высота: | Размер: 5.6 KiB |
После Ширина: | Высота: | Размер: 8.9 KiB |
После Ширина: | Высота: | Размер: 23 KiB |
После Ширина: | Высота: | Размер: 1.5 KiB |
После Ширина: | Высота: | Размер: 1.8 KiB |
После Ширина: | Высота: | Размер: 2.3 KiB |
После Ширина: | Высота: | Размер: 3.1 KiB |
После Ширина: | Высота: | Размер: 6.8 KiB |
После Ширина: | Высота: | Размер: 3.1 KiB |
После Ширина: | Высота: | Размер: 4.0 KiB |
После Ширина: | Высота: | Размер: 4.9 KiB |
После Ширина: | Высота: | Размер: 6.9 KiB |
После Ширина: | Высота: | Размер: 18 KiB |
После Ширина: | Высота: | Размер: 817 B |
После Ширина: | Высота: | Размер: 959 B |
После Ширина: | Высота: | Размер: 1.1 KiB |
После Ширина: | Высота: | Размер: 1.5 KiB |
После Ширина: | Высота: | Размер: 2.9 KiB |
После Ширина: | Высота: | Размер: 393 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-16_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 394 B |
После Ширина: | Высота: | Размер: 465 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-20_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 460 B |
После Ширина: | Высота: | Размер: 522 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 522 B |
После Ширина: | Высота: | Размер: 5.4 KiB |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-256_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 5.4 KiB |
После Ширина: | Высота: | Размер: 676 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-30_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 676 B |
После Ширина: | Высота: | Размер: 676 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-32_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 673 B |
После Ширина: | Высота: | Размер: 754 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-36_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 754 B |
После Ширина: | Высота: | Размер: 824 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-40_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 824 B |
После Ширина: | Высота: | Размер: 953 B |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-48_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 965 B |
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-60_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
После Ширина: | Высота: | Размер: 1.2 KiB |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-64_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.3 KiB |
После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-72_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.3 KiB |
После Ширина: | Высота: | Размер: 1.6 KiB |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-80_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.6 KiB |
После Ширина: | Высота: | Размер: 1.8 KiB |
Двоичные данные
apps/music/Music.UWP/Assets/Square44x44Logo.targetsize-96_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.9 KiB |
После Ширина: | Высота: | Размер: 917 B |
После Ширина: | Высота: | Размер: 1.1 KiB |
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 1.8 KiB |
После Ширина: | Высота: | Размер: 3.8 KiB |
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 764 B |
После Ширина: | Высота: | Размер: 954 B |
После Ширина: | Высота: | Размер: 1.1 KiB |
После Ширина: | Высота: | Размер: 1.5 KiB |
После Ширина: | Высота: | Размер: 3.1 KiB |
После Ширина: | Высота: | Размер: 1.6 KiB |
После Ширина: | Высота: | Размер: 2.0 KiB |
После Ширина: | Высота: | Размер: 2.5 KiB |
После Ширина: | Высота: | Размер: 3.4 KiB |
После Ширина: | Высота: | Размер: 8.8 KiB |