diff --git a/Aurora.gtk/Aurora.gtk.csproj b/Aurora.gtk/Aurora.gtk.csproj index 8635ae6..f8b3f26 100644 --- a/Aurora.gtk/Aurora.gtk.csproj +++ b/Aurora.gtk/Aurora.gtk.csproj @@ -518,6 +518,17 @@ PreserveNewest + + PreserveNewest + + + + + PreserveNewest + + + PreserveNewest + diff --git a/Aurora.gtk/Resources/loop.png b/Aurora.gtk/Resources/loop.png new file mode 100644 index 0000000..4adfaa9 Binary files /dev/null and b/Aurora.gtk/Resources/loop.png differ diff --git a/Aurora.gtk/Resources/menu.png b/Aurora.gtk/Resources/menu.png new file mode 100644 index 0000000..dba7ae5 Binary files /dev/null and b/Aurora.gtk/Resources/menu.png differ diff --git a/Aurora.gtk/Resources/pause.png b/Aurora.gtk/Resources/pause.png new file mode 100644 index 0000000..bbc2a01 Binary files /dev/null and b/Aurora.gtk/Resources/pause.png differ diff --git a/Aurora.gtk/Resources/shuffle.png b/Aurora.gtk/Resources/shuffle.png new file mode 100644 index 0000000..4ec3d3f Binary files /dev/null and b/Aurora.gtk/Resources/shuffle.png differ diff --git a/Aurora/Design/Components/MediaPlayer/Player.css b/Aurora/Design/Components/MediaPlayer/Player.css index 5fc79aa..4455ac1 100644 --- a/Aurora/Design/Components/MediaPlayer/Player.css +++ b/Aurora/Design/Components/MediaPlayer/Player.css @@ -1,12 +1,26 @@ -Label { - color: darkgray; +#PlayerControlContainer { + background-color: #626363; +} + +Label { + color: white; text-align: left; vertical-align: middle; word-wrap: break-word; } -#MediaInfoLayout label { - margin-left: 20; +#MediaInfoContainer { + width: 150; + margin-top: 10; + margin-bottom: 10; +} + + #MediaInfoContainer label { + margin-left: 20; + } +#AlbumArtBoxView { + background-color: black; + width: 80; } ImageButton { diff --git a/Aurora/Design/Components/MediaPlayer/Player.xaml b/Aurora/Design/Components/MediaPlayer/Player.xaml index ea51ed1..6fb0868 100644 --- a/Aurora/Design/Components/MediaPlayer/Player.xaml +++ b/Aurora/Design/Components/MediaPlayer/Player.xaml @@ -12,25 +12,30 @@ + Width="150"/> - @@ -38,8 +43,7 @@ x:Name="PreviousButton" Source="Resources/backward.png"/> + x:Name="PlayButton"/> diff --git a/Aurora/Design/Components/MediaPlayer/Player.xaml.cs b/Aurora/Design/Components/MediaPlayer/Player.xaml.cs index f00fbe1..8f3802b 100644 --- a/Aurora/Design/Components/MediaPlayer/Player.xaml.cs +++ b/Aurora/Design/Components/MediaPlayer/Player.xaml.cs @@ -9,6 +9,7 @@ namespace Aurora.Design.Components.MediaPlayer { InitializeComponent(); + PlayButton.Source = ImageSource.FromFile("Resources/play.png"); } #region SongTitle Bindable @@ -16,7 +17,11 @@ namespace Aurora.Design.Components.MediaPlayer BindableProperty.Create(propertyName: "SongTitle", returnType: typeof(string), declaringType: typeof(Player), - propertyChanged: OnSongTitlePropertyChanged); + propertyChanged: (BindableObject bindable, object oldValue, object newValue) => + { + Player component = bindable as Player; + component.SongTitleLabel.Text = (string)newValue; + }); public string SongTitle { @@ -30,12 +35,6 @@ namespace Aurora.Design.Components.MediaPlayer } } - private static void OnSongTitlePropertyChanged(BindableObject bindable, object oldValue, object newValue) - { - Player component = bindable as Player; - component.SongTitleLabel.Text = (string)newValue; - } - #endregion SongTitle Bindable #region ArtistName Bindable @@ -43,7 +42,11 @@ namespace Aurora.Design.Components.MediaPlayer BindableProperty.Create(propertyName: "ArtistName", returnType: typeof(string), declaringType: typeof(Player), - propertyChanged: OnArtistNamePropertyChanged); + propertyChanged: (BindableObject bindable, object oldValue, object newValue) => + { + Player component = bindable as Player; + component.ArtistNameLabel.Text = (string)newValue; + }); public string ArtistName { @@ -57,12 +60,6 @@ namespace Aurora.Design.Components.MediaPlayer } } - private static void OnArtistNamePropertyChanged(BindableObject bindable, object oldValue, object newValue) - { - Player component = bindable as Player; - component.ArtistNameLabel.Text = (string)newValue; - } - #endregion ArtistName Bindable #region PreviousButton @@ -275,5 +272,32 @@ namespace Aurora.Design.Components.MediaPlayer component.NextButton.IsEnabled = cmd.CanExecute(null); } #endregion PlayButton + + #region Playing Bindable + public static readonly BindableProperty IsPlayingProperty = + BindableProperty.Create( + propertyName: "IsPlaying", + returnType: typeof(bool), + declaringType: typeof(Player), + propertyChanged: (BindableObject bindable, object oldValue, object newValue) => + { + Player control = (Player)bindable; + if ((bool)newValue == true) + { + control.PlayButton.Source = ImageSource.FromFile("Resources/pause.png"); + } + else + { + control.PlayButton.Source = ImageSource.FromFile("Resources/play.png"); + } + }); + + public bool IsPlaying + { + get { return (bool)GetValue(IsPlayingProperty); } + set { SetValue(IsPlayingProperty, value); } + } + + #endregion Playing Binadable } } diff --git a/Aurora/Design/Converters/PlayIconConverter.cs b/Aurora/Design/Converters/PlayIconConverter.cs new file mode 100644 index 0000000..f1da0c6 --- /dev/null +++ b/Aurora/Design/Converters/PlayIconConverter.cs @@ -0,0 +1,10 @@ +using System; +namespace Aurora.Design.Converters +{ + public class PlayIconConverter + { + public PlayIconConverter() + { + } + } +} diff --git a/Aurora/Design/Views/BaseViewModel.cs b/Aurora/Design/Views/BaseViewModel.cs index 221b0a4..1a6c81c 100644 --- a/Aurora/Design/Views/BaseViewModel.cs +++ b/Aurora/Design/Views/BaseViewModel.cs @@ -72,6 +72,8 @@ namespace Aurora.Design.Views public SetPlayerVisibleDelegate SetPlayerVisible { get; set; } + public SetIsPlayingDelegate SetIsPlaying { get; set; } + #endregion Player #region Lifecycle diff --git a/Aurora/Design/Views/MainView/MainView.css b/Aurora/Design/Views/MainView/MainView.css index 77cbc0e..115671d 100644 --- a/Aurora/Design/Views/MainView/MainView.css +++ b/Aurora/Design/Views/MainView/MainView.css @@ -3,7 +3,7 @@ } #Header { - background-color: #232323; + background-color: transparent; } #Header > Entry { @@ -14,7 +14,7 @@ #TitleContainer { margin-top: 10; - background-color: #3a3a3a; + background-color: transparent; } #TitleContainer Label { diff --git a/Aurora/Design/Views/MainView/MainView.xaml b/Aurora/Design/Views/MainView/MainView.xaml index c0a1c47..9107a9e 100644 --- a/Aurora/Design/Views/MainView/MainView.xaml +++ b/Aurora/Design/Views/MainView/MainView.xaml @@ -17,10 +17,15 @@ + + + + @@ -28,35 +33,31 @@ - - - - - - + + - - - - - + + + x:Name="Player" + Grid.Row="3" + Grid.ColumnSpan="2" + HeightRequest="50"/> \ No newline at end of file diff --git a/Aurora/Design/Views/MainView/MainView.xaml.cs b/Aurora/Design/Views/MainView/MainView.xaml.cs index c09cb8a..735617f 100644 --- a/Aurora/Design/Views/MainView/MainView.xaml.cs +++ b/Aurora/Design/Views/MainView/MainView.xaml.cs @@ -17,7 +17,9 @@ namespace Aurora.Design.Views.Main /// public delegate void SetPlayerMetadataDelegate(BaseMedia media); - public delegate void SetPlayerVisibleDelegate(Boolean visible); + public delegate void SetPlayerVisibleDelegate(bool visible); + + public delegate void SetIsPlayingDelegate(bool playing); [XamlCompilation(XamlCompilationOptions.Compile)] public partial class MainView : ContentPage//, IDisposable @@ -139,6 +141,7 @@ namespace Aurora.Design.Views.Main { vm.SetPlayerMetadata = null; vm.SetPlayerVisible = null; + vm.SetIsPlaying = null; } /// @@ -152,8 +155,10 @@ namespace Aurora.Design.Views.Main _player.PreviousButtonCommand = new Command(vm.OnPreviousButtonExecute, vm.CanPreviousButtonExecute); //Assign SetPlayer delegate + vm.SetPlayerMetadata = SetPlayer; vm.SetPlayerVisible = SetPlayerVisible; + vm.SetIsPlaying = SetIsPlaying; } /// @@ -178,6 +183,11 @@ namespace Aurora.Design.Views.Main { _player.IsVisible = visible; } + + private void SetIsPlaying(bool playing) + { + _player.IsPlaying = playing; + } } } diff --git a/Aurora/Design/Views/Party/PartyViewModel.cs b/Aurora/Design/Views/Party/PartyViewModel.cs index 2c06903..1c654de 100644 --- a/Aurora/Design/Views/Party/PartyViewModel.cs +++ b/Aurora/Design/Views/Party/PartyViewModel.cs @@ -257,7 +257,7 @@ namespace Aurora.Design.Views.Party } catch (Exception ex) { - Console.WriteLine("Exception occurred while receiviing events: ", ex.Message); + System.Diagnostics.Debug.WriteLine("Exception occurred while receiviing events: ", ex.Message); } } @@ -285,7 +285,7 @@ namespace Aurora.Design.Views.Party } catch (Exception ex) { - Console.WriteLine("Exception occurred while receiviing events: ", ex.Message); + System.Diagnostics.Debug.WriteLine("Exception occurred while receiviing events: ", ex.Message); } } @@ -419,7 +419,7 @@ namespace Aurora.Design.Views.Party } catch (Exception ex) { - Console.WriteLine("Error subscribing to events: " + ex.Message); + System.Diagnostics.Debug.WriteLine("Error subscribing to events: " + ex.Message); } } @@ -449,7 +449,7 @@ namespace Aurora.Design.Views.Party } - Console.WriteLine(string.Format("CLIENT {0} - SubscribeToEvents called from client with id", SettingsService.Instance.ClientId)); + System.Diagnostics.Debug.WriteLine(string.Format("CLIENT {0} - SubscribeToEvents called from client with id", SettingsService.Instance.ClientId)); await _client.RemoteEventClient.SubscribeToEventsAsync(req); } private async Task UnsubscribeFromEvents() diff --git a/Aurora/Design/Views/Songs/SongsViewModel.cs b/Aurora/Design/Views/Songs/SongsViewModel.cs index 95fad12..cc34b7a 100644 --- a/Aurora/Design/Views/Songs/SongsViewModel.cs +++ b/Aurora/Design/Views/Songs/SongsViewModel.cs @@ -22,8 +22,6 @@ namespace Aurora.Design.Views.Songs _songsList = new ObservableCollection(); PlayCommand = new Command(OnPlayButtonExecute, CanPlayButtonExecute); - _player.PlaybackStateChanged += OnPlaybackStateChanged; - Initialize(); } @@ -87,6 +85,10 @@ namespace Aurora.Design.Views.Songs public async override void OnPlayButtonExecute() { + if (_selectedSong == null) + { + return; + } base.Media = _selectedSong; if (!_player.IsMediaLoaded(base.Media)) { @@ -98,16 +100,19 @@ namespace Aurora.Design.Views.Songs case PlaybackState.Buffering: { _player.Play(); + SetIsPlaying(true); break; } case PlaybackState.Playing: { _player.Pause(); + SetIsPlaying(false); break; } case PlaybackState.Stopped: { _player.Play(); + SetIsPlaying(true); break; } } @@ -124,18 +129,5 @@ namespace Aurora.Design.Views.Songs } #endregion Commands - - #region Events - /// - /// PlayerService playback state changed event handler. - /// - /// The sending object. - /// Event arguments. - public void OnPlaybackStateChanged(object sender, PlaybackStateChangedEventArgs args) - { - OnPropertyChanged("PlayButtonText"); - } - - #endregion Events } } diff --git a/Aurora/Models/Media/RemoteAudio.cs b/Aurora/Models/Media/RemoteAudio.cs index 679b57e..31ef1d3 100644 --- a/Aurora/Models/Media/RemoteAudio.cs +++ b/Aurora/Models/Media/RemoteAudio.cs @@ -69,11 +69,11 @@ namespace Aurora.Models.Media await this.DataStream.WriteAsync(buffer, 0, buffer.Length); } - Console.WriteLine("Done receiving stream"); + System.Diagnostics.Debug.WriteLine("Done receiving stream"); } catch (Exception ex) { - Console.WriteLine("Exception caught while loading remote audio:" + ex.Message); + System.Diagnostics.Debug.WriteLine("Exception caught while loading remote audio:" + ex.Message); } } await base.Load(); diff --git a/Aurora/RemoteImpl/RemoteEventImpl.cs b/Aurora/RemoteImpl/RemoteEventImpl.cs index 5bbe42e..c2778c2 100644 --- a/Aurora/RemoteImpl/RemoteEventImpl.cs +++ b/Aurora/RemoteImpl/RemoteEventImpl.cs @@ -28,12 +28,12 @@ namespace Aurora.RemoteImpl Grpc.Core.ServerCallContext context) { string peerId = Combine(new string[] { context.Peer, request.ClientId }); - Console.WriteLine(string.Format("SERVER - Events request received from peer: {0}", peerId)); + System.Diagnostics.Debug.WriteLine(string.Format("SERVER - Events request received from peer: {0}", peerId)); AutoResetEvent are = new AutoResetEvent(false); Action callback = (BaseEvent bEvent) => { - Console.WriteLine(string.Format("SERVER - Event fired for peer: {0}", peerId)); + System.Diagnostics.Debug.WriteLine(string.Format("SERVER - Event fired for peer: {0}", peerId)); //TODO need to remove callback if stream no longer exists IE. Client crashed or stopped responseStream.WriteAsync(bEvent); @@ -52,7 +52,7 @@ namespace Aurora.RemoteImpl /// public override Task SubscribeToEvents(SubscribeRequest request, Grpc.Core.ServerCallContext context) { - Console.WriteLine(string.Format("SERVER - Subscription from client with id: {0}", request.ClientId)); + System.Diagnostics.Debug.WriteLine(string.Format("SERVER - Subscription from client with id: {0}", request.ClientId)); EventManager.Instance.AddSubscriptionList(Combine(new string[] { context.Peer, request.ClientId }), request.EventTypes.ToList()); return Task.FromResult(new SubscriptionResponse { Successful = true }); diff --git a/Aurora/RemoteImpl/RemotePartyImpl.cs b/Aurora/RemoteImpl/RemotePartyImpl.cs index ddbca26..86ba4a3 100644 --- a/Aurora/RemoteImpl/RemotePartyImpl.cs +++ b/Aurora/RemoteImpl/RemotePartyImpl.cs @@ -40,7 +40,7 @@ namespace Aurora.RemoteImpl IpAddress = context.Host, }; - Console.WriteLine("SERVER - Client joined party: " + partyMember.Id); + System.Diagnostics.Debug.WriteLine("SERVER - Client joined party: " + partyMember.Id); _partyMembers.Add(partyMember); @@ -128,7 +128,7 @@ namespace Aurora.RemoteImpl } catch (Exception ex) { - Console.WriteLine(string.Format("Error preparing queue: {0}", ex.Message)); + System.Diagnostics.Debug.WriteLine(string.Format("Error preparing queue: {0}", ex.Message)); } } diff --git a/Aurora/RemoteImpl/RemotePlaybackImpl.cs b/Aurora/RemoteImpl/RemotePlaybackImpl.cs index 17da449..71714d5 100644 --- a/Aurora/RemoteImpl/RemotePlaybackImpl.cs +++ b/Aurora/RemoteImpl/RemotePlaybackImpl.cs @@ -33,7 +33,7 @@ namespace Aurora.RemoteImpl } //Send stream - Console.WriteLine("Begin sending file"); + System.Diagnostics.Debug.WriteLine("Begin sending file"); byte[] buffer = new byte[2048]; // read in chunks of 2KB int bytesRead; while ((bytesRead = songCopy.DataStream.Read(buffer, 0, buffer.Length)) > 0) @@ -41,11 +41,11 @@ namespace Aurora.RemoteImpl Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer); await responseStream.WriteAsync(new Chunk { Content = bufferByteString }); } - Console.WriteLine("Done sending file"); + System.Diagnostics.Debug.WriteLine("Done sending file"); } catch (Exception ex) { - Console.WriteLine("Exception caught while sending audio file: " + ex.Message); + System.Diagnostics.Debug.WriteLine("Exception caught while sending audio file: " + ex.Message); } } } diff --git a/Aurora/RemoteImpl/RemoteSyncImpl.cs b/Aurora/RemoteImpl/RemoteSyncImpl.cs index eddaac0..4493e43 100644 --- a/Aurora/RemoteImpl/RemoteSyncImpl.cs +++ b/Aurora/RemoteImpl/RemoteSyncImpl.cs @@ -41,7 +41,7 @@ namespace Aurora.RemoteImpl ServerTimeTicks = Utils.TimeUtils.GetNetworkTime().DateTime.Ticks }; await responseStream.WriteAsync(sync); - Console.WriteLine("Sent Sync"); + System.Diagnostics.Debug.WriteLine("Sent Sync"); await Task.Delay(5000); } } diff --git a/Aurora/Services/ClientService/ClientService.cs b/Aurora/Services/ClientService/ClientService.cs index a3c0c58..5a661cc 100644 --- a/Aurora/Services/ClientService/ClientService.cs +++ b/Aurora/Services/ClientService/ClientService.cs @@ -95,7 +95,7 @@ namespace Aurora.Services.ClientService { _eventCancellationTokenSource = new CancellationTokenSource(); string clientId = SettingsService.Instance.ClientId; - Console.WriteLine(string.Format("CLIENT {0} - GetEvents called from client with id", clientId)); + System.Diagnostics.Debug.WriteLine(string.Format("CLIENT {0} - GetEvents called from client with id", clientId)); using (AsyncServerStreamingCall eventStream = _remoteEventsClient .GetEvents(new EventsRequest { ClientId = SettingsService.Instance.ClientId })) { @@ -126,14 +126,14 @@ namespace Aurora.Services.ClientService } catch (Exception ex) { - Console.WriteLine("Exception while parsing event ---" + ex.Message); + System.Diagnostics.Debug.WriteLine("Exception while parsing event ---" + ex.Message); } } } catch (Exception ex) { - Console.WriteLine(string.Format("EXCEPTION while parsing events --- " + ex.Message)); + System.Diagnostics.Debug.WriteLine(string.Format("EXCEPTION while parsing events --- " + ex.Message)); } } } diff --git a/Aurora/Services/EventManager/EventManager.cs b/Aurora/Services/EventManager/EventManager.cs index 8b41e43..0ab2efa 100644 --- a/Aurora/Services/EventManager/EventManager.cs +++ b/Aurora/Services/EventManager/EventManager.cs @@ -187,7 +187,7 @@ namespace Aurora.Services.EventManager executionTask.ContinueWith((Task task) => { var exception = executionTask.Exception; - Console.WriteLine(string.Format("SERVER --- Exception occurred firing event")); + System.Diagnostics.Debug.WriteLine(string.Format("SERVER --- Exception occurred firing event")); this._actionList.Remove(pair.Key); }, TaskContinuationOptions.OnlyOnFaulted); diff --git a/Aurora/Services/PlayerService/PlayerService.cs b/Aurora/Services/PlayerService/PlayerService.cs index 139dc97..6fa31b1 100644 --- a/Aurora/Services/PlayerService/PlayerService.cs +++ b/Aurora/Services/PlayerService/PlayerService.cs @@ -147,21 +147,21 @@ namespace Aurora.Services.PlayerService newPosition - oldPosition < -0.001) { _mediaPlayer.Position = newPosition; - Console.WriteLine(string.Format("**Audio synced**")); - // Console.WriteLine(string.Format("Remote Server Time {0}", new DateTime(sync.ServerTimeTicks).ToLongTimeString())); - // Console.WriteLine(string.Format("Remote Track Time: {0}", sync.TrackPosition)); - // Console.WriteLine(string.Format("Local Server Time: {0}", time.DateTime.ToLongTimeString())); - // Console.WriteLine(string.Format("Local Track Time: {0}", _mediaPlayer.Position)); - // Console.WriteLine(string.Format("Offset: {0}", offset)); - // Console.WriteLine(string.Format("Old Position: {0}", oldPosition)); - // Console.WriteLine(string.Format("New Position: {0}", newPosition)); + System.Diagnostics.Debug.WriteLine(string.Format("**Audio synced**")); + // System.Diagnostics.Debug.WriteLine(string.Format("Remote Server Time {0}", new DateTime(sync.ServerTimeTicks).ToLongTimeString())); + // System.Diagnostics.Debug.WriteLine(string.Format("Remote Track Time: {0}", sync.TrackPosition)); + // System.Diagnostics.Debug.WriteLine(string.Format("Local Server Time: {0}", time.DateTime.ToLongTimeString())); + // System.Diagnostics.Debug.WriteLine(string.Format("Local Track Time: {0}", _mediaPlayer.Position)); + // System.Diagnostics.Debug.WriteLine(string.Format("Offset: {0}", offset)); + // System.Diagnostics.Debug.WriteLine(string.Format("Old Position: {0}", oldPosition)); + // System.Diagnostics.Debug.WriteLine(string.Format("New Position: {0}", newPosition)); } } } } catch (Exception ex) { - Console.WriteLine("Exception caught while attempting to sync: " + ex.Message); + System.Diagnostics.Debug.WriteLine("Exception caught while attempting to sync: " + ex.Message); } } }); diff --git a/Aurora/Services/ServerService.cs b/Aurora/Services/ServerService.cs index 3205ea1..087ef1d 100644 --- a/Aurora/Services/ServerService.cs +++ b/Aurora/Services/ServerService.cs @@ -73,7 +73,7 @@ namespace Aurora.Services try { - Console.WriteLine(string.Format("Starting gRPC server at hostname: {0}, port: {1}", _hostname, _port)); + System.Diagnostics.Debug.WriteLine(string.Format("Starting gRPC server at hostname: {0}, port: {1}", _hostname, _port)); if (!Initialized) { @@ -93,7 +93,7 @@ namespace Aurora.Services } catch (Exception ex) { - Console.WriteLine(string.Format("Error starting gRPC server: {0}", ex.Message)); + System.Diagnostics.Debug.WriteLine(string.Format("Error starting gRPC server: {0}", ex.Message)); } } diff --git a/Aurora/Utils/FileSystemUtils.cs b/Aurora/Utils/FileSystemUtils.cs index 3828f90..e39e242 100644 --- a/Aurora/Utils/FileSystemUtils.cs +++ b/Aurora/Utils/FileSystemUtils.cs @@ -73,7 +73,7 @@ namespace Aurora.Utils } catch (Exception ex) { - Console.WriteLine($"{ex.GetType()} {ex.Message}\n{ex.StackTrace}"); + System.Diagnostics.Debug.WriteLine($"{ex.GetType()} {ex.Message}\n{ex.StackTrace}"); ex = ex.InnerException; } }