Progress
This commit is contained in:
parent
613365f7ad
commit
0cb0546741
@ -35,26 +35,6 @@ namespace Aurora.Backend.Client.Party
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Next()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Pause()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Play()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Previous()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void RemoveFromQueue()
|
public override void RemoveFromQueue()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -64,10 +44,5 @@ namespace Aurora.Backend.Client.Party
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Stop()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,8 @@ namespace Aurora.Backend.Executors
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExecutorType ExecutorType { get; protected set; }
|
||||||
|
|
||||||
public static BaseExecutor CreateExecutor<T>(ExecutorType executorType) where T : BaseExecutor
|
public static BaseExecutor CreateExecutor<T>(ExecutorType executorType) where T : BaseExecutor
|
||||||
{
|
{
|
||||||
MethodInfo method = typeof(T).GetMethod("Create");
|
MethodInfo method = typeof(T).GetMethod("Create");
|
||||||
@ -19,14 +21,6 @@ namespace Aurora.Backend.Executors
|
|||||||
}
|
}
|
||||||
|
|
||||||
return method.Invoke(null, new object[] { executorType }) as BaseExecutor;
|
return method.Invoke(null, new object[] { executorType }) as BaseExecutor;
|
||||||
|
|
||||||
// var types = typeof(T).Assembly.GetTypes();
|
|
||||||
|
|
||||||
// foreach (Type type in types)
|
|
||||||
// {
|
|
||||||
// MethodInfo genericMethod = method.MakeGenericMethod(type);
|
|
||||||
// genericMethod.Invoke(null, null); // No target, no arguments
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,11 +19,13 @@ namespace Aurora.Backend.Executors
|
|||||||
case ExecutorType.Client:
|
case ExecutorType.Client:
|
||||||
{
|
{
|
||||||
executor = new ClientPartyExecutor();
|
executor = new ClientPartyExecutor();
|
||||||
|
executor.ExecutorType = type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ExecutorType.Server:
|
case ExecutorType.Server:
|
||||||
{
|
{
|
||||||
executor = new HostPartyExecutor();
|
executor = new HostPartyExecutor();
|
||||||
|
executor.ExecutorType = type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,14 +47,5 @@ namespace Aurora.Backend.Executors
|
|||||||
|
|
||||||
public abstract void RemoveFromQueue();
|
public abstract void RemoveFromQueue();
|
||||||
|
|
||||||
public abstract void Play();
|
|
||||||
|
|
||||||
public abstract void Pause();
|
|
||||||
|
|
||||||
public abstract void Stop();
|
|
||||||
|
|
||||||
public abstract void Next();
|
|
||||||
|
|
||||||
public abstract void Previous();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,26 +39,6 @@ namespace Aurora.Backend.Server.Party
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Next()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Pause()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Play()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Previous()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void RemoveFromQueue()
|
public override void RemoveFromQueue()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -68,10 +48,5 @@ namespace Aurora.Backend.Server.Party
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Stop()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
<ContentView
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
x:Class="Aurora.Frontend.Components.HostSelector.HostSelector">
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Aurora.Frontend.Components.HostSelector.HostSelector">
|
||||||
<ContentView.Content>
|
<ContentView.Content>
|
||||||
<StackLayout HorizontalOptions="Center"
|
<Grid>
|
||||||
VerticalOptions="Center"
|
<Grid.RowDefinitions>
|
||||||
BackgroundColor="Red">
|
<RowDefinition
|
||||||
<Button Text="Host Session"/>
|
Height="*"/>
|
||||||
<Button Text="Join Session"/>
|
</Grid.RowDefinitions>
|
||||||
</StackLayout>
|
<StackLayout
|
||||||
|
Grid.Row="0"
|
||||||
|
x:Name="CredentialEditorLayout"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Start">
|
||||||
|
<Label
|
||||||
|
Text="Hostname"
|
||||||
|
VerticalOptions="Center"/>
|
||||||
|
<Entry
|
||||||
|
x:Name="HostnameEntry"/>
|
||||||
|
<Label
|
||||||
|
Text="Port"
|
||||||
|
VerticalOptions="Center"/>
|
||||||
|
<Entry
|
||||||
|
x:Name="PortEntry"/>
|
||||||
|
<Button
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
x:Name="buttonHost"
|
||||||
|
Text="Host"/>
|
||||||
|
<Button
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
x:Name="buttonClient"
|
||||||
|
Text="Join"/>
|
||||||
|
</StackLayout>
|
||||||
|
</Grid>
|
||||||
</ContentView.Content>
|
</ContentView.Content>
|
||||||
</ContentView>
|
</ContentView>
|
@ -4,11 +4,149 @@ using Xamarin.Forms;
|
|||||||
|
|
||||||
namespace Aurora.Frontend.Components.HostSelector
|
namespace Aurora.Frontend.Components.HostSelector
|
||||||
{
|
{
|
||||||
|
public enum ConnectionType
|
||||||
|
{
|
||||||
|
Host,
|
||||||
|
Client,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SelectorState
|
||||||
|
{
|
||||||
|
SelectingHost,
|
||||||
|
EnteringCredentials,
|
||||||
|
}
|
||||||
|
|
||||||
public partial class HostSelector : ContentView
|
public partial class HostSelector : ContentView
|
||||||
{
|
{
|
||||||
|
|
||||||
public HostSelector()
|
public HostSelector()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
//Set initial conditions
|
||||||
|
CredentialEditorLayout.IsVisible = true;
|
||||||
|
|
||||||
|
buttonHost.Clicked += OnButtonHostClicked;
|
||||||
|
buttonClient.Clicked += OnButtonClientClicked;
|
||||||
|
HostnameEntry.TextChanged += (sender, e) =>
|
||||||
|
{
|
||||||
|
Hostname = e.NewTextValue;
|
||||||
|
};
|
||||||
|
PortEntry.TextChanged += (sender, e) =>
|
||||||
|
{
|
||||||
|
Port = e.NewTextValue;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// On the host button clicked.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">Sender.</param>
|
||||||
|
/// <param name="e">E.</param>
|
||||||
|
void OnButtonHostClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (HostCommand.CanExecute(null))
|
||||||
|
{
|
||||||
|
HostCommand.Execute(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// On the client button clicked.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">Sender.</param>
|
||||||
|
/// <param name="e">E.</param>
|
||||||
|
void OnButtonClientClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (JoinCommand.CanExecute(null))
|
||||||
|
{
|
||||||
|
JoinCommand.Execute(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Host Selected Command
|
||||||
|
public static readonly BindableProperty HostCommandProperty =
|
||||||
|
BindableProperty.Create(propertyName: "HostSelectedCommand",
|
||||||
|
returnType: typeof(Command),
|
||||||
|
declaringType: typeof(HostSelector));
|
||||||
|
|
||||||
|
public Command HostCommand
|
||||||
|
{
|
||||||
|
get { return (Command)GetValue(HostCommandProperty); }
|
||||||
|
set { SetValue(HostCommandProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Host Selected Command
|
||||||
|
|
||||||
|
#region Client Selected Command
|
||||||
|
public static readonly BindableProperty JoinCommandProperty =
|
||||||
|
BindableProperty.Create(propertyName: "JoinSelectedCommand",
|
||||||
|
returnType: typeof(Command),
|
||||||
|
declaringType: typeof(HostSelector));
|
||||||
|
|
||||||
|
public Command JoinCommand
|
||||||
|
{
|
||||||
|
get { return (Command)GetValue(JoinCommandProperty); }
|
||||||
|
set { SetValue(JoinCommandProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Client Selected Command
|
||||||
|
|
||||||
|
#region Hostname property
|
||||||
|
public static readonly BindableProperty HostnameProperty =
|
||||||
|
BindableProperty.Create(propertyName: "Hostname",
|
||||||
|
returnType: typeof(string),
|
||||||
|
declaringType: typeof(HostSelector),
|
||||||
|
defaultBindingMode: BindingMode.TwoWay,
|
||||||
|
propertyChanged: OnHostNameChanged);
|
||||||
|
|
||||||
|
public string Hostname
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(HostnameProperty); }
|
||||||
|
set { SetValue(HostnameProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnHostNameChanged(BindableObject bindable, object oldValue, object newValue)
|
||||||
|
{
|
||||||
|
string newVal = newValue as string;
|
||||||
|
HostSelector instance = bindable as HostSelector;
|
||||||
|
if (instance.HostnameEntry.Text != newValue)
|
||||||
|
{
|
||||||
|
instance.HostnameEntry.Text = newVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Hostname property
|
||||||
|
|
||||||
|
#region Port property
|
||||||
|
public static readonly BindableProperty PortProperty =
|
||||||
|
BindableProperty.Create(propertyName: "Port",
|
||||||
|
returnType: typeof(string),
|
||||||
|
declaringType: typeof(HostSelector),
|
||||||
|
defaultBindingMode: BindingMode.TwoWay,
|
||||||
|
propertyChanged: OnPortChanged);
|
||||||
|
|
||||||
|
public string Port
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(PortProperty); }
|
||||||
|
set { SetValue(PortProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnPortChanged(BindableObject bindable, object oldValue, object newValue)
|
||||||
|
{
|
||||||
|
string newVal = newValue as string;
|
||||||
|
HostSelector instance = bindable as HostSelector;
|
||||||
|
if (instance.PortEntry.Text != newVal)
|
||||||
|
{
|
||||||
|
instance.PortEntry.Text = newVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Port property
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ContentView
|
<ContentView
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
@ -7,23 +7,30 @@
|
|||||||
xmlns:qu="clr-namespace:Aurora.Frontend.Components.Queue"
|
xmlns:qu="clr-namespace:Aurora.Frontend.Components.Queue"
|
||||||
x:Class="Aurora.Frontend.Views.Party.PartyView">
|
x:Class="Aurora.Frontend.Views.Party.PartyView">
|
||||||
<ContentView.Content>
|
<ContentView.Content>
|
||||||
<AbsoluteLayout
|
<Grid>
|
||||||
VerticalOptions="FillAndExpand"
|
<Grid.RowDefinitions>
|
||||||
HorizontalOptions="FillAndExpand">
|
<RowDefinition Height="*" />
|
||||||
<StackLayout>
|
</Grid.RowDefinitions>
|
||||||
|
<StackLayout
|
||||||
|
Grid.Row="0"
|
||||||
|
IsVisible="{Binding IsNotSelectingHost}">
|
||||||
<Label
|
<Label
|
||||||
Text="Party Members"/>
|
Text="Party Members"/>
|
||||||
<ml:MemberList
|
<ml:MemberList
|
||||||
|
VerticalOptions="FillAndExpand"
|
||||||
Members="{Binding Members}"/>
|
Members="{Binding Members}"/>
|
||||||
<Label
|
<Label
|
||||||
Text="Queue"/>
|
Text="Queue"/>
|
||||||
<qu:Queue/>
|
<qu:Queue/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<hs:HostSelector
|
<hs:HostSelector
|
||||||
AbsoluteLayout.LayoutFlags="All"
|
Grid.Row="0"
|
||||||
AbsoluteLayout.LayoutBounds="0.5,0.5,0.7,0.7"
|
Hostname="{Binding Hostname}"
|
||||||
BackgroundColor="Green"
|
Port="{Binding Port}"
|
||||||
IsVisible="False"/>
|
HostCommand="{Binding HostCommand}"
|
||||||
</AbsoluteLayout>
|
JoinCommand="{Binding JoinCommand}"
|
||||||
|
IsVisible="{Binding IsSelectingHost}"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
</ContentView.Content>
|
</ContentView.Content>
|
||||||
</ContentView>
|
</ContentView>
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Party
|
namespace Aurora.Frontend.Views.Party
|
||||||
|
@ -1,11 +1,31 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using Aurora.Backend.Executors;
|
||||||
|
using Aurora.Frontend.Components.HostSelector;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Aurora.Frontend.Views.Party
|
namespace Aurora.Frontend.Views.Party
|
||||||
{
|
{
|
||||||
|
enum PartyState
|
||||||
|
{
|
||||||
|
SelectingHost,
|
||||||
|
InParty,
|
||||||
|
Connecting,
|
||||||
|
}
|
||||||
|
|
||||||
public class PartyViewModel : BaseViewModel
|
public class PartyViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
private ObservableCollection<string> _members;
|
private ObservableCollection<string> _members;
|
||||||
|
|
||||||
|
private PartyState _state;
|
||||||
|
|
||||||
|
private BasePartyExecutor _executor;
|
||||||
|
|
||||||
|
private string _hostname;
|
||||||
|
|
||||||
|
private string _port;
|
||||||
|
|
||||||
|
|
||||||
public PartyViewModel()
|
public PartyViewModel()
|
||||||
{
|
{
|
||||||
_members = new ObservableCollection<string>()
|
_members = new ObservableCollection<string>()
|
||||||
@ -20,12 +40,79 @@ namespace Aurora.Frontend.Views.Party
|
|||||||
"Spencer",
|
"Spencer",
|
||||||
};
|
};
|
||||||
OnPropertyChanged("Members");
|
OnPropertyChanged("Members");
|
||||||
|
|
||||||
|
this.JoinCommand = new Command(OnJoinExecute, CanJoinExecute);
|
||||||
|
this.HostCommand = new Command(OnHostExecute, CanHostExecute);
|
||||||
|
|
||||||
|
State(PartyState.SelectingHost);
|
||||||
}
|
}
|
||||||
|
#region Properties
|
||||||
|
|
||||||
public ObservableCollection<string> Members
|
public ObservableCollection<string> Members
|
||||||
{
|
{
|
||||||
get { return _members; }
|
get { return _members; }
|
||||||
set { SetProperty(ref _members, value); }
|
set { SetProperty(ref _members, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsSelectingHost
|
||||||
|
{
|
||||||
|
get { return _state == PartyState.SelectingHost; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNotSelectingHost
|
||||||
|
{
|
||||||
|
get { return _state != PartyState.SelectingHost; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command JoinCommand { get; set; }
|
||||||
|
public Command HostCommand { get; set; }
|
||||||
|
|
||||||
|
public string Hostname
|
||||||
|
{
|
||||||
|
get { return _hostname; }
|
||||||
|
set { SetProperty(ref _hostname, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Port
|
||||||
|
{
|
||||||
|
get { return _port; }
|
||||||
|
set { SetProperty(ref _port, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Properties
|
||||||
|
|
||||||
|
|
||||||
|
private void State(PartyState state)
|
||||||
|
{
|
||||||
|
_state = state;
|
||||||
|
OnPropertyChanged("IsSelectingHost");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
private void OnJoinExecute()
|
||||||
|
{
|
||||||
|
_executor = BaseExecutor.CreateExecutor<BasePartyExecutor>(ExecutorType.Client) as BasePartyExecutor;
|
||||||
|
State(PartyState.Connecting);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanJoinExecute()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnHostExecute()
|
||||||
|
{
|
||||||
|
_executor = BaseExecutor.CreateExecutor<BasePartyExecutor>(ExecutorType.Server) as BasePartyExecutor;
|
||||||
|
State(PartyState.Connecting);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanHostExecute()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion Commands
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user