aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Program.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-01-17 17:08:27 -0500
committerMichael <[email protected]>2017-01-17 17:08:33 -0500
commitb348a76db785c040d957f055ba9cc8569bf0c285 (patch)
tree376a1884c36eb7a0929d5c88078c94986defecbc /ShiftOS.WinForms/Program.cs
parenta93dd80d4e2f4c97284a1d7bc24b0240358bdd25 (diff)
downloadshiftos_thereturn-b348a76db785c040d957f055ba9cc8569bf0c285.tar.gz
shiftos_thereturn-b348a76db785c040d957f055ba9cc8569bf0c285.tar.bz2
shiftos_thereturn-b348a76db785c040d957f055ba9cc8569bf0c285.zip
Out-of-box experience work
It's definitely not working right now. I wouldn't delete your save. I have to implement the tutorial before the OOBE will let you into the game.
Diffstat (limited to 'ShiftOS.WinForms/Program.cs')
-rw-r--r--ShiftOS.WinForms/Program.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs
index 18971b9..7db25b9 100644
--- a/ShiftOS.WinForms/Program.cs
+++ b/ShiftOS.WinForms/Program.cs
@@ -108,6 +108,50 @@ namespace ShiftOS.WinForms
AppearanceManager.SetupDialog(frm);
}
+
+ public void PromptText(string title, string msg, Action<string> callback)
+ {
+ Dialog frm = new Dialog();
+ frm.Text = title;
+ var pnl = new Panel();
+ var flow = new FlowLayoutPanel();
+ var btnok = new Button();
+ btnok.AutoSize = true;
+ btnok.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ flow.Height = btnok.Height + 4;
+ btnok.Text = "ok";
+ flow.Dock = DockStyle.Bottom;
+ flow.Controls.Add(btnok);
+ var txtinput = new TextBox();
+ btnok.Show(); btnok.Click += (o, a) =>
+ {
+ callback?.Invoke(txtinput.Text);
+ frm.Close();
+ };
+ txtinput.Dock = DockStyle.Bottom;
+ txtinput.KeyDown += (o, a) =>
+ {
+ if(a.KeyCode == Keys.Enter)
+ {
+ a.SuppressKeyPress = true;
+ callback?.Invoke(txtinput.Text);
+ frm.Close();
+ }
+ };
+ pnl.Controls.Add(flow);
+ pnl.Controls.Add(txtinput);txtinput.Show();
+ flow.Show();
+ var lbl = new Label();
+ lbl.Text = msg;
+ lbl.TextAlign = ContentAlignment.MiddleCenter;
+ lbl.Dock = DockStyle.Fill;
+ lbl.AutoSize = false;
+ pnl.Controls.Add(lbl); lbl.Show();
+ frm.Controls.Add(pnl);
+ pnl.Dock = DockStyle.Fill;
+ frm.Size = new Size(320, 200);
+ AppearanceManager.SetupDialog(frm);
+ }
}
public class WinformsFSFrontend : IFileSkimmer