aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.MFSProfiler/Infobox.cs
diff options
context:
space:
mode:
authorwilliam341 <[email protected]>2017-06-24 10:53:22 -0700
committerGitHub <[email protected]>2017-06-24 10:53:22 -0700
commitbae34710cf86240b2744196c4b95e569fb161c90 (patch)
treed5ff99e5cc8f3db8a9236b247886866601b915b9 /ShiftOS.MFSProfiler/Infobox.cs
parentb4b19e7a4d203b58537f5b98214296ab52c49b2d (diff)
parent1661f9a5bd46dbd7d2586787c55bfc407c027629 (diff)
downloadshiftos_thereturn-bae34710cf86240b2744196c4b95e569fb161c90.tar.gz
shiftos_thereturn-bae34710cf86240b2744196c4b95e569fb161c90.tar.bz2
shiftos_thereturn-bae34710cf86240b2744196c4b95e569fb161c90.zip
Merge pull request #5 from shiftos-game/master
merge
Diffstat (limited to 'ShiftOS.MFSProfiler/Infobox.cs')
-rw-r--r--ShiftOS.MFSProfiler/Infobox.cs87
1 files changed, 87 insertions, 0 deletions
diff --git a/ShiftOS.MFSProfiler/Infobox.cs b/ShiftOS.MFSProfiler/Infobox.cs
new file mode 100644
index 0000000..a30ac5a
--- /dev/null
+++ b/ShiftOS.MFSProfiler/Infobox.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ShiftOS.MFSProfiler
+{
+ public partial class Infobox : Form
+ {
+ public Infobox()
+ {
+ InitializeComponent();
+ }
+
+ public Action<string> TextCallback = null;
+ public Action<bool> YesNoCallback = null;
+
+ public string MessageText
+ {
+ get
+ {
+ return lbmessage.Text;
+ }
+ set
+ {
+ lbmessage.Text = value;
+ }
+ }
+
+ public bool ShowText
+ {
+ get { return txtinput.Visible; }
+ set { txtinput.Visible = value; }
+ }
+
+ public bool ShowYesNo
+ {
+ get { return btnyes.Parent.Visible; }
+ set { btnyes.Parent.Visible = value; }
+ }
+
+ public static void PromptYesNo(string title, string message, Action<bool> callback)
+ {
+ var inf = new Infobox();
+ inf.ShowText = false;
+ inf.ShowYesNo = true;
+ inf.Text = title;
+ inf.MessageText = message;
+ inf.YesNoCallback = callback;
+ inf.ShowDialog();
+ }
+
+ public static void PromptText(string title, string message, Action<string> callback)
+ {
+ var inf = new Infobox();
+ inf.ShowYesNo = false;
+ inf.ShowText = true;
+ inf.Text = title;
+ inf.MessageText = message;
+ inf.TextCallback = callback;
+ inf.ShowDialog();
+ }
+
+ private void btnyes_Click(object sender, EventArgs e)
+ {
+ YesNoCallback?.Invoke(true);
+ this.Close();
+ }
+
+ private void btnno_Click(object sender, EventArgs e)
+ {
+ YesNoCallback?.Invoke(false);
+ this.Close();
+ }
+
+ private void btnok_Click(object sender, EventArgs e)
+ {
+ TextCallback?.Invoke(txtinput.Text);
+ this.Close();
+ }
+ }
+}