aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/Dialog.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-02 13:51:29 -0500
committerMichael <[email protected]>2017-02-02 13:51:29 -0500
commit3a41ba45e7ac0df930066a79540f82544dbd8114 (patch)
tree341d707da673b0db997b5b4f93a4a3e42d047259 /ShiftOS.WinForms/Applications/Dialog.cs
parente55e195d88ba4a3bfea47cb8784564a43f426e48 (diff)
downloadshiftos_thereturn-3a41ba45e7ac0df930066a79540f82544dbd8114.tar.gz
shiftos_thereturn-3a41ba45e7ac0df930066a79540f82544dbd8114.tar.bz2
shiftos_thereturn-3a41ba45e7ac0df930066a79540f82544dbd8114.zip
Redesign the Infobox, categorize AL items
Diffstat (limited to 'ShiftOS.WinForms/Applications/Dialog.cs')
-rw-r--r--ShiftOS.WinForms/Applications/Dialog.cs78
1 files changed, 77 insertions, 1 deletions
diff --git a/ShiftOS.WinForms/Applications/Dialog.cs b/ShiftOS.WinForms/Applications/Dialog.cs
index c19595e..4d13e23 100644
--- a/ShiftOS.WinForms/Applications/Dialog.cs
+++ b/ShiftOS.WinForms/Applications/Dialog.cs
@@ -35,7 +35,7 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
- public partial class Dialog : UserControl, IShiftOSWindow
+ public partial class Dialog : UserControl, IShiftOSWindow, IInfobox
{
public Dialog()
{
@@ -58,5 +58,81 @@ namespace ShiftOS.WinForms.Applications
public void OnUpgrade()
{
}
+
+ internal void OpenInternal(string title, string msg)
+ {
+ AppearanceManager.SetupWindow(this);
+ this.Parent.Text = title;
+ lbmessage.Text = msg;
+ txtinput.Hide();
+ flyesno.Hide();
+ btnok.Show();
+ btnok.Click += (o, a) =>
+ {
+ AppearanceManager.Close(this);
+ };
+
+ }
+
+ public void Open(string title, string msg)
+ {
+ new Dialog().OpenInternal(title, msg);
+ }
+
+ public void PromptTextInternal(string title, string message, Action<string> callback)
+ {
+ AppearanceManager.SetupWindow(this);
+ this.Parent.Text = title;
+ lbmessage.Text = message;
+ txtinput.Show();
+ flyesno.Hide();
+ btnok.Show();
+ btnok.Click += (o, a) =>
+ {
+ callback?.Invoke(txtinput.Text);
+ AppearanceManager.Close(this);
+ };
+ txtinput.KeyDown += (o, a) =>
+ {
+ if(a.KeyCode == Keys.Enter)
+ {
+ a.SuppressKeyPress = true;
+ callback?.Invoke(txtinput.Text);
+ AppearanceManager.Close(this);
+ }
+ };
+ }
+
+ public void PromptText(string title, string message, Action<string> callback)
+ {
+ new Dialog().PromptTextInternal(title, message, callback);
+ }
+
+ public void PromptYesNo(string title, string message, Action<bool> callback)
+ {
+ new Dialog().PromptYesNoInternal(title, message, callback);
+ }
+
+
+
+ public void PromptYesNoInternal(string title, string message, Action<bool> callback)
+ {
+ AppearanceManager.SetupWindow(this);
+ this.Parent.Text = title;
+ lbmessage.Text = message;
+ txtinput.Hide();
+ flyesno.Show();
+ btnok.Hide();
+ btnyes.Click += (o, a) =>
+ {
+ callback?.Invoke(true);
+ AppearanceManager.Close(this);
+ };
+ btnno.Click += (o, a) =>
+ {
+ callback?.Invoke(false);
+ AppearanceManager.Close(this);
+ };
+ }
}
}