Fully implement mud traversal into OOBE and setup

This commit is contained in:
Michael 2017-02-02 11:02:58 -05:00
parent baf9c48346
commit fbc1586ff2
4 changed files with 125 additions and 24 deletions

View file

@ -65,6 +65,12 @@ namespace ShiftOS.WinForms.Applications
font-size: {LoadedSkin.Header3Font.SizeInPoints}pt;
}}
pre, code {{
font-family: ""{LoadedSkin.TerminalFont.Name}"";
font-size: {LoadedSkin.TerminalFont.SizeInPoints}pt;
color: rgb({LoadedSkin.TerminalForeColor.R}, {LoadedSkin.TerminalForeColor.G}, {LoadedSkin.TerminalForeColor.B});
background-color: rgb({LoadedSkin.TerminalBackColor.R}, {LoadedSkin.TerminalBackColor.G}, {LoadedSkin.TerminalBackColor.B});
}}
</style>
</head>
<body>
@ -128,20 +134,34 @@ namespace ShiftOS.WinForms.Applications
private void btnback_Click(object sender, EventArgs e)
{
string hist = History.Pop();
if (!string.IsNullOrEmpty(hist))
try
{
Future.Push(hist);
ShiftnetNavigate(hist, false);
string hist = History.Pop();
if (!string.IsNullOrEmpty(hist))
{
Future.Push(hist);
ShiftnetNavigate(hist, false);
}
}
catch
{
}
}
private void btnforward_Click(object sender, EventArgs e)
{
string fut = Future.Pop();
if (!string.IsNullOrEmpty(fut))
try
{
ShiftnetNavigate(fut);
string fut = Future.Pop();
if (!string.IsNullOrEmpty(fut))
{
ShiftnetNavigate(fut);
}
}
catch
{
}
}

View file

@ -63,9 +63,9 @@
this.pglogin = new System.Windows.Forms.Panel();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.label12 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.txtluser = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.txtlpass = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.flbuttons.SuspendLayout();
@ -432,9 +432,9 @@
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel3.Controls.Add(this.label12, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.textBox1, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.txtluser, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.label13, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.textBox2, 1, 1);
this.tableLayoutPanel3.Controls.Add(this.txtlpass, 1, 1);
this.tableLayoutPanel3.Location = new System.Drawing.Point(20, 61);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 3;
@ -453,12 +453,12 @@
this.label12.TabIndex = 0;
this.label12.Text = "Username:";
//
// textBox1
// txtluser
//
this.textBox1.Location = new System.Drawing.Point(109, 3);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 1;
this.txtluser.Location = new System.Drawing.Point(109, 3);
this.txtluser.Name = "txtluser";
this.txtluser.Size = new System.Drawing.Size(100, 20);
this.txtluser.TabIndex = 1;
//
// label13
//
@ -469,13 +469,13 @@
this.label13.TabIndex = 2;
this.label13.Text = "Password:";
//
// textBox2
// txtlpass
//
this.textBox2.Location = new System.Drawing.Point(109, 29);
this.textBox2.Name = "textBox2";
this.textBox2.PasswordChar = '*';
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 3;
this.txtlpass.Location = new System.Drawing.Point(109, 29);
this.txtlpass.Name = "txtlpass";
this.txtlpass.PasswordChar = '*';
this.txtlpass.Size = new System.Drawing.Size(100, 20);
this.txtlpass.TabIndex = 3;
//
// label15
//
@ -578,9 +578,9 @@
private System.Windows.Forms.Panel pglogin;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox txtluser;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox txtlpass;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Button button1;
}

View file

@ -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)

View file

@ -257,6 +257,10 @@ namespace ShiftOS.WinForms
var fsw = new FakeSetupScreen(this, 10);
fsw.Show();
fsw.TopMost = true;
fsw.DoneLoggingIn += () =>
{
this.Close();
};
}
public void StartTrailer()