mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
GUI-based login screen with skinning!
This commit is contained in:
parent
b82dfc16ed
commit
d0d193bb1b
10 changed files with 555 additions and 50 deletions
135
ShiftOS.WinForms/GUILogin.Designer.cs
generated
Normal file
135
ShiftOS.WinForms/GUILogin.Designer.cs
generated
Normal file
|
@ -0,0 +1,135 @@
|
|||
namespace ShiftOS.WinForms
|
||||
{
|
||||
partial class GUILogin
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pnlloginform = new System.Windows.Forms.Panel();
|
||||
this.btnlogin = new System.Windows.Forms.Button();
|
||||
this.txtpassword = new System.Windows.Forms.TextBox();
|
||||
this.txtusername = new System.Windows.Forms.TextBox();
|
||||
this.lblogintitle = new System.Windows.Forms.Label();
|
||||
this.btnshutdown = new System.Windows.Forms.Button();
|
||||
this.pnlloginform.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlloginform
|
||||
//
|
||||
this.pnlloginform.Controls.Add(this.btnlogin);
|
||||
this.pnlloginform.Controls.Add(this.txtpassword);
|
||||
this.pnlloginform.Controls.Add(this.txtusername);
|
||||
this.pnlloginform.Location = new System.Drawing.Point(13, 13);
|
||||
this.pnlloginform.Name = "pnlloginform";
|
||||
this.pnlloginform.Size = new System.Drawing.Size(358, 236);
|
||||
this.pnlloginform.TabIndex = 0;
|
||||
this.pnlloginform.Tag = "";
|
||||
//
|
||||
// btnlogin
|
||||
//
|
||||
this.btnlogin.AutoSize = true;
|
||||
this.btnlogin.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnlogin.Location = new System.Drawing.Point(129, 184);
|
||||
this.btnlogin.Name = "btnlogin";
|
||||
this.btnlogin.Size = new System.Drawing.Size(43, 23);
|
||||
this.btnlogin.TabIndex = 2;
|
||||
this.btnlogin.Text = "Login";
|
||||
this.btnlogin.UseVisualStyleBackColor = true;
|
||||
this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click);
|
||||
//
|
||||
// txtpassword
|
||||
//
|
||||
this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtpassword.Location = new System.Drawing.Point(24, 157);
|
||||
this.txtpassword.Name = "txtpassword";
|
||||
this.txtpassword.Size = new System.Drawing.Size(301, 20);
|
||||
this.txtpassword.TabIndex = 1;
|
||||
this.txtpassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// txtusername
|
||||
//
|
||||
this.txtusername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtusername.Location = new System.Drawing.Point(24, 131);
|
||||
this.txtusername.Name = "txtusername";
|
||||
this.txtusername.Size = new System.Drawing.Size(301, 20);
|
||||
this.txtusername.TabIndex = 0;
|
||||
//
|
||||
// lblogintitle
|
||||
//
|
||||
this.lblogintitle.AutoSize = true;
|
||||
this.lblogintitle.Location = new System.Drawing.Point(99, 553);
|
||||
this.lblogintitle.Name = "lblogintitle";
|
||||
this.lblogintitle.Size = new System.Drawing.Size(103, 13);
|
||||
this.lblogintitle.TabIndex = 1;
|
||||
this.lblogintitle.Tag = "header1 keepbg";
|
||||
this.lblogintitle.Text = "Welcome to ShiftOS";
|
||||
//
|
||||
// btnshutdown
|
||||
//
|
||||
this.btnshutdown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnshutdown.AutoSize = true;
|
||||
this.btnshutdown.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnshutdown.Location = new System.Drawing.Point(924, 652);
|
||||
this.btnshutdown.Name = "btnshutdown";
|
||||
this.btnshutdown.Size = new System.Drawing.Size(65, 23);
|
||||
this.btnshutdown.TabIndex = 2;
|
||||
this.btnshutdown.Text = "Shutdown";
|
||||
this.btnshutdown.UseVisualStyleBackColor = true;
|
||||
this.btnshutdown.Click += new System.EventHandler(this.btnshutdown_Click);
|
||||
//
|
||||
// GUILogin
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(1001, 687);
|
||||
this.Controls.Add(this.btnshutdown);
|
||||
this.Controls.Add(this.lblogintitle);
|
||||
this.Controls.Add(this.pnlloginform);
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Name = "GUILogin";
|
||||
this.Text = "GUILogin";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GUILogin_FormClosing);
|
||||
this.Load += new System.EventHandler(this.GUILogin_Load);
|
||||
this.pnlloginform.ResumeLayout(false);
|
||||
this.pnlloginform.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel pnlloginform;
|
||||
private System.Windows.Forms.Button btnlogin;
|
||||
private System.Windows.Forms.TextBox txtpassword;
|
||||
private System.Windows.Forms.TextBox txtusername;
|
||||
private System.Windows.Forms.Label lblogintitle;
|
||||
private System.Windows.Forms.Button btnshutdown;
|
||||
}
|
||||
}
|
131
ShiftOS.WinForms/GUILogin.cs
Normal file
131
ShiftOS.WinForms/GUILogin.cs
Normal file
|
@ -0,0 +1,131 @@
|
|||
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;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.Objects;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
public partial class GUILogin : Form
|
||||
{
|
||||
public GUILogin()
|
||||
{
|
||||
InitializeComponent();
|
||||
uiTimer.Tick += (o, a) =>
|
||||
{
|
||||
btnlogin.Left = txtusername.Left + ((txtusername.Width - btnlogin.Width) / 2);
|
||||
btnlogin.Top = txtpassword.Top + txtpassword.Height + 5;
|
||||
|
||||
lblogintitle.Left = pnlloginform.Left + ((pnlloginform.Width - lblogintitle.Width) / 2);
|
||||
lblogintitle.Top = pnlloginform.Top - lblogintitle.Width - 5;
|
||||
|
||||
};
|
||||
uiTimer.Interval = 100;
|
||||
this.FormBorderStyle = FormBorderStyle.None;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
this.TopMost = true;
|
||||
}
|
||||
|
||||
Timer uiTimer = new Timer();
|
||||
|
||||
public event Action<ClientSave> LoginComplete;
|
||||
|
||||
private void GUILogin_Load(object sender, EventArgs e)
|
||||
{
|
||||
uiTimer.Start();
|
||||
ControlManager.SetupControl(lblogintitle);
|
||||
ControlManager.SetupControls(pnlloginform);
|
||||
ControlManager.SetupControl(btnshutdown);
|
||||
pnlloginform.CenterParent();
|
||||
this.BackColor = SkinEngine.LoadedSkin.LoginScreenColor;
|
||||
this.BackgroundImage = SkinEngine.GetImage("login");
|
||||
this.BackgroundImageLayout = SkinEngine.GetImageLayout("login");
|
||||
}
|
||||
|
||||
private ClientSave User = null;
|
||||
|
||||
bool userRequestClose = true;
|
||||
bool shuttingdown = false;
|
||||
|
||||
private void GUILogin_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
e.Cancel = userRequestClose;
|
||||
if (!e.Cancel)
|
||||
{
|
||||
uiTimer.Stop();
|
||||
if (shuttingdown == false)
|
||||
{
|
||||
LoginComplete?.Invoke(User);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnlogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(txtusername.Text))
|
||||
{
|
||||
Infobox.Show("Enter a username", "You must enter your username to login.");
|
||||
return;
|
||||
}
|
||||
|
||||
//Don't check for blank passwords.
|
||||
|
||||
var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == txtusername.Text);
|
||||
if(user == null)
|
||||
{
|
||||
Infobox.Show("Invalid username", "That username was not found on your system.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.Password != txtpassword.Text)
|
||||
{
|
||||
Infobox.Show("Access denied.", "That password didn't work. Please try a different one.");
|
||||
return;
|
||||
}
|
||||
|
||||
User = user;
|
||||
userRequestClose = false;
|
||||
shuttingdown = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnshutdown_Click(object sender, EventArgs e)
|
||||
{
|
||||
userRequestClose = false;
|
||||
shuttingdown = true;
|
||||
this.Close();
|
||||
SaveSystem.CurrentUser = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == "root");
|
||||
TerminalBackend.InvokeCommand("sos.shutdown");
|
||||
}
|
||||
}
|
||||
|
||||
public class GUILoginFrontend : ILoginFrontend
|
||||
{
|
||||
public bool UseGUILogin
|
||||
{
|
||||
get
|
||||
{
|
||||
return Shiftorium.UpgradeInstalled("gui_based_login_screen");
|
||||
}
|
||||
}
|
||||
|
||||
public event Action<ClientSave> LoginComplete;
|
||||
|
||||
public void Login()
|
||||
{
|
||||
var lform = new GUILogin();
|
||||
lform.LoginComplete += (user) =>
|
||||
{
|
||||
LoginComplete?.Invoke(user);
|
||||
};
|
||||
lform.Show();
|
||||
}
|
||||
}
|
||||
}
|
120
ShiftOS.WinForms/GUILogin.resx
Normal file
120
ShiftOS.WinForms/GUILogin.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -49,6 +49,7 @@ namespace ShiftOS.WinForms
|
|||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
//if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael
|
||||
LoginManager.Init(new GUILoginFrontend());
|
||||
CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly());
|
||||
SkinEngine.SetIconProber(new ShiftOSIconProvider());
|
||||
ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider());
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
Dependencies: "desktop",
|
||||
Category: "Enhancements",
|
||||
},
|
||||
{
|
||||
Name: "GUI Based Login Screen",
|
||||
Cost: 500,
|
||||
Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, why not use these tools to create a functioning and awesome-looking login screen?",
|
||||
Dependencies: "skinning;desktop;wm_free_placement",
|
||||
Category: "Kernel & System"
|
||||
},
|
||||
{
|
||||
Name: "Shift Screensavers",
|
||||
Cost: 100,
|
||||
|
|
|
@ -323,6 +323,12 @@
|
|||
<DependentUpon>DownloadControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GUIFunctions.cs" />
|
||||
<Compile Include="GUILogin.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUILogin.Designer.cs">
|
||||
<DependentUpon>GUILogin.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HackerCommands.cs" />
|
||||
<Compile Include="IDesktopWidget.cs" />
|
||||
<Compile Include="JobTasks.cs" />
|
||||
|
@ -520,6 +526,9 @@
|
|||
<EmbeddedResource Include="DownloadControl.resx">
|
||||
<DependentUpon>DownloadControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GUILogin.resx">
|
||||
<DependentUpon>GUILogin.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Oobe.resx">
|
||||
<DependentUpon>Oobe.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
65
ShiftOS_TheReturn/LoginManager.cs
Normal file
65
ShiftOS_TheReturn/LoginManager.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShiftOS.Objects;
|
||||
|
||||
namespace ShiftOS.Engine
|
||||
{
|
||||
public static class LoginManager
|
||||
{
|
||||
private static ILoginFrontend _login = null;
|
||||
|
||||
public static void Init(ILoginFrontend login)
|
||||
{
|
||||
_login = login;
|
||||
}
|
||||
|
||||
public static void PromptForLogin()
|
||||
{
|
||||
_login.LoginComplete += (user) =>
|
||||
{
|
||||
LoginComplete?.Invoke(user);
|
||||
};
|
||||
_login.Login();
|
||||
}
|
||||
|
||||
public static bool ShouldUseGUILogin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_login == null)
|
||||
return false;
|
||||
return _login.UseGUILogin;
|
||||
}
|
||||
}
|
||||
|
||||
public static event Action<ClientSave> LoginComplete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface for GUI-based logins.
|
||||
/// </summary>
|
||||
public interface ILoginFrontend
|
||||
{
|
||||
/// <summary>
|
||||
/// When implemented, shows the login UI.
|
||||
/// </summary>
|
||||
void Login();
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the ShiftOS engine should use a GUI-based login system or the default one.
|
||||
/// </summary>
|
||||
bool UseGUILogin { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the login is complete.
|
||||
/// </summary>
|
||||
event Action<ClientSave> LoginComplete;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -263,70 +263,90 @@ namespace ShiftOS.Engine
|
|||
|
||||
TerminalBackend.PrefixEnabled = false;
|
||||
|
||||
Login:
|
||||
string username = "";
|
||||
int progress = 0;
|
||||
bool goback = false;
|
||||
TextSentEventHandler ev = null;
|
||||
ev = (text) =>
|
||||
if (LoginManager.ShouldUseGUILogin)
|
||||
{
|
||||
if (progress == 0)
|
||||
Action<ClientSave> Completed = null;
|
||||
Completed += (user) =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
CurrentUser = user;
|
||||
LoginManager.LoginComplete -= Completed;
|
||||
};
|
||||
LoginManager.LoginComplete += Completed;
|
||||
Desktop.InvokeOnWorkerThread(() =>
|
||||
{
|
||||
LoginManager.PromptForLogin();
|
||||
});
|
||||
while (CurrentUser == null)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Login:
|
||||
string username = "";
|
||||
int progress = 0;
|
||||
bool goback = false;
|
||||
TextSentEventHandler ev = null;
|
||||
ev = (text) =>
|
||||
{
|
||||
if (progress == 0)
|
||||
{
|
||||
if (CurrentSave.Users.FirstOrDefault(x => x.Username == text) == null)
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
Console.WriteLine("User not found.");
|
||||
if (CurrentSave.Users.FirstOrDefault(x => x.Username == text) == null)
|
||||
{
|
||||
Console.WriteLine("User not found.");
|
||||
goback = true;
|
||||
progress++;
|
||||
TerminalBackend.TextSent -= ev;
|
||||
return;
|
||||
}
|
||||
username = text;
|
||||
progress++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Username not provided.");
|
||||
TerminalBackend.TextSent -= ev;
|
||||
goback = true;
|
||||
progress++;
|
||||
TerminalBackend.TextSent -= ev;
|
||||
return;
|
||||
}
|
||||
username = text;
|
||||
progress++;
|
||||
}
|
||||
else
|
||||
else if (progress == 1)
|
||||
{
|
||||
Console.WriteLine("Username not provided.");
|
||||
var user = CurrentSave.Users.FirstOrDefault(x => x.Username == username);
|
||||
if (user.Password == text)
|
||||
{
|
||||
Console.WriteLine("Welcome to ShiftOS.");
|
||||
CurrentUser = user;
|
||||
Thread.Sleep(2000);
|
||||
progress++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Access denied.");
|
||||
goback = true;
|
||||
progress++;
|
||||
}
|
||||
TerminalBackend.TextSent -= ev;
|
||||
goback = true;
|
||||
progress++;
|
||||
}
|
||||
}
|
||||
else if (progress == 1)
|
||||
};
|
||||
TerminalBackend.TextSent += ev;
|
||||
Console.WriteLine(CurrentSave.SystemName + " login:");
|
||||
while (progress == 0)
|
||||
{
|
||||
var user = CurrentSave.Users.FirstOrDefault(x => x.Username == username);
|
||||
if (user.Password == text)
|
||||
{
|
||||
Console.WriteLine("Welcome to ShiftOS.");
|
||||
CurrentUser = user;
|
||||
Thread.Sleep(2000);
|
||||
progress++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Access denied.");
|
||||
goback = true;
|
||||
progress++;
|
||||
}
|
||||
TerminalBackend.TextSent -= ev;
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
};
|
||||
TerminalBackend.TextSent += ev;
|
||||
Console.WriteLine(CurrentSave.SystemName + " login:");
|
||||
while(progress == 0)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
if (goback)
|
||||
goto Login;
|
||||
Console.WriteLine("password:");
|
||||
while (progress == 1)
|
||||
Thread.Sleep(10);
|
||||
if (goback)
|
||||
goto Login;
|
||||
}
|
||||
if (goback)
|
||||
goto Login;
|
||||
Console.WriteLine("password:");
|
||||
while (progress == 1)
|
||||
Thread.Sleep(10);
|
||||
if (goback)
|
||||
goto Login;
|
||||
|
||||
|
||||
TerminalBackend.PrefixEnabled = true;
|
||||
Shiftorium.LogOrphanedUpgrades = true;
|
||||
Desktop.InvokeOnWorkerThread(new Action(() =>
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
<Compile Include="IShiftOSWindow.cs" />
|
||||
<Compile Include="KernelWatchdog.cs" />
|
||||
<Compile Include="Localization.cs" />
|
||||
<Compile Include="LoginManager.cs" />
|
||||
<Compile Include="NotificationDaemon.cs" />
|
||||
<Compile Include="OutOfBoxExperience.cs" />
|
||||
<Compile Include="Paths.cs" />
|
||||
|
|
|
@ -267,6 +267,22 @@ namespace ShiftOS.Engine
|
|||
[ShifterHidden]
|
||||
public Dictionary<string, byte[]> AppIcons = new Dictionary<string, byte[]>();
|
||||
|
||||
[ShifterMeta("System")]
|
||||
[ShifterCategory("Login Screen")]
|
||||
[RequiresUpgrade("gui_based_login_screen")]
|
||||
[ShifterName("Login Screen Background Color")]
|
||||
[ShifterDescription("Change the background color of the login screen.")]
|
||||
public Color LoginScreenColor = Skin.DesktopBG;
|
||||
|
||||
[ShifterMeta("System")]
|
||||
[ShifterCategory("Login Screen")]
|
||||
[RequiresUpgrade("skinning;gui_based_login_screen")]
|
||||
[ShifterName("Login Screen Background Image")]
|
||||
[ShifterDescription("Set an image as your login screen!")]
|
||||
[Image("login")]
|
||||
public byte[] LoginScreenBG = null;
|
||||
|
||||
|
||||
[RequiresUpgrade("shift_screensaver")]
|
||||
[ShifterMeta("System")]
|
||||
[ShifterCategory("Screen saver")]
|
||||
|
|
Loading…
Reference in a new issue