From a537edd657bc9251f613563c8c827459a499ade9 Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Sun, 3 Nov 2019 23:17:34 -0500 Subject: [PATCH] Remote playback almost working --- Aurora/Aurora.csproj | 118 ++++++++++++------ Aurora/Design/Components/Queue/Queue.xaml | 4 + Aurora/Design/Components/Queue/Queue.xaml.cs | 57 +++++++-- Aurora/Design/Views/Party/PartyView.xaml | 4 +- Aurora/Design/Views/Party/PartyViewModel.cs | 38 +++++- Aurora/Models/Media/BaseMedia.cs | 2 +- Aurora/Models/Media/RemoteAudio.cs | 83 ++++++++++++ Aurora/Proto/party.proto | 14 ++- Aurora/Proto/playback.proto | 21 ---- Aurora/RemoteImpl/RemotePartyImpl.cs | 26 +++- Aurora/RemoteImpl/RemotePlaybackImpl.cs | 39 ------ .../Services/ClientService/ClientService.cs | 15 +-- Aurora/Services/LibraryService.cs | 6 + Aurora/Services/ServerService.cs | 5 - 14 files changed, 296 insertions(+), 136 deletions(-) create mode 100644 Aurora/Models/Media/RemoteAudio.cs delete mode 100644 Aurora/Proto/playback.proto delete mode 100644 Aurora/RemoteImpl/RemotePlaybackImpl.cs diff --git a/Aurora/Aurora.csproj b/Aurora/Aurora.csproj index e067622..bea94d1 100644 --- a/Aurora/Aurora.csproj +++ b/Aurora/Aurora.csproj @@ -1,54 +1,100 @@ - + netstandard2.0 true - + pdbonly true - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + Player.xaml - - - - + + + \ No newline at end of file diff --git a/Aurora/Design/Components/Queue/Queue.xaml b/Aurora/Design/Components/Queue/Queue.xaml index 0849ed7..bfa5dad 100644 --- a/Aurora/Design/Components/Queue/Queue.xaml +++ b/Aurora/Design/Components/Queue/Queue.xaml @@ -12,6 +12,10 @@ HeaderHeight="40" BorderColor="#CCCCCC" HeaderBackground="#E0E6F8"> + + + diff --git a/Aurora/Design/Components/Queue/Queue.xaml.cs b/Aurora/Design/Components/Queue/Queue.xaml.cs index 83d0e6d..16b2f8c 100644 --- a/Aurora/Design/Components/Queue/Queue.xaml.cs +++ b/Aurora/Design/Components/Queue/Queue.xaml.cs @@ -12,6 +12,10 @@ namespace Aurora.Design.Components.Queue public Queue() { InitializeComponent(); + this.QueueDataGrid.ItemSelected += (sender, e) => + { + this.SelectedItem = e.SelectedItem; + }; } #region ItemsSource Property @@ -69,8 +73,7 @@ namespace Aurora.Design.Components.Queue BindableProperty.Create(propertyName: "SelectedItem", returnType: typeof(object), declaringType: typeof(Queue), - defaultBindingMode: BindingMode.TwoWay, - propertyChanged: OnSelectedItemChanged); + defaultBindingMode: BindingMode.TwoWay); /// /// Backing property for the SelectedItem property. @@ -88,22 +91,58 @@ namespace Aurora.Design.Components.Queue } } + /// - /// Handles selection change events. + /// Bindable property for the item double clicked command /// - /// The bindable object. + /// + /// + /// + public static readonly BindableProperty ItemDoubleClickedProperty = + BindableProperty.Create(propertyName: "ItemDoubleClicked", + returnType: typeof(Command), + declaringType: typeof(Queue), + propertyChanged: OnDoubleClickPropertyChanged); + + /// + /// Public backing property + /// + /// + public Command ItemDoubleClicked + { + get + { + return (Command)GetValue(ItemDoubleClickedProperty); + } + set + { + SetValue(ItemDoubleClickedProperty, value); + } + } + + /// + /// Event handler for double click property. Adds command execute handler. + /// + /// /// /// - private static void OnSelectedItemChanged(BindableObject bindable, object newValue, object oldValue) + private static void OnDoubleClickPropertyChanged(BindableObject bindable, object newValue, object oldValue) { Queue control = bindable as Queue; var queueDataGrid = control.FindByName("QueueDataGrid") as DataGrid; - IEnumerable source = (IEnumerable)queueDataGrid.ItemsSource; - if (source.Contains(newValue)) + if (queueDataGrid.GestureRecognizers.Count > 0) { - queueDataGrid.SelectedItem = newValue; - } + var gestureRecognizer = queueDataGrid.GestureRecognizers.First(); + if (gestureRecognizer is TapGestureRecognizer) + { + TapGestureRecognizer tap = gestureRecognizer as TapGestureRecognizer; + tap.Tapped += (sender, e) => + { + control.ItemDoubleClicked.Execute(null); + }; + } + } } } } diff --git a/Aurora/Design/Views/Party/PartyView.xaml b/Aurora/Design/Views/Party/PartyView.xaml index 799ce28..4dbad0c 100644 --- a/Aurora/Design/Views/Party/PartyView.xaml +++ b/Aurora/Design/Views/Party/PartyView.xaml @@ -24,7 +24,9 @@