mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-05 07:27:56 +00:00
31a10d9b16
* QWorkspaceInfo.cs: * QParser.cs: * WorkspacePrompt.cs: * QEventArgs.cs: Remove redundant QWorkspaceInfo class * QRecentWorkspaceInfo.cs: Add bundle info class for recent workspace info * ControlPage.xaml.cs: * QBrowserPage.xaml.cs: * QButton.cs: * qConnectionPage.xaml.cs: * QLevelsCell.cs: * QCueListCell.cs: * QInstanceCell.cs: * QControlsBlock.cs: * ShadowButton.cs: * QLevelsButton.cs: * QSelectedCueCell.cs: Move Cells classess under UI * AppDelegate.cs: * packages.config: * MainActivity.cs: * packages.config: * qController.iOS.csproj: * qController.Droid.csproj: * qController.csproj: Update dependencies * App.xaml.cs: Add AppAction code for recent workspace * QStorage.cs: Add recent workspace to persistent storage * QCueGrid.cs: Start on interactivity with cue list grid * QCueViewModel.cs: debug for children updated start on reactive QCueGrid * WorkspacePage.xaml.cs: Start handling a "no selected cue" state and recent workspace * QInstance.cs: * IPHelper.cs: move reachable check to IPHelper - TODO: implement
89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Acr.UserDialogs;
|
|
using qController.QItems;
|
|
using Serilog;
|
|
using QControlKit;
|
|
|
|
namespace qController.Dialogs
|
|
{
|
|
public class WorkspacePromptArgs : EventArgs
|
|
{
|
|
public QOldWorkspace SelectedWorkspace
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
}
|
|
|
|
public class WorkspacePrompt
|
|
{
|
|
public delegate void WorkspaceSelectedHandler(object source, WorkspacePromptArgs args);
|
|
public event WorkspaceSelectedHandler WorkspaceSelected;
|
|
|
|
public WorkspacePrompt()
|
|
{
|
|
|
|
}
|
|
|
|
public ActionSheetConfig getActionSheetConfigForWorkspaces(List<QWorkspaceInfo> workspaces)
|
|
{
|
|
ActionSheetConfig actionSheetConfig = new ActionSheetConfig();
|
|
actionSheetConfig.SetTitle("Select Workspace");
|
|
for (int i = 0; i < workspaces.Count; i++)
|
|
{
|
|
QWorkspaceInfo workspace = workspaces[i];
|
|
actionSheetConfig.Add(workspace.displayName, new Action(() => {
|
|
Log.Debug("WorkspacePrompt - Workspace Selected " + workspace.displayName);
|
|
|
|
|
|
if (!workspace.hasPasscode)
|
|
{
|
|
OnWorkspaceSelected(new QOldWorkspace(workspace.uniqueID));
|
|
}
|
|
else
|
|
{
|
|
promptWorkspacePasscode(workspace.uniqueID);
|
|
}
|
|
}));
|
|
}
|
|
return actionSheetConfig;
|
|
}
|
|
|
|
|
|
|
|
public void promptWorkspacePasscode(string workspace_id)
|
|
{
|
|
UserDialogs.Instance.Prompt(new PromptConfig
|
|
{
|
|
InputType = InputType.Number,
|
|
MaxLength = 4,
|
|
Title = "Enter Workspace Passcode",
|
|
OkText = "Connect",
|
|
IsCancellable = true,
|
|
OnAction = (resp) =>
|
|
{
|
|
if (resp.Ok)
|
|
{
|
|
OnWorkspaceSelected(new QOldWorkspace(workspace_id,resp.Value));
|
|
}
|
|
else
|
|
{
|
|
OnWorkspaceSelected(null);
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
protected virtual void OnWorkspaceSelected(QOldWorkspace workspace)
|
|
{
|
|
if (WorkspaceSelected != null)
|
|
WorkspaceSelected(this, new WorkspacePromptArgs() { SelectedWorkspace = workspace });
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|