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

@ -8,6 +8,7 @@ using Aurora.Frontend.Views.Artists;
using Aurora.Frontend.Views.Songs;
using Aurora.Frontend.Views.Stations;
using Aurora.Frontend.Views.Party;
using Aurora.Frontend.Views.Profile;
namespace Aurora.Frontend.Views.MainView
{
@ -32,7 +33,7 @@ namespace Aurora.Frontend.Views.MainView
_pages = new ObservableCollection<NavigationItem>(new[]
{
new NavigationItem { Id = 4, Title = "Party", Group="Social", TargetType = typeof(PartyView)},
new NavigationItem { Id = 5, Title = "Profile", Group="Social", TargetType = typeof(ArtistsView)},
new NavigationItem { Id = 5, Title = "Profile", Group="Social", TargetType = typeof(ProfileView)},
new NavigationItem { Id = 0, Title = "Songs", Group="Library", TargetType = typeof(SongsView) },
new NavigationItem { Id = 1, Title = "Artists", Group="Library", TargetType = typeof(ArtistsView)},
new NavigationItem { Id = 2, Title = "Albums", Group="Library", TargetType = typeof(AlbumsView)},

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);
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Aurora.Frontend.Views.Profile.ProfileView">
<ContentView.Content>
<Label Text="This is a profile"/>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace Aurora.Frontend.Views.Profile
{
public partial class ProfileView : ContentView
{
public ProfileView()
{
InitializeComponent();
BindingContext = new ProfileViewModel();
}
}
}

View File

@ -0,0 +1,10 @@
using System;
namespace Aurora.Frontend.Views.Profile
{
public class ProfileViewModel
{
public ProfileViewModel()
{
}
}
}