From ff869f76cdb002117ac6e5885becdd560c20df09 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Mon, 7 Sep 2020 09:16:26 -0500 Subject: [PATCH] Change QSharp to QControlKit --- .../Classes/Dialogs/WorkspacePrompt.cs | 2 +- qController.Standard/Pages/QBrowserPage.xaml | 42 +++++++++++++------ .../Pages/QBrowserPage.xaml.cs | 28 +++++++++++-- .../Pages/WorkspacePage.xaml.cs | 22 ++++++++-- .../ViewModels/QBrowserViewModel.cs | 2 +- .../ViewModels/QCueViewModel.cs | 2 +- .../ViewModels/QServerViewModel.cs | 19 ++++++++- .../ViewModels/QWorkspaceViewModel.cs | 2 +- 8 files changed, 93 insertions(+), 26 deletions(-) diff --git a/qController.Standard/Classes/Dialogs/WorkspacePrompt.cs b/qController.Standard/Classes/Dialogs/WorkspacePrompt.cs index 782d16a..2d3ceb2 100644 --- a/qController.Standard/Classes/Dialogs/WorkspacePrompt.cs +++ b/qController.Standard/Classes/Dialogs/WorkspacePrompt.cs @@ -33,7 +33,7 @@ namespace qController.Dialogs { QWorkspaceInfo workspace = workspaces[i]; actionSheetConfig.Add(workspace.displayName, new Action(() => { - Log.Debug("CONTROLPAGE - Workspace Selected " + workspace.displayName); + Log.Debug("WorkspacePrompt - Workspace Selected " + workspace.displayName); if (!workspace.hasPasscode) diff --git a/qController.Standard/Pages/QBrowserPage.xaml b/qController.Standard/Pages/QBrowserPage.xaml index 770ea63..a65c679 100644 --- a/qController.Standard/Pages/QBrowserPage.xaml +++ b/qController.Standard/Pages/QBrowserPage.xaml @@ -20,11 +20,26 @@ GroupDisplayBinding="{Binding name}" IsGroupingEnabled="True" d:IsGroupingEnabled="False" + BackgroundColor="#4A4A4A" + SeparatorVisibility="None" ItemsSource="{Binding ServersGrouped}"> + + + + + + + + - + @@ -32,21 +47,22 @@ - + + diff --git a/qController.Standard/Pages/QBrowserPage.xaml.cs b/qController.Standard/Pages/QBrowserPage.xaml.cs index 0f513c8..fd010c7 100644 --- a/qController.Standard/Pages/QBrowserPage.xaml.cs +++ b/qController.Standard/Pages/QBrowserPage.xaml.cs @@ -1,7 +1,6 @@ -using QSharp; +using QControlKit; using Xamarin.Forms; using Serilog; -using System.Collections.ObjectModel; using qController.Cell; using Acr.UserDialogs; using qController.Dialogs; @@ -44,7 +43,30 @@ namespace qController.Pages QWorkspace selectedWorkspace = (e.SelectedItem as QWorkspaceViewModel).workspace; Log.Debug($"[demo] workspace: {selectedWorkspace.nameWithoutPathExtension} has been selected"); ((ListView)sender).SelectedItem = null; - await Navigation.PushAsync(new WorkspacePage(selectedWorkspace)); + + if (selectedWorkspace.hasPasscode) + { + UserDialogs.Instance.Prompt(new PromptConfig + { + InputType = InputType.Number, + MaxLength = 4, + Title = "Workspace Requires Passcode", + OkText = "Connect", + IsCancellable = true, + OnAction = async (resp) => + { + if (resp.Ok) + { + await Navigation.PushAsync(new WorkspacePage(selectedWorkspace, resp.Value)); + } + } + + }); + } + else + { + await Navigation.PushAsync(new WorkspacePage(selectedWorkspace)); + } } diff --git a/qController.Standard/Pages/WorkspacePage.xaml.cs b/qController.Standard/Pages/WorkspacePage.xaml.cs index 21c1b31..f815440 100644 --- a/qController.Standard/Pages/WorkspacePage.xaml.cs +++ b/qController.Standard/Pages/WorkspacePage.xaml.cs @@ -1,11 +1,11 @@ - -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; -using QSharp; +using QControlKit; using qController.ViewModels; using Serilog; using Xamarin.Essentials; using Xamarin.Forms; +using Acr.UserDialogs; namespace qController { @@ -13,13 +13,27 @@ namespace qController { private QWorkspace connectedWorkspace; private Dictionary cueGridDict = new Dictionary(); + public WorkspacePage(QWorkspace workspace) { InitializeComponent(); connectedWorkspace = workspace; connectedWorkspace.WorkspaceUpdated += Workspace_WorkspaceUpdated; - connectedWorkspace.connectWithPasscode("1234"); + + connectedWorkspace.defaultSendUpdatesOSC = true; + connectedWorkspace.CueListChangedPlaybackPosition += ConnectedWorkspace_CueListChangedPlaybackPosition; + } + + public WorkspacePage(QWorkspace workspace, string passcode) + { + InitializeComponent(); + + connectedWorkspace = workspace; + connectedWorkspace.WorkspaceUpdated += Workspace_WorkspaceUpdated; + connectedWorkspace.connectWithPasscode(passcode); + + connectedWorkspace.defaultSendUpdatesOSC = true; connectedWorkspace.CueListChangedPlaybackPosition += ConnectedWorkspace_CueListChangedPlaybackPosition; } diff --git a/qController.Standard/ViewModels/QBrowserViewModel.cs b/qController.Standard/ViewModels/QBrowserViewModel.cs index 3330874..35611ba 100644 --- a/qController.Standard/ViewModels/QBrowserViewModel.cs +++ b/qController.Standard/ViewModels/QBrowserViewModel.cs @@ -1,4 +1,4 @@ -using QSharp; +using QControlKit; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; diff --git a/qController.Standard/ViewModels/QCueViewModel.cs b/qController.Standard/ViewModels/QCueViewModel.cs index b338bae..26164ad 100644 --- a/qController.Standard/ViewModels/QCueViewModel.cs +++ b/qController.Standard/ViewModels/QCueViewModel.cs @@ -1,4 +1,4 @@ -using QSharp; +using QControlKit; using Serilog; using System.ComponentModel; using System.Runtime.CompilerServices; diff --git a/qController.Standard/ViewModels/QServerViewModel.cs b/qController.Standard/ViewModels/QServerViewModel.cs index cb52b1d..0711ef6 100644 --- a/qController.Standard/ViewModels/QServerViewModel.cs +++ b/qController.Standard/ViewModels/QServerViewModel.cs @@ -1,5 +1,4 @@ -using qController.Pages; -using QSharp; +using QControlKit; using System.Collections.ObjectModel; namespace qController.ViewModels @@ -19,6 +18,22 @@ namespace qController.ViewModels } } + public string host + { + get + { + return server.host; + } + } + + public string GroupName + { + get + { + return $"{name} ({host})"; + } + } + public QServerViewModel(QServer server) { this.server = server; diff --git a/qController.Standard/ViewModels/QWorkspaceViewModel.cs b/qController.Standard/ViewModels/QWorkspaceViewModel.cs index 56d16d2..aac4d88 100644 --- a/qController.Standard/ViewModels/QWorkspaceViewModel.cs +++ b/qController.Standard/ViewModels/QWorkspaceViewModel.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; -using QSharp; +using QControlKit; namespace qController.ViewModels { public class QWorkspaceViewModel