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];
actionSheetConfig.Add(workspace.displayName, new Action(() => {
Log.Debug("CONTROLPAGE - Workspace Selected " + workspace.displayName);
Log.Debug("WorkspacePrompt - Workspace Selected " + workspace.displayName);
if (!workspace.hasPasscode)
+29 -13
View File
@@ -20,11 +20,26 @@
GroupDisplayBinding="{Binding name}"
IsGroupingEnabled="True"
d:IsGroupingEnabled="False"
BackgroundColor="#4A4A4A"
SeparatorVisibility="None"
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>
<DataTemplate>
<ViewCell>
<Grid Margin="20,0,0,0">
<Grid Margin="20,0,0,0" BackgroundColor="#D8D8D8">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
@@ -32,21 +47,22 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Name}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Start"/>
<Label Grid.Column="1" Text="&#xf1184;"
FontFamily="{StaticResource MaterialFontFamily}"
FontSize="Large"
IsVisible="{Binding HasPasscode}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"/>
FontFamily="{StaticResource MaterialFontFamily}"
FontSize="Large"
IsVisible="{Binding HasPasscode}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
HorizontalTextAlignment="End"/>
</Grid>
</ViewCell>
</DataTemplate>
@@ -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));
}
}
@@ -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<string, Grid> cueGridDict = new Dictionary<string, Grid>();
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;
}
@@ -1,4 +1,4 @@
using QSharp;
using QControlKit;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
@@ -1,4 +1,4 @@
using QSharp;
using QControlKit;
using Serilog;
using System.ComponentModel;
using System.Runtime.CompilerServices;
@@ -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;
@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using QSharp;
using QControlKit;
namespace qController.ViewModels
{
public class QWorkspaceViewModel