Some improvements to the OOBE
Not done, but I need to get to sleep and this seems like a good milestone.
This commit is contained in:
parent
33c5ff881e
commit
1e5a7ea9b3
5 changed files with 119 additions and 61 deletions
|
@ -15,6 +15,8 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
public class OobeStory
|
||||
{
|
||||
private static readonly string[] doodads = new string[] { "\\", "|", "/", "-" };
|
||||
|
||||
[Command("test")]
|
||||
[RequiresArgument("num")]
|
||||
public static bool TestThingy(Dictionary<string, object> args)
|
||||
|
@ -49,21 +51,19 @@ namespace ShiftOS.WinForms
|
|||
Console.WriteLine();
|
||||
Console.Write(" - ");
|
||||
ConsoleEx.Bold = true;
|
||||
Console.Write("Storage preparation");
|
||||
Console.WriteLine("Storage preparation");
|
||||
ConsoleEx.Bold = false;
|
||||
Console.Write(" First, we have to prepare your computer's storage device for ShiftOS. This \r\nincludes formatting your drive with the ShiftFS file \r\nsystem, creating system directories, and generating system files.");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("\tFirst, we have to prepare your computer's storage device for ShiftOS. This \r\n\tincludes formatting your drive with the ShiftFS file \r\n\tsystem, creating system directories, and generating system files.");
|
||||
Console.Write(" - ");
|
||||
ConsoleEx.Bold = true;
|
||||
Console.Write("User configuration");
|
||||
Console.WriteLine("User configuration");
|
||||
ConsoleEx.Bold = false;
|
||||
Console.Write(" Next it's up to you to set up a system hostname, create a user account, and personalize it.");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("\tNext it's up to you to set up a system hostname, create a user account, and personalize it.");
|
||||
Console.Write(" - ");
|
||||
ConsoleEx.Bold = true;
|
||||
Console.Write("System tutorial");
|
||||
Console.WriteLine("System tutorial");
|
||||
ConsoleEx.Bold = false;
|
||||
Console.WriteLine("Finally, we'll teach you how to use ShiftOS.");
|
||||
Console.WriteLine("\tFinally, we'll teach you how to use ShiftOS.");
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
|
@ -71,7 +71,6 @@ namespace ShiftOS.WinForms
|
|||
ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Let's get started!");
|
||||
});
|
||||
int position = 0;
|
||||
|
||||
Thread.Sleep(5000);
|
||||
|
||||
|
@ -121,35 +120,34 @@ namespace ShiftOS.WinForms
|
|||
|
||||
ConsoleEx.Bold = false;
|
||||
ConsoleEx.BackgroundColor = ConsoleColor.Black;
|
||||
Console.Write("Formatting: [");
|
||||
Console.Write("Formatting");
|
||||
ConsoleEx.OnFlush?.Invoke();
|
||||
int formatProgress = 3;
|
||||
while (formatProgress <= 100)
|
||||
int anim = 0;
|
||||
while (formatProgress <= 50)
|
||||
{
|
||||
if (formatProgress % 3 == 0)
|
||||
{
|
||||
ConsoleEx.BackgroundColor = ConsoleColor.White;
|
||||
Console.Write(" ");
|
||||
// Console.Write("\b" + doodads[anim]); doesn't work with our terminal writer... FIXME
|
||||
Console.Write(".");
|
||||
anim++;
|
||||
anim %= doodads.Length;
|
||||
ConsoleEx.OnFlush?.Invoke();
|
||||
ConsoleEx.BackgroundColor = ConsoleColor.Black;
|
||||
Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.typesound));
|
||||
}
|
||||
Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.typesound));
|
||||
formatProgress++;
|
||||
Thread.Sleep(175);
|
||||
}
|
||||
Console.WriteLine("] ..done.");
|
||||
Console.WriteLine("\r\nFormat complete.");
|
||||
Thread.Sleep(1000);
|
||||
ConsoleEx.Bold = true;
|
||||
Console.WriteLine("Creating directories...");
|
||||
Console.WriteLine("Copying system files");
|
||||
ConsoleEx.Bold = false;
|
||||
foreach (var dir in Paths.GetAllWithoutKey())
|
||||
foreach (var fname in Paths.GetAllWithoutKey().Where(f => f.StartsWith("0:/")))
|
||||
{
|
||||
if (!dir.Contains(".") && dir.StartsWith("0:/"))
|
||||
{
|
||||
Console.WriteLine("Creating: " + dir);
|
||||
Thread.Sleep(125);
|
||||
Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.writesound));
|
||||
}
|
||||
Console.WriteLine(fname);
|
||||
Thread.Sleep(50);
|
||||
Desktop.InvokeOnWorkerThread(() => Engine.AudioManager.PlayStream(Properties.Resources.writesound));
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Next, let's get user information.");
|
||||
|
@ -169,13 +167,13 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
new ClientSave
|
||||
{
|
||||
Username = "root",
|
||||
Username = result.Username,
|
||||
Password = result.RootPassword,
|
||||
Permissions = 0
|
||||
}
|
||||
};
|
||||
|
||||
sve.StoryPosition = 8675309;
|
||||
sve.StoryPosition = 8675309; // I recognise that from music.
|
||||
SaveSystem.CurrentSave = sve;
|
||||
Shiftorium.Silent = true;
|
||||
SaveSystem.SaveGame();
|
||||
|
|
78
ShiftOS.WinForms/UniteSignupDialog.Designer.cs
generated
78
ShiftOS.WinForms/UniteSignupDialog.Designer.cs
generated
|
@ -30,19 +30,20 @@
|
|||
{
|
||||
this.btnlogin = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtsys = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtroot = new System.Windows.Forms.TextBox();
|
||||
this.txtsys = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtuname = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnlogin
|
||||
//
|
||||
this.btnlogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnlogin.Location = new System.Drawing.Point(462, 168);
|
||||
this.btnlogin.Location = new System.Drawing.Point(293, 165);
|
||||
this.btnlogin.Name = "btnlogin";
|
||||
this.btnlogin.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnlogin.TabIndex = 11;
|
||||
this.btnlogin.TabIndex = 18;
|
||||
this.btnlogin.Text = "{GEN_OK}";
|
||||
this.btnlogin.UseVisualStyleBackColor = true;
|
||||
this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click);
|
||||
|
@ -57,47 +58,59 @@
|
|||
this.label1.Tag = "header2";
|
||||
this.label1.Text = "{TITLE_SYSTEMPREPARATION}";
|
||||
//
|
||||
// txtsys
|
||||
//
|
||||
this.txtsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtsys.Location = new System.Drawing.Point(113, 100);
|
||||
this.txtsys.Name = "txtsys";
|
||||
this.txtsys.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtsys.TabIndex = 15;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(17, 103);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(119, 13);
|
||||
this.label5.TabIndex = 14;
|
||||
this.label5.Text = "{GEN_SYSTEMNAME}";
|
||||
//
|
||||
// txtroot
|
||||
//
|
||||
this.txtroot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtroot.Location = new System.Drawing.Point(113, 126);
|
||||
this.txtroot.Location = new System.Drawing.Point(107, 168);
|
||||
this.txtroot.Name = "txtroot";
|
||||
this.txtroot.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtroot.TabIndex = 18;
|
||||
this.txtroot.Size = new System.Drawing.Size(81, 20);
|
||||
this.txtroot.TabIndex = 17;
|
||||
this.txtroot.UseSystemPasswordChar = true;
|
||||
//
|
||||
// txtsys
|
||||
//
|
||||
this.txtsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtsys.Location = new System.Drawing.Point(20, 100);
|
||||
this.txtsys.Name = "txtsys";
|
||||
this.txtsys.Size = new System.Drawing.Size(336, 20);
|
||||
this.txtsys.TabIndex = 15;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(17, 129);
|
||||
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label7.Location = new System.Drawing.Point(17, 123);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(138, 13);
|
||||
this.label7.Size = new System.Drawing.Size(351, 43);
|
||||
this.label7.TabIndex = 17;
|
||||
this.label7.Text = "{GEN_ROOTPASSWORD}";
|
||||
this.label7.Text = "You\'ll also need to create a new username and password. You will need this inform" +
|
||||
"ation to access your computer, so don\'t forget it!";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label5.Location = new System.Drawing.Point(17, 67);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(339, 30);
|
||||
this.label5.TabIndex = 14;
|
||||
this.label5.Text = "You\'ll need to choose a hostname. This will identify your computer to other membe" +
|
||||
"rs of the Digital Society.";
|
||||
//
|
||||
// txtuname
|
||||
//
|
||||
this.txtuname.Location = new System.Drawing.Point(20, 168);
|
||||
this.txtuname.Name = "txtuname";
|
||||
this.txtuname.Size = new System.Drawing.Size(81, 20);
|
||||
this.txtuname.TabIndex = 16;
|
||||
//
|
||||
// UniteSignupDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.txtuname);
|
||||
this.Controls.Add(this.txtroot);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.txtsys);
|
||||
|
@ -105,7 +118,7 @@
|
|||
this.Controls.Add(this.btnlogin);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "UniteSignupDialog";
|
||||
this.Size = new System.Drawing.Size(555, 208);
|
||||
this.Size = new System.Drawing.Size(386, 208);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -115,9 +128,10 @@
|
|||
|
||||
private System.Windows.Forms.Button btnlogin;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtsys;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtroot;
|
||||
private System.Windows.Forms.TextBox txtsys;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtuname;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,33 @@ using ShiftOS.Engine;
|
|||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using ShiftOS.Objects;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
public partial class UniteSignupDialog : UserControl, IShiftOSWindow
|
||||
{
|
||||
// sets a placeholder value on a control using Windows API voodoo
|
||||
private static void SetPlaceholder(Control ctl, string txt)
|
||||
{
|
||||
IntPtr str = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
str = Marshal.StringToHGlobalUni(txt);
|
||||
var msgSetPlaceholder = Message.Create(ctl.Handle, 0x1501, IntPtr.Zero, str);
|
||||
NativeWindow.FromHandle(ctl.Handle).DefWndProc(ref msgSetPlaceholder);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (str != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal(str);
|
||||
}
|
||||
}
|
||||
|
||||
public class SignupCredentials
|
||||
{
|
||||
public string SystemName { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string RootPassword { get; set; }
|
||||
}
|
||||
|
||||
|
@ -30,10 +49,13 @@ namespace ShiftOS.WinForms
|
|||
|
||||
private Action<SignupCredentials> Callback { get; set; }
|
||||
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
this.ParentForm.AcceptButton = btnlogin;
|
||||
SetPlaceholder(txtsys, "Hostname");
|
||||
SetPlaceholder(txtuname, "Username");
|
||||
SetPlaceholder(txtroot, "Password");
|
||||
txtroot.Size = txtuname.Size; // AppearanceManager stop breaking my design REEEEE
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
|
@ -52,22 +74,33 @@ namespace ShiftOS.WinForms
|
|||
private void btnlogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
string sys = txtsys.Text;
|
||||
string uname = txtuname.Text;
|
||||
string root = txtroot.Text;
|
||||
|
||||
// validation
|
||||
|
||||
if (string.IsNullOrWhiteSpace(sys))
|
||||
{
|
||||
Infobox.Show("{TITLE_EMPTY_SYSNAME}", "{MSG_EMPTY_SYSNAME}");
|
||||
return;
|
||||
}
|
||||
if(sys.Length < 5)
|
||||
|
||||
if (sys.Length < 5)
|
||||
{
|
||||
Infobox.Show("{TITLE_VALIDATION_ERROR}", "{MSG_VALIDATION_ERROR_SYSNAME_LENGTH}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(uname))
|
||||
{
|
||||
Infobox.Show("{TITLE_VALIDATION_ERROR}", "You must provide a username.");
|
||||
return;
|
||||
}
|
||||
|
||||
Callback?.Invoke(new SignupCredentials
|
||||
{
|
||||
SystemName = sys,
|
||||
Username = uname,
|
||||
RootPassword = root
|
||||
});
|
||||
AppearanceManager.Close(this);
|
||||
|
|
|
@ -117,4 +117,10 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="txtroot.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="txtuname.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -124,7 +124,14 @@ namespace ShiftOS.Engine
|
|||
|
||||
ConsoleEx.ForegroundColor = ConsoleColor.White;
|
||||
ConsoleEx.Bold = false;
|
||||
Console.WriteLine("A new objective has been added to your system. Run status to find out what you need to do.");
|
||||
Console.WriteLine("A new objective has been added to your system.");
|
||||
ConsoleEx.Bold = true;
|
||||
Console.WriteLine(name);
|
||||
ConsoleEx.Bold = false;
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(desc);
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Run 'status' at any time to view your current objectives.");
|
||||
TerminalBackend.PrintPrompt();
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue