diff options
| author | Michael <[email protected]> | 2017-02-02 11:02:58 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-02 11:02:58 -0500 |
| commit | fbc1586ff2e1362ce53952f65d78eb015efbcb04 (patch) | |
| tree | e5df4399483bce356a3bfcfa52db98f33e9b2564 /ShiftOS.WinForms/FakeSetupScreen.cs | |
| parent | baf9c4834607dcfac7cbc85d1fa406a3076a394c (diff) | |
| download | shiftos_thereturn-fbc1586ff2e1362ce53952f65d78eb015efbcb04.tar.gz shiftos_thereturn-fbc1586ff2e1362ce53952f65d78eb015efbcb04.tar.bz2 shiftos_thereturn-fbc1586ff2e1362ce53952f65d78eb015efbcb04.zip | |
Fully implement mud traversal into OOBE and setup
Diffstat (limited to 'ShiftOS.WinForms/FakeSetupScreen.cs')
| -rw-r--r-- | ShiftOS.WinForms/FakeSetupScreen.cs | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/FakeSetupScreen.cs b/ShiftOS.WinForms/FakeSetupScreen.cs index a30b66c..ff1db62 100644 --- a/ShiftOS.WinForms/FakeSetupScreen.cs +++ b/ShiftOS.WinForms/FakeSetupScreen.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using Newtonsoft.Json; using ShiftOS.Engine; namespace ShiftOS.WinForms @@ -192,11 +193,87 @@ So make sure your password is secure enough that it can't be guessed, but easy f this.Close(); break; case 10: + btnnext.Show(); + btnback.Hide(); pglogin.BringToFront(); break; + case 11: + btnnext.Hide(); + ServerMessageReceived login = null; + + login = (msg) => + { + if (msg.Name == "mud_found") + { + this.Invoke(new Action(() => + { + currentPage = 12; + SetupUI(); + })); + } + else if (msg.Name == "mud_notfound") + { + this.Invoke(new Action(() => + { + currentPage = 10; + SetupUI(); + })); + } + ServerManager.MessageReceived -= login; + }; + + ServerManager.MessageReceived += login; + if(!string.IsNullOrWhiteSpace(txtluser.Text) && !string.IsNullOrWhiteSpace(txtlpass.Text)) + { + ServerManager.SendMessage("mud_checkuserexists", JsonConvert.SerializeObject(new + { + username = txtluser.Text, + password = txtlpass.Text + })); + } + break; + case 12: + btnnext.Hide(); + ServerMessageReceived getsave = null; + + getsave = (msg) => + { + if (msg.Name == "mud_found") + { + this.Invoke(new Action(() => + { + currentPage = 12; + SetupUI(); + })); + } + else if (msg.Name == "mud_notfound") + { + this.Invoke(new Action(() => + { + currentPage = 10; + SetupUI(); + })); + } + ServerManager.MessageReceived -= getsave; + }; + + ServerManager.MessageReceived += getsave; + + ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new + { + username = txtluser.Text, + password = txtlpass.Text + })); + + DoneLoggingIn?.Invoke(); + this.CanClose = true; + this.Close(); + break; } } + public event Action DoneLoggingIn; + public event Action<string, string, string> UserReregistered; public void StartWipingInBackground(long arbitraryAmountOfBytes) |
