diff --git a/Dopamine.Common/Presentation/ViewModels/CommonTracksViewModel.cs b/Dopamine.Common/Presentation/ViewModels/CommonTracksViewModel.cs index e44155032..67ff1d8fb 100644 --- a/Dopamine.Common/Presentation/ViewModels/CommonTracksViewModel.cs +++ b/Dopamine.Common/Presentation/ViewModels/CommonTracksViewModel.cs @@ -226,11 +226,7 @@ private void Initialize() } }); - this.ShuffleAllCommand = new DelegateCommand(() => - { - this.playbackService.SetShuffle(true); - this.playbackService.Enqueue(); - }); + this.ShuffleAllCommand = new DelegateCommand(() => this.playbackService.ShuffleAllAsync()); // Initialize Handlers this.playbackService.PlaybackFailed += (_, __) => this.ShowPlayingTrackAsync(); diff --git a/Dopamine.Common/Services/Playback/IPlaybackService.cs b/Dopamine.Common/Services/Playback/IPlaybackService.cs index edbd1876a..2a2ab926b 100644 --- a/Dopamine.Common/Services/Playback/IPlaybackService.cs +++ b/Dopamine.Common/Services/Playback/IPlaybackService.cs @@ -55,6 +55,7 @@ public interface IPlaybackService Task Enqueue(Genre genre); Task Enqueue(Album album); Task Enqueue(Playlist playlist); + Task ShuffleAllAsync(); Task AddToQueue(IList tracks); Task AddToQueue(IList artists); Task AddToQueue(IList genres); diff --git a/Dopamine.Common/Services/Playback/PlaybackService.cs b/Dopamine.Common/Services/Playback/PlaybackService.cs index 94fe67b32..7cf0b816e 100644 --- a/Dopamine.Common/Services/Playback/PlaybackService.cs +++ b/Dopamine.Common/Services/Playback/PlaybackService.cs @@ -662,6 +662,20 @@ public async Task PlayPreviousAsync() } } + public async Task ShuffleAllAsync() + { + List tracks = await Database.Utils.OrderTracksAsync(await this.trackRepository.GetTracksAsync(), TrackOrder.ByAlbum); + + lock (this.queueSyncObject) + { + this.queuedTracks = new List(tracks); + } + + await this.SetPlaybackSettingsAsync(); + if(!this.shuffle) await SetShuffle(true); // Make sure tracks get shuffled + await this.PlayFirstAsync(); + } + public async Task Enqueue() { List tracks = await Database.Utils.OrderTracksAsync(await this.trackRepository.GetTracksAsync(), TrackOrder.ByAlbum); diff --git a/Dopamine/Changelog.txt b/Dopamine/Changelog.txt index f1d8d0982..26924a9a0 100644 --- a/Dopamine/Changelog.txt +++ b/Dopamine/Changelog.txt @@ -1,7 +1,8 @@ -2017-01-02: Dopamine 1.2.4 Build 861 (Release) +2017-01-03: Dopamine 1.2.4 Build 862 (Release) ---------------------------------------------- - [Fixed] Artists are not sorted alphabetically +- [Fixed] "Shuffle all" doesn't shuffle 2017-01-01: Dopamine 1.2.3 Build 860 (Release) diff --git a/Dopamine/Dopamine.wxs b/Dopamine/Dopamine.wxs index 081d344e8..d3623d5f9 100644 --- a/Dopamine/Dopamine.wxs +++ b/Dopamine/Dopamine.wxs @@ -1,5 +1,5 @@ - + diff --git a/Dopamine/SharedAssemblyInfo.cs b/Dopamine/SharedAssemblyInfo.cs index 7b8569d1f..15977559b 100644 --- a/Dopamine/SharedAssemblyInfo.cs +++ b/Dopamine/SharedAssemblyInfo.cs @@ -2,11 +2,11 @@ [assembly: AssemblyCompany("Digimezzo")] [assembly: AssemblyCopyright("Copyright Digimezzo © 2014 - 2017")] -[assembly: AssemblyVersion("1.2.861.4")] -[assembly: AssemblyFileVersion("1.2.861.4")] +[assembly: AssemblyVersion("1.2.862.4")] +[assembly: AssemblyFileVersion("1.2.862.4")] #if DEBUG -[assembly: AssemblyInformationalVersion("1.2.861.4 Preview")] +[assembly: AssemblyInformationalVersion("1.2.862.4 Preview")] #else -[assembly: AssemblyInformationalVersion("1.2.861.4")] +[assembly: AssemblyInformationalVersion("1.2.862.4")] #endif