This commit is contained in:
watsonb8
2019-12-10 15:10:27 -05:00
parent 01736333e9
commit cf05045448
11 changed files with 98 additions and 237 deletions

View File

@ -7,7 +7,7 @@ namespace Aurora.Design.Views.Party.NewPartyDialog
Join
}
public class ConnectionDetails : DialogReturnType
public class ConnectionDetails
{
public ConnectionDetails()
{

View File

@ -2,7 +2,6 @@
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:hs="clr-namespace:Aurora.Design.Components.HostSelector"
xmlns:ml="clr-namespace:Aurora.Design.Components.MemberList"
xmlns:library="clr-namespace:Aurora.Design.Components.Library"
x:Class="Aurora.Design.Views.Party.PartyView">
@ -13,8 +12,7 @@
Height="*"/>
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
IsVisible="{Binding IsNotSelectingHost}">
Grid.Row="0">
<Label
Text="Party Members"/>
<ml:MemberList
@ -26,8 +24,7 @@
ItemsSource="{Binding Queue}"
SelectedItem="{Binding SelectedSong}"
ItemDoubleClicked="{Binding PlayCommand}"/>
</StackLayout>
<!--<hs:HostSelector
</StackLayout><!--<hs:HostSelector
Grid.Row="0"
x:Name="HostSelectionDialog"
Hostname="{Binding Hostname}"

View File

@ -28,7 +28,7 @@ namespace Aurora.Design.Views.Party
public class PartyViewModel : BaseViewModel
{
private PartyState _state;
private string _hostname;
private string _hostname = "";
private ObservableCollection<PartyMember> _members;
private ObservableCollection<BaseMedia> _queue;
private BaseMedia _selectedMedia;
@ -36,9 +36,6 @@ namespace Aurora.Design.Views.Party
public PartyViewModel()
{
this.JoinCommand = new Command(OnJoinExecute, CanJoinExecute);
this.HostCommand = new Command(OnHostExecute, CanHostExecute);
_members = new ObservableCollection<PartyMember>();
_queue = new ObservableCollection<BaseMedia>();
@ -78,20 +75,6 @@ namespace Aurora.Design.Views.Party
}
}
public bool IsSelectingHost
{
get { return _state == PartyState.SelectingHost; }
}
/// <summary>
/// Public property indicating the state.
/// </summary>
/// <value></value>
public bool IsNotSelectingHost
{
get { return _state != PartyState.SelectingHost; }
}
/// <summary>
/// Public property for queue item source
/// </summary>
@ -111,18 +94,6 @@ namespace Aurora.Design.Views.Party
}
}
/// <summary>
/// Public property for the hostname bindable field
/// </summary>
/// <value></value>
public string Hostname
{
get { return _hostname; }
set { SetProperty(ref _hostname, value); }
}
/// <summary>
/// Public property for the currently selected song.
/// </summary>
@ -139,18 +110,6 @@ namespace Aurora.Design.Views.Party
/// <value></value>
public Command PlayCommand { get; private set; }
/// <summary>
/// Public property for join command
/// </summary>
/// <value></value>
public Command JoinCommand { get; set; }
/// <summary>
/// Pubic property for host command
/// </summary>
/// <value></value>
public Command HostCommand { get; set; }
#endregion Properties
#region Events
@ -167,8 +126,26 @@ namespace Aurora.Design.Views.Party
}
else
{
var asdf = await this.ShowModal(typeof(NewPartyDialog.NewPartyDialog), typeof(NewPartyDialogViewModel));
System.Diagnostics.Debug.WriteLine("");
//Open host selection modal
var modalResult = await this.ShowModal(typeof(NewPartyDialog.NewPartyDialog), typeof(NewPartyDialogViewModel));
if (modalResult is ConnectionDetails)
{
ConnectionDetails details = modalResult as ConnectionDetails;
_hostname = details.HostName;
switch (details.ConnectionType)
{
case ConnectionType.Host:
{
OnHostExecute();
break;
}
case ConnectionType.Join:
{
OnJoinExecute();
break;
}
}
}
}
}
@ -250,7 +227,7 @@ namespace Aurora.Design.Views.Party
private async void OnJoinExecute()
{
SetState(PartyState.Connecting);
_client.Start(Hostname, SettingsService.Instance.DefaultPort.ToString());
_client.Start(_hostname, SettingsService.Instance.DefaultPort.ToString());
await JoinParty(false);
//TODO add cancellation token
@ -392,9 +369,10 @@ namespace Aurora.Design.Views.Party
//Subscribe to events
await SubscribeToEvents();
Queue.Clear();
QueueResponse queueResponse = _client.RemotePartyClient.GetQueue(new Empty());
Queue.Clear();
//Convert received data to remote audio models
foreach (RemoteMediaData data in queueResponse.MediaList)
{