mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-09 17:33:50 +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 NoWorkspacesConfig()
|
||||
public NoWorkspacesConfig(Action<bool> action)
|
||||
{
|
||||
Message = "QLab doesn't have any workspaces open?";
|
||||
OkText = "Disconnect";
|
||||
OnAction = action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,13 +95,7 @@ namespace qController
|
||||
}
|
||||
else
|
||||
{
|
||||
NoWorkspacesConfig noWorkspacesConfig = new NoWorkspacesConfig();
|
||||
noWorkspacesConfig.OnAction = (resp) =>
|
||||
{
|
||||
if (resp)
|
||||
Back();
|
||||
};
|
||||
|
||||
NoWorkspacesConfig noWorkspacesConfig = new NoWorkspacesConfig(NoWorkspaceDetected);
|
||||
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)
|
||||
{
|
||||
Back();
|
||||
|
||||
@@ -5,7 +5,7 @@ using Zeroconf;
|
||||
using System.Collections.Generic;
|
||||
using Serilog;
|
||||
using qController.QItems;
|
||||
using qController.Communication;
|
||||
using qController.Dialogs;
|
||||
using qController.Cell;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
@@ -37,17 +37,7 @@ namespace qController
|
||||
}
|
||||
else if(args.Command == "support")
|
||||
{
|
||||
UserDialogs.Instance.Confirm(new ConfirmConfig
|
||||
{
|
||||
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"));
|
||||
}
|
||||
});
|
||||
UserDialogs.Instance.Confirm(new DonatePrompt());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,37 +81,7 @@ namespace qController
|
||||
}
|
||||
|
||||
void AddWorkspace(){
|
||||
|
||||
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!");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
UserDialogs.Instance.Prompt(new AddInstancePrompt());
|
||||
}
|
||||
|
||||
async void Scan(){
|
||||
|
||||
Reference in New Issue
Block a user