mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-31 11:59:17 +00:00
Move More Dialog Configs to their own file
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
using Acr.UserDialogs;
|
||||||
|
using qController.Communication;
|
||||||
|
|
||||||
|
namespace qController.Dialogs
|
||||||
|
{
|
||||||
|
public class AddInstancePrompt : PromptConfig
|
||||||
|
{
|
||||||
|
public AddInstancePrompt()
|
||||||
|
{
|
||||||
|
|
||||||
|
Title = "Enter IP of QLab Computer";
|
||||||
|
Message = "Enter an IP Address to save";
|
||||||
|
OkText = "Next";
|
||||||
|
OnTextChanged = args =>
|
||||||
|
{
|
||||||
|
//IPAddress ugh
|
||||||
|
args.IsValid = IPHelper.IsValidAddress(args.Value);
|
||||||
|
};
|
||||||
|
OnAction = (qAddress) =>
|
||||||
|
{
|
||||||
|
if (!qAddress.Ok)
|
||||||
|
return;
|
||||||
|
|
||||||
|
UserDialogs.Instance.Prompt(new PromptConfig
|
||||||
|
{
|
||||||
|
Title = "Enter Name",
|
||||||
|
Message = "Enter a Name for " + qAddress.Text,
|
||||||
|
OkText = "Save",
|
||||||
|
OnAction = (qName) => {
|
||||||
|
if (!qName.Ok)
|
||||||
|
return;
|
||||||
|
QStorage.AddInstance(qName.Text, qAddress.Text);
|
||||||
|
App.showToast("Manual Workspace Added!");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using Acr.UserDialogs;
|
||||||
|
using Xamarin.Essentials;
|
||||||
|
|
||||||
|
namespace qController.Dialogs
|
||||||
|
{
|
||||||
|
public class DonatePrompt : ConfirmConfig
|
||||||
|
{
|
||||||
|
public DonatePrompt()
|
||||||
|
{
|
||||||
|
|
||||||
|
Title = "Support the Project";
|
||||||
|
Message = "This application will never be a paid app or contain any sort of ads, but if you choose to show your support you may do so by clicking the Donate button below. Thank you!";
|
||||||
|
OkText = "Donate";
|
||||||
|
OnAction = (response) =>
|
||||||
|
{
|
||||||
|
if (response)
|
||||||
|
Launcher.OpenAsync(new Uri("https://linktr.ee/JoelWetzell"));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,10 +5,11 @@ namespace qController.Dialogs
|
|||||||
{
|
{
|
||||||
public class NoWorkspacesConfig : ConfirmConfig
|
public class NoWorkspacesConfig : ConfirmConfig
|
||||||
{
|
{
|
||||||
public NoWorkspacesConfig()
|
public NoWorkspacesConfig(Action<bool> action)
|
||||||
{
|
{
|
||||||
Message = "QLab doesn't have any workspaces open?";
|
Message = "QLab doesn't have any workspaces open?";
|
||||||
OkText = "Disconnect";
|
OkText = "Disconnect";
|
||||||
|
OnAction = action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,13 +95,7 @@ namespace qController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NoWorkspacesConfig noWorkspacesConfig = new NoWorkspacesConfig();
|
NoWorkspacesConfig noWorkspacesConfig = new NoWorkspacesConfig(NoWorkspaceDetected);
|
||||||
noWorkspacesConfig.OnAction = (resp) =>
|
|
||||||
{
|
|
||||||
if (resp)
|
|
||||||
Back();
|
|
||||||
};
|
|
||||||
|
|
||||||
UserDialogs.Instance.Confirm(noWorkspacesConfig);
|
UserDialogs.Instance.Confirm(noWorkspacesConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,6 +231,11 @@ namespace qController
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NoWorkspaceDetected(bool resp)
|
||||||
|
{
|
||||||
|
if (resp)
|
||||||
|
Back();
|
||||||
|
}
|
||||||
public void WorkspaceDisconnected(object sender, EventArgs e)
|
public void WorkspaceDisconnected(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Back();
|
Back();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Zeroconf;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using qController.QItems;
|
using qController.QItems;
|
||||||
using qController.Communication;
|
using qController.Dialogs;
|
||||||
using qController.Cell;
|
using qController.Cell;
|
||||||
using Xamarin.Essentials;
|
using Xamarin.Essentials;
|
||||||
|
|
||||||
@@ -37,17 +37,7 @@ namespace qController
|
|||||||
}
|
}
|
||||||
else if(args.Command == "support")
|
else if(args.Command == "support")
|
||||||
{
|
{
|
||||||
UserDialogs.Instance.Confirm(new ConfirmConfig
|
UserDialogs.Instance.Confirm(new DonatePrompt());
|
||||||
{
|
|
||||||
Title = "Support the Project",
|
|
||||||
Message = "This application will never be a paid app or contain any sort of ads, but if you choose to show your support you may do so by clicking the Donate button below. Thank you!",
|
|
||||||
OkText = "Donate",
|
|
||||||
OnAction = (response) =>
|
|
||||||
{
|
|
||||||
if (response)
|
|
||||||
Launcher.OpenAsync(new Uri("https://linktr.ee/JoelWetzell"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,37 +81,7 @@ namespace qController
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddWorkspace(){
|
void AddWorkspace(){
|
||||||
|
UserDialogs.Instance.Prompt(new AddInstancePrompt());
|
||||||
UserDialogs.Instance.Prompt(new PromptConfig
|
|
||||||
{
|
|
||||||
Title = "Enter IP of QLab Computer",
|
|
||||||
Message = "Enter an IP Address to save",
|
|
||||||
OkText = "Next",
|
|
||||||
OnTextChanged = args =>
|
|
||||||
{
|
|
||||||
//IPAddress ugh
|
|
||||||
args.IsValid = IPHelper.IsValidAddress(args.Value);
|
|
||||||
},
|
|
||||||
OnAction = (qAddress) =>
|
|
||||||
{
|
|
||||||
if (!qAddress.Ok)
|
|
||||||
return;
|
|
||||||
|
|
||||||
UserDialogs.Instance.Prompt(new PromptConfig
|
|
||||||
{
|
|
||||||
Title="Enter Name",
|
|
||||||
Message = "Enter a Name for " + qAddress.Text,
|
|
||||||
OkText="Save",
|
|
||||||
OnAction = (qName) => {
|
|
||||||
if (!qName.Ok)
|
|
||||||
return;
|
|
||||||
QStorage.AddInstance(qName.Text,qAddress.Text);
|
|
||||||
App.showToast("Manual Workspace Added!");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async void Scan(){
|
async void Scan(){
|
||||||
|
|||||||
Reference in New Issue
Block a user