Progress
This commit is contained in:
@ -7,23 +7,30 @@
|
||||
xmlns:qu="clr-namespace:Aurora.Frontend.Components.Queue"
|
||||
x:Class="Aurora.Frontend.Views.Party.PartyView">
|
||||
<ContentView.Content>
|
||||
<AbsoluteLayout
|
||||
VerticalOptions="FillAndExpand"
|
||||
HorizontalOptions="FillAndExpand">
|
||||
<StackLayout>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackLayout
|
||||
Grid.Row="0"
|
||||
IsVisible="{Binding IsNotSelectingHost}">
|
||||
<Label
|
||||
Text="Party Members"/>
|
||||
<ml:MemberList
|
||||
VerticalOptions="FillAndExpand"
|
||||
Members="{Binding Members}"/>
|
||||
<Label
|
||||
Text="Queue"/>
|
||||
Text="Queue"/>
|
||||
<qu:Queue/>
|
||||
</StackLayout>
|
||||
<hs:HostSelector
|
||||
AbsoluteLayout.LayoutFlags="All"
|
||||
AbsoluteLayout.LayoutBounds="0.5,0.5,0.7,0.7"
|
||||
BackgroundColor="Green"
|
||||
IsVisible="False"/>
|
||||
</AbsoluteLayout>
|
||||
Grid.Row="0"
|
||||
Hostname="{Binding Hostname}"
|
||||
Port="{Binding Port}"
|
||||
HostCommand="{Binding HostCommand}"
|
||||
JoinCommand="{Binding JoinCommand}"
|
||||
IsVisible="{Binding IsSelectingHost}"/>
|
||||
|
||||
</Grid>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Views.Party
|
||||
|
@ -1,11 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using Aurora.Backend.Executors;
|
||||
using Aurora.Frontend.Components.HostSelector;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Views.Party
|
||||
{
|
||||
enum PartyState
|
||||
{
|
||||
SelectingHost,
|
||||
InParty,
|
||||
Connecting,
|
||||
}
|
||||
|
||||
public class PartyViewModel : BaseViewModel
|
||||
{
|
||||
private ObservableCollection<string> _members;
|
||||
|
||||
private PartyState _state;
|
||||
|
||||
private BasePartyExecutor _executor;
|
||||
|
||||
private string _hostname;
|
||||
|
||||
private string _port;
|
||||
|
||||
|
||||
public PartyViewModel()
|
||||
{
|
||||
_members = new ObservableCollection<string>()
|
||||
@ -20,12 +40,79 @@ namespace Aurora.Frontend.Views.Party
|
||||
"Spencer",
|
||||
};
|
||||
OnPropertyChanged("Members");
|
||||
|
||||
this.JoinCommand = new Command(OnJoinExecute, CanJoinExecute);
|
||||
this.HostCommand = new Command(OnHostExecute, CanHostExecute);
|
||||
|
||||
State(PartyState.SelectingHost);
|
||||
}
|
||||
#region Properties
|
||||
|
||||
public ObservableCollection<string> Members
|
||||
{
|
||||
get { return _members; }
|
||||
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