mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-19 22:24:18 +00:00
Begin work on QBrowserPage
This commit is contained in:
Binary file not shown.
@@ -269,6 +269,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<AndroidAsset Include="Assets\materialdesignicons-webfont.ttf" />
|
||||||
<None Include="Resources\AboutResources.txt" />
|
<None Include="Resources\AboutResources.txt" />
|
||||||
<None Include="Properties\AndroidManifest.xml" />
|
<None Include="Properties\AndroidManifest.xml" />
|
||||||
<None Include="Assets\AboutAssets.txt" />
|
<None Include="Assets\AboutAssets.txt" />
|
||||||
|
|||||||
Binary file not shown.
@@ -16,7 +16,7 @@ namespace qController.Communication
|
|||||||
|
|
||||||
public class WorkspaceEventArgs : EventArgs
|
public class WorkspaceEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public QWorkspace UpdatedWorkspace
|
public QOldWorkspace UpdatedWorkspace
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace qController.Communication
|
|||||||
|
|
||||||
public QUpdater qUpdater;
|
public QUpdater qUpdater;
|
||||||
public QClient qClient;
|
public QClient qClient;
|
||||||
public QWorkspace qWorkspace;
|
public QOldWorkspace qWorkspace;
|
||||||
public string playbackPosition;
|
public string playbackPosition;
|
||||||
private string ipAddress;
|
private string ipAddress;
|
||||||
private int port;
|
private int port;
|
||||||
@@ -29,19 +29,19 @@ namespace qController.Communication
|
|||||||
public void Connect(string workspace_id)
|
public void Connect(string workspace_id)
|
||||||
{
|
{
|
||||||
Log.Debug($"QCONTROLLER - Connect Called: {workspace_id}");
|
Log.Debug($"QCONTROLLER - Connect Called: {workspace_id}");
|
||||||
qWorkspace = new QWorkspace(workspace_id);
|
qWorkspace = new QOldWorkspace(workspace_id);
|
||||||
qClient.sendTCP("/workspace/"+workspace_id+"/connect");
|
qClient.sendTCP("/workspace/"+workspace_id+"/connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Connect(string workspace_id, string passcode)
|
public void Connect(string workspace_id, string passcode)
|
||||||
{
|
{
|
||||||
Log.Debug($"QCONTROLLER - Connect with Passcode Called: {workspace_id}:{passcode}");
|
Log.Debug($"QCONTROLLER - Connect with Passcode Called: {workspace_id}:{passcode}");
|
||||||
qWorkspace = new QWorkspace(workspace_id);
|
qWorkspace = new QOldWorkspace(workspace_id);
|
||||||
qClient.sendTCP("/workspace/" + workspace_id + "/connect", passcode);
|
qClient.sendTCP("/workspace/" + workspace_id + "/connect", passcode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Connect(QWorkspace workspace)
|
public void Connect(QOldWorkspace workspace)
|
||||||
{
|
{
|
||||||
if(workspace.passcode != null)
|
if(workspace.passcode != null)
|
||||||
Connect(workspace.workspace_id, workspace.passcode);
|
Connect(workspace.workspace_id, workspace.passcode);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace qController.Communication
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
QWorkspace workspace = JsonConvert.DeserializeObject<QWorkspace>(msg.Arguments[0].ToString());
|
QOldWorkspace workspace = JsonConvert.DeserializeObject<QOldWorkspace>(msg.Arguments[0].ToString());
|
||||||
OnWorkspaceUpdated(workspace);
|
OnWorkspaceUpdated(workspace);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -141,7 +141,7 @@ namespace qController.Communication
|
|||||||
return json.GetValue("data");
|
return json.GetValue("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnWorkspaceUpdated(QWorkspace workspace)
|
protected virtual void OnWorkspaceUpdated(QOldWorkspace workspace)
|
||||||
{
|
{
|
||||||
WorkspaceUpdated?.Invoke(this, new WorkspaceEventArgs() { UpdatedWorkspace = workspace });
|
WorkspaceUpdated?.Invoke(this, new WorkspaceEventArgs() { UpdatedWorkspace = workspace });
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ namespace qController.Communication
|
|||||||
}
|
}
|
||||||
protected virtual void OnWorkspaceLoadError(string id)
|
protected virtual void OnWorkspaceLoadError(string id)
|
||||||
{
|
{
|
||||||
WorkspaceLoadError?.Invoke(this, new WorkspaceEventArgs { UpdatedWorkspace = new QWorkspace(id) });
|
WorkspaceLoadError?.Invoke(this, new WorkspaceEventArgs { UpdatedWorkspace = new QOldWorkspace(id) });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace qController.Dialogs
|
|||||||
{
|
{
|
||||||
public class WorkspacePromptArgs : EventArgs
|
public class WorkspacePromptArgs : EventArgs
|
||||||
{
|
{
|
||||||
public QWorkspace SelectedWorkspace
|
public QOldWorkspace SelectedWorkspace
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
@@ -38,7 +38,7 @@ namespace qController.Dialogs
|
|||||||
|
|
||||||
if (!workspace.hasPasscode)
|
if (!workspace.hasPasscode)
|
||||||
{
|
{
|
||||||
OnWorkspaceSelected(new QWorkspace(workspace.uniqueID));
|
OnWorkspaceSelected(new QOldWorkspace(workspace.uniqueID));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -64,7 +64,7 @@ namespace qController.Dialogs
|
|||||||
{
|
{
|
||||||
if (resp.Ok)
|
if (resp.Ok)
|
||||||
{
|
{
|
||||||
OnWorkspaceSelected(new QWorkspace(workspace_id,resp.Value));
|
OnWorkspaceSelected(new QOldWorkspace(workspace_id,resp.Value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ namespace qController.Dialogs
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnWorkspaceSelected(QWorkspace workspace)
|
protected virtual void OnWorkspaceSelected(QOldWorkspace workspace)
|
||||||
{
|
{
|
||||||
if (WorkspaceSelected != null)
|
if (WorkspaceSelected != null)
|
||||||
WorkspaceSelected(this, new WorkspacePromptArgs() { SelectedWorkspace = workspace });
|
WorkspaceSelected(this, new WorkspacePromptArgs() { SelectedWorkspace = workspace });
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Serilog;
|
|||||||
|
|
||||||
namespace qController.QItems
|
namespace qController.QItems
|
||||||
{
|
{
|
||||||
public class QWorkspace
|
public class QOldWorkspace
|
||||||
{
|
{
|
||||||
public string status { get; set; }
|
public string status { get; set; }
|
||||||
public List<QCueList> data { get; set; }
|
public List<QCueList> data { get; set; }
|
||||||
@@ -15,18 +15,18 @@ namespace qController.QItems
|
|||||||
public string passcode { get; set; }
|
public string passcode { get; set; }
|
||||||
|
|
||||||
//ONLY FOR PASSING A WORKSPACE LOAD ERROR
|
//ONLY FOR PASSING A WORKSPACE LOAD ERROR
|
||||||
public QWorkspace(string id)
|
public QOldWorkspace(string id)
|
||||||
{
|
{
|
||||||
workspace_id = id;
|
workspace_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QWorkspace(string id, string passcode)
|
public QOldWorkspace(string id, string passcode)
|
||||||
{
|
{
|
||||||
workspace_id = id;
|
workspace_id = id;
|
||||||
this.passcode = passcode;
|
this.passcode = passcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QWorkspace()
|
public QOldWorkspace()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,5 +6,10 @@
|
|||||||
<On Platform="Android" Value="qfont.ttf#qfont" />
|
<On Platform="Android" Value="qfont.ttf#qfont" />
|
||||||
<On Platform="iOS" Value="qfont" />
|
<On Platform="iOS" Value="qfont" />
|
||||||
</OnPlatform>
|
</OnPlatform>
|
||||||
</Application.Resources>
|
|
||||||
|
<OnPlatform x:Key="MaterialFontFamily" x:TypeArguments="x:String">
|
||||||
|
<On Platform="iOS" Value="Material Design Icons" />
|
||||||
|
<On Platform="Android" Value="materialdesignicons-webfont.ttf#Material Design Icons" />
|
||||||
|
</OnPlatform>
|
||||||
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace qController
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
public void ChangeToWorkspace(QWorkspace workspace)
|
public void ChangeToWorkspace(QOldWorkspace workspace)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < workspace.data.Count; i++)
|
for(int i = 0; i < workspace.data.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,19 +16,33 @@
|
|||||||
|
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
||||||
<ListView x:Name="serverListView" GroupDisplayBinding="{Binding name}" IsGroupingEnabled="True">
|
<ListView x:Name="serverListView"
|
||||||
|
GroupDisplayBinding="{Binding name}"
|
||||||
|
IsGroupingEnabled="True"
|
||||||
|
d:IsGroupingEnabled="False"
|
||||||
|
ItemsSource="{Binding ServersGrouped}">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ViewCell>
|
<ViewCell>
|
||||||
<Grid BackgroundColor="Blue">
|
<Grid Margin="20,0,0,0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Label Text="{Binding name}"
|
<Label Grid.Column="0" Text="{Binding Name}"
|
||||||
|
HorizontalOptions="FillAndExpand"
|
||||||
|
VerticalOptions="FillAndExpand"
|
||||||
|
VerticalTextAlignment="Center"
|
||||||
|
HorizontalTextAlignment="Start"/>
|
||||||
|
|
||||||
|
<Label Grid.Column="1" Text="󱆄"
|
||||||
|
FontFamily="{StaticResource MaterialFontFamily}"
|
||||||
|
FontSize="Large"
|
||||||
|
IsVisible="{Binding HasPasscode}"
|
||||||
HorizontalOptions="FillAndExpand"
|
HorizontalOptions="FillAndExpand"
|
||||||
VerticalOptions="FillAndExpand"
|
VerticalOptions="FillAndExpand"
|
||||||
VerticalTextAlignment="Center"
|
VerticalTextAlignment="Center"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using QSharp;
|
using QSharp;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -8,21 +7,23 @@ using Acr.UserDialogs;
|
|||||||
using qController.Dialogs;
|
using qController.Dialogs;
|
||||||
using Xamarin.Essentials;
|
using Xamarin.Essentials;
|
||||||
using System;
|
using System;
|
||||||
|
using qController.ViewModels;
|
||||||
|
|
||||||
namespace qController.Pages
|
namespace qController.Pages
|
||||||
{
|
{
|
||||||
public partial class QBrowserPage : ContentPage
|
public partial class QBrowserPage : ContentPage
|
||||||
{
|
{
|
||||||
public ObservableCollection<ServerGroup> servers = new ObservableCollection<ServerGroup>();
|
|
||||||
public QBrowserPage()
|
public QBrowserPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
App.rootPage.MenuItemSelected += OnMenuItemSelected;
|
App.rootPage.MenuItemSelected += OnMenuItemSelected;
|
||||||
|
|
||||||
serverListView.ItemsSource = servers;
|
serverListView.BindingContext = new QBrowserViewModel(new QBrowser());
|
||||||
QBrowser browser = new QBrowser();
|
|
||||||
browser.ServerUpdatedWorkspaces += Browser_ServerUpdatedWorkspaces;
|
|
||||||
serverListView.ItemSelected += ServerListView_ItemSelected;
|
serverListView.ItemSelected += QWorkspaceSelected;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
storageListView.ItemsSource = QStorage.qInstances;
|
storageListView.ItemsSource = QStorage.qInstances;
|
||||||
storageListView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
|
storageListView.ItemTemplate = new DataTemplate(typeof(QInstanceCell));
|
||||||
@@ -36,25 +37,17 @@ namespace qController.Pages
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async void ServerListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
async void QWorkspaceSelected(object sender, SelectedItemChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.SelectedItem == null)
|
if (e.SelectedItem == null)
|
||||||
return;
|
return;
|
||||||
QWorkspace selectedWorkspace = e.SelectedItem as QWorkspace;
|
QWorkspace selectedWorkspace = (e.SelectedItem as QWorkspaceViewModel).workspace;
|
||||||
Log.Debug($"[demo] workspace: {selectedWorkspace.nameWithoutPathExtension} has been selected");
|
Log.Debug($"[demo] workspace: {selectedWorkspace.nameWithoutPathExtension} has been selected");
|
||||||
((ListView)sender).SelectedItem = null;
|
((ListView)sender).SelectedItem = null;
|
||||||
await Navigation.PushAsync(new WorkspacePage(selectedWorkspace));
|
await Navigation.PushAsync(new WorkspacePage(selectedWorkspace));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Browser_ServerUpdatedWorkspaces(object source, QServerUpdatedArgs args)
|
|
||||||
{
|
|
||||||
ServerGroup serverGroup = new ServerGroup(args.server.name);
|
|
||||||
serverGroup.AddRange(args.server.workspaces);
|
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
|
||||||
{
|
|
||||||
servers.Add(serverGroup);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AddWorkspace()
|
void AddWorkspace()
|
||||||
@@ -79,12 +72,5 @@ namespace qController.Pages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ServerGroup : List<QWorkspace>
|
|
||||||
{
|
|
||||||
public string name { get; set; }
|
|
||||||
public ServerGroup(string name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using QSharp;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace qController.ViewModels
|
||||||
|
{
|
||||||
|
public class QBrowserViewModel : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
QBrowser browser;
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
public ObservableCollection<QServerViewModel> ServersGrouped { get; set; }
|
||||||
|
public QBrowserViewModel(QBrowser browser)
|
||||||
|
{
|
||||||
|
this.browser = browser;
|
||||||
|
ServersGrouped = new ObservableCollection<QServerViewModel>();
|
||||||
|
|
||||||
|
this.browser.ServerFound += OnServerFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnServerFound(object source, QServerFoundArgs args)
|
||||||
|
{
|
||||||
|
ServersGrouped.Add(new QServerViewModel(args.server));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnPropertyChanged([CallerMemberName] string name = "")
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using qController.Pages;
|
||||||
|
using QSharp;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace qController.ViewModels
|
||||||
|
{
|
||||||
|
public class QServerViewModel : ObservableCollection<QWorkspaceViewModel>
|
||||||
|
{
|
||||||
|
QServer server;
|
||||||
|
public string name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return server.name;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
server.name = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public QServerViewModel(QServer server)
|
||||||
|
{
|
||||||
|
this.server = server;
|
||||||
|
name = this.server.name;
|
||||||
|
foreach (var workspace in this.server.workspaces)
|
||||||
|
{
|
||||||
|
this.Add(new QWorkspaceViewModel(workspace));
|
||||||
|
}
|
||||||
|
this.server.ServerUpdated += OnServerUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnServerUpdated(object source, QServerUpdatedArgs args)
|
||||||
|
{
|
||||||
|
foreach (var workspace in this.server.workspaces)
|
||||||
|
{
|
||||||
|
QWorkspaceViewModel workspaceViewModel = new QWorkspaceViewModel(workspace);
|
||||||
|
if (!Contains(workspaceViewModel))
|
||||||
|
Add(workspaceViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using qController.QItems;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using QSharp;
|
||||||
|
namespace qController.ViewModels
|
||||||
|
{
|
||||||
|
public class QWorkspaceViewModel
|
||||||
|
{
|
||||||
|
public QWorkspace workspace;
|
||||||
|
public QWorkspaceViewModel(QWorkspace workspace)
|
||||||
|
{
|
||||||
|
this.workspace = workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return workspace.name;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasPasscode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return workspace.hasPasscode;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user