Refactored to only having one executor per platform

This commit is contained in:
watsonb8
2019-07-05 11:37:44 -04:00
parent 0cb0546741
commit a01d399a1f
18 changed files with 226 additions and 170 deletions

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.ObjectModel;
using Aurora.Backend.Executors;
using Aurora.Frontend.Components.HostSelector;
using Aurora.Backend.Services;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Party
@ -19,7 +20,7 @@ namespace Aurora.Frontend.Views.Party
private PartyState _state;
private BasePartyExecutor _executor;
private BaseExecutor _executor;
private string _hostname;
@ -91,7 +92,9 @@ namespace Aurora.Frontend.Views.Party
#region Commands
private void OnJoinExecute()
{
_executor = BaseExecutor.CreateExecutor<BasePartyExecutor>(ExecutorType.Client) as BasePartyExecutor;
_executor = BaseExecutor.CreateExecutor<ClientExecutor>();
Int32.TryParse(this.Port, out int intPort);
_executor.Initialize();
State(PartyState.Connecting);
}
@ -102,7 +105,19 @@ namespace Aurora.Frontend.Views.Party
private void OnHostExecute()
{
_executor = BaseExecutor.CreateExecutor<BasePartyExecutor>(ExecutorType.Server) as BasePartyExecutor;
Int32.TryParse(this.Port, out int intPort);
//Init gRPC server
ServerService.Instance.Initialize(this.Hostname, intPort);
//Instantiate and initialize all executors
_executor = BaseExecutor.CreateExecutor<HostExecutor>();
_executor.Initialize();
//start gRPC server
ServerService.Instance.Start();
//Change state
State(PartyState.Connecting);
}