Change QSharp to QControlKit

This commit is contained in:
2020-09-07 09:16:26 -05:00
parent 00d47d6787
commit ff869f76cd
8 changed files with 93 additions and 26 deletions
@@ -33,7 +33,7 @@ namespace qController.Dialogs
{ {
QWorkspaceInfo workspace = workspaces[i]; QWorkspaceInfo workspace = workspaces[i];
actionSheetConfig.Add(workspace.displayName, new Action(() => { actionSheetConfig.Add(workspace.displayName, new Action(() => {
Log.Debug("CONTROLPAGE - Workspace Selected " + workspace.displayName); Log.Debug("WorkspacePrompt - Workspace Selected " + workspace.displayName);
if (!workspace.hasPasscode) if (!workspace.hasPasscode)
+28 -12
View File
@@ -20,11 +20,26 @@
GroupDisplayBinding="{Binding name}" GroupDisplayBinding="{Binding name}"
IsGroupingEnabled="True" IsGroupingEnabled="True"
d:IsGroupingEnabled="False" d:IsGroupingEnabled="False"
BackgroundColor="#4A4A4A"
SeparatorVisibility="None"
ItemsSource="{Binding ServersGrouped}"> ItemsSource="{Binding ServersGrouped}">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell Height="25">
<Grid BackgroundColor="#ffffff" VerticalOptions="FillAndExpand">
<Label Text="{Binding GroupName}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<ViewCell> <ViewCell>
<Grid Margin="20,0,0,0"> <Grid Margin="20,0,0,0" BackgroundColor="#D8D8D8">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@@ -33,20 +48,21 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Name}" <Label Grid.Column="0" Text="{Binding Name}"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/> HorizontalTextAlignment="Start"/>
<Label Grid.Column="1" Text="&#xf1184;" <Label Grid.Column="1" Text="&#xf1184;"
FontFamily="{StaticResource MaterialFontFamily}" FontFamily="{StaticResource MaterialFontFamily}"
FontSize="Large" FontSize="Large"
IsVisible="{Binding HasPasscode}" IsVisible="{Binding HasPasscode}"
HorizontalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="End"/> HorizontalTextAlignment="End"/>
</Grid> </Grid>
</ViewCell> </ViewCell>
</DataTemplate> </DataTemplate>
@@ -1,7 +1,6 @@
using QSharp; using QControlKit;
using Xamarin.Forms; using Xamarin.Forms;
using Serilog; using Serilog;
using System.Collections.ObjectModel;
using qController.Cell; using qController.Cell;
using Acr.UserDialogs; using Acr.UserDialogs;
using qController.Dialogs; using qController.Dialogs;
@@ -44,7 +43,30 @@ namespace qController.Pages
QWorkspace selectedWorkspace = (e.SelectedItem as QWorkspaceViewModel).workspace; 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));
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));
}
} }
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using QSharp; using QControlKit;
using qController.ViewModels; using qController.ViewModels;
using Serilog; using Serilog;
using Xamarin.Essentials; using Xamarin.Essentials;
using Xamarin.Forms; using Xamarin.Forms;
using Acr.UserDialogs;
namespace qController namespace qController
{ {
@@ -13,13 +13,27 @@ namespace qController
{ {
private QWorkspace connectedWorkspace; private QWorkspace connectedWorkspace;
private Dictionary<string, Grid> cueGridDict = new Dictionary<string, Grid>(); private Dictionary<string, Grid> cueGridDict = new Dictionary<string, Grid>();
public WorkspacePage(QWorkspace workspace) public WorkspacePage(QWorkspace workspace)
{ {
InitializeComponent(); InitializeComponent();
connectedWorkspace = workspace; connectedWorkspace = workspace;
connectedWorkspace.WorkspaceUpdated += Workspace_WorkspaceUpdated; 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.defaultSendUpdatesOSC = true;
connectedWorkspace.CueListChangedPlaybackPosition += ConnectedWorkspace_CueListChangedPlaybackPosition; connectedWorkspace.CueListChangedPlaybackPosition += ConnectedWorkspace_CueListChangedPlaybackPosition;
} }
@@ -1,4 +1,4 @@
using QSharp; using QControlKit;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -1,4 +1,4 @@
using QSharp; using QControlKit;
using Serilog; using Serilog;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -1,5 +1,4 @@
using qController.Pages; using QControlKit;
using QSharp;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
namespace qController.ViewModels 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) public QServerViewModel(QServer server)
{ {
this.server = server; this.server = server;
@@ -2,7 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using QSharp; using QControlKit;
namespace qController.ViewModels namespace qController.ViewModels
{ {
public class QWorkspaceViewModel public class QWorkspaceViewModel