Redesign the Infobox, categorize AL items
This commit is contained in:
parent
e55e195d88
commit
3a41ba45e7
23 changed files with 405 additions and 102 deletions
|
@ -41,7 +41,7 @@ using ShiftOS.Engine;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Artpad", true, "al_artpad")]
|
||||
[Launcher("Artpad", true, "al_artpad", "Graphics")]
|
||||
[RequiresUpgrade("artpad")]
|
||||
[WinOpen("artpad")]
|
||||
public partial class Artpad : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -37,7 +37,7 @@ using ShiftOS.Engine;
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[MultiplayerOnly]
|
||||
[Launcher("MUD Chat", true, "al_mud_chat")]
|
||||
[Launcher("MUD Chat", true, "al_mud_chat", "Networking")]
|
||||
[RequiresUpgrade("mud_fundamentals")]
|
||||
[WinOpen("chat")]
|
||||
public partial class Chat : UserControl, IShiftOSWindow
|
||||
|
|
132
ShiftOS.WinForms/Applications/Dialog.Designer.cs
generated
132
ShiftOS.WinForms/Applications/Dialog.Designer.cs
generated
|
@ -52,11 +52,139 @@ namespace ShiftOS.WinForms.Applications
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.pbicon = new System.Windows.Forms.PictureBox();
|
||||
this.btnok = new System.Windows.Forms.Button();
|
||||
this.flyesno = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnno = new System.Windows.Forms.Button();
|
||||
this.btnyes = new System.Windows.Forms.Button();
|
||||
this.lbmessage = new System.Windows.Forms.Label();
|
||||
this.txtinput = new System.Windows.Forms.TextBox();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbicon)).BeginInit();
|
||||
this.flyesno.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.txtinput);
|
||||
this.panel1.Controls.Add(this.lbmessage);
|
||||
this.panel1.Controls.Add(this.flyesno);
|
||||
this.panel1.Controls.Add(this.btnok);
|
||||
this.panel1.Controls.Add(this.pbicon);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(341, 177);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// pbicon
|
||||
//
|
||||
this.pbicon.Location = new System.Drawing.Point(14, 19);
|
||||
this.pbicon.Name = "pbicon";
|
||||
this.pbicon.Size = new System.Drawing.Size(64, 64);
|
||||
this.pbicon.TabIndex = 0;
|
||||
this.pbicon.TabStop = false;
|
||||
//
|
||||
// btnok
|
||||
//
|
||||
this.btnok.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnok.AutoSize = true;
|
||||
this.btnok.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnok.Location = new System.Drawing.Point(149, 140);
|
||||
this.btnok.Name = "btnok";
|
||||
this.btnok.Size = new System.Drawing.Size(32, 23);
|
||||
this.btnok.TabIndex = 1;
|
||||
this.btnok.Text = "OK";
|
||||
this.btnok.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// flyesno
|
||||
//
|
||||
this.flyesno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flyesno.AutoSize = true;
|
||||
this.flyesno.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flyesno.Controls.Add(this.btnyes);
|
||||
this.flyesno.Controls.Add(this.btnno);
|
||||
this.flyesno.Location = new System.Drawing.Point(129, 134);
|
||||
this.flyesno.Name = "flyesno";
|
||||
this.flyesno.Size = new System.Drawing.Size(78, 29);
|
||||
this.flyesno.TabIndex = 2;
|
||||
this.flyesno.WrapContents = false;
|
||||
//
|
||||
// btnno
|
||||
//
|
||||
this.btnno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnno.AutoSize = true;
|
||||
this.btnno.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnno.Location = new System.Drawing.Point(44, 3);
|
||||
this.btnno.Name = "btnno";
|
||||
this.btnno.Size = new System.Drawing.Size(31, 23);
|
||||
this.btnno.TabIndex = 3;
|
||||
this.btnno.Text = "No";
|
||||
this.btnno.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnyes
|
||||
//
|
||||
this.btnyes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnyes.AutoSize = true;
|
||||
this.btnyes.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnyes.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnyes.Name = "btnyes";
|
||||
this.btnyes.Size = new System.Drawing.Size(35, 23);
|
||||
this.btnyes.TabIndex = 4;
|
||||
this.btnyes.Text = "Yes";
|
||||
this.btnyes.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lbmessage
|
||||
//
|
||||
this.lbmessage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbmessage.Location = new System.Drawing.Point(85, 19);
|
||||
this.lbmessage.Name = "lbmessage";
|
||||
this.lbmessage.Size = new System.Drawing.Size(253, 94);
|
||||
this.lbmessage.TabIndex = 3;
|
||||
this.lbmessage.Text = "label1";
|
||||
this.lbmessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// txtinput
|
||||
//
|
||||
this.txtinput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtinput.Location = new System.Drawing.Point(88, 116);
|
||||
this.txtinput.Name = "txtinput";
|
||||
this.txtinput.Size = new System.Drawing.Size(250, 20);
|
||||
this.txtinput.TabIndex = 4;
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Text = "{DIALOG_NAME}";
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "Dialog";
|
||||
this.Size = new System.Drawing.Size(341, 177);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbicon)).EndInit();
|
||||
this.flyesno.ResumeLayout(false);
|
||||
this.flyesno.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label lbmessage;
|
||||
private System.Windows.Forms.FlowLayoutPanel flyesno;
|
||||
private System.Windows.Forms.Button btnyes;
|
||||
private System.Windows.Forms.Button btnno;
|
||||
private System.Windows.Forms.Button btnok;
|
||||
private System.Windows.Forms.PictureBox pbicon;
|
||||
private System.Windows.Forms.TextBox txtinput;
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ using ShiftOS.Engine;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
public partial class Dialog : UserControl, IShiftOSWindow
|
||||
public partial class Dialog : UserControl, IShiftOSWindow, IInfobox
|
||||
{
|
||||
public Dialog()
|
||||
{
|
||||
|
@ -58,5 +58,81 @@ namespace ShiftOS.WinForms.Applications
|
|||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
internal void OpenInternal(string title, string msg)
|
||||
{
|
||||
AppearanceManager.SetupWindow(this);
|
||||
this.Parent.Text = title;
|
||||
lbmessage.Text = msg;
|
||||
txtinput.Hide();
|
||||
flyesno.Hide();
|
||||
btnok.Show();
|
||||
btnok.Click += (o, a) =>
|
||||
{
|
||||
AppearanceManager.Close(this);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public void Open(string title, string msg)
|
||||
{
|
||||
new Dialog().OpenInternal(title, msg);
|
||||
}
|
||||
|
||||
public void PromptTextInternal(string title, string message, Action<string> callback)
|
||||
{
|
||||
AppearanceManager.SetupWindow(this);
|
||||
this.Parent.Text = title;
|
||||
lbmessage.Text = message;
|
||||
txtinput.Show();
|
||||
flyesno.Hide();
|
||||
btnok.Show();
|
||||
btnok.Click += (o, a) =>
|
||||
{
|
||||
callback?.Invoke(txtinput.Text);
|
||||
AppearanceManager.Close(this);
|
||||
};
|
||||
txtinput.KeyDown += (o, a) =>
|
||||
{
|
||||
if(a.KeyCode == Keys.Enter)
|
||||
{
|
||||
a.SuppressKeyPress = true;
|
||||
callback?.Invoke(txtinput.Text);
|
||||
AppearanceManager.Close(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void PromptText(string title, string message, Action<string> callback)
|
||||
{
|
||||
new Dialog().PromptTextInternal(title, message, callback);
|
||||
}
|
||||
|
||||
public void PromptYesNo(string title, string message, Action<bool> callback)
|
||||
{
|
||||
new Dialog().PromptYesNoInternal(title, message, callback);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void PromptYesNoInternal(string title, string message, Action<bool> callback)
|
||||
{
|
||||
AppearanceManager.SetupWindow(this);
|
||||
this.Parent.Text = title;
|
||||
lbmessage.Text = message;
|
||||
txtinput.Hide();
|
||||
flyesno.Show();
|
||||
btnok.Hide();
|
||||
btnyes.Click += (o, a) =>
|
||||
{
|
||||
callback?.Invoke(true);
|
||||
AppearanceManager.Close(this);
|
||||
};
|
||||
btnno.Click += (o, a) =>
|
||||
{
|
||||
callback?.Invoke(false);
|
||||
AppearanceManager.Close(this);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
120
ShiftOS.WinForms/Applications/Dialog.resx
Normal file
120
ShiftOS.WinForms/Applications/Dialog.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>
|
|
@ -39,7 +39,7 @@ using ShiftOS.Engine;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("File Skimmer", true, "al_file_skimmer")]
|
||||
[Launcher("File Skimmer", true, "al_file_skimmer", "Utilities")]
|
||||
[RequiresUpgrade("file_skimmer")]
|
||||
[WinOpen("file_skimmer")]
|
||||
public partial class FileSkimmer : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -37,7 +37,7 @@ using ShiftOS.Engine;
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[MultiplayerOnly]
|
||||
[Launcher("MUD Administrator", true, "al_mud_cracker")]
|
||||
[Launcher("MUD Administrator", true, "al_mud_cracker", "Administration")]
|
||||
[RequiresUpgrade("mud_cracker")]
|
||||
[WinOpen("mud_administrator")]
|
||||
public partial class MUDAuthenticator : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -39,7 +39,7 @@ using ShiftOS.WinForms.Tools;
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[RequiresUpgrade("mud_fundamentals")]
|
||||
[Launcher("MUD Control Centre", true, "al_mud_control_centre")]
|
||||
[Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")]
|
||||
[WinOpen("mud_control_centre")]
|
||||
public partial class MUDControlCentre : UserControl, IShiftOSWindow
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ using ShiftOS.Engine;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications {
|
||||
|
||||
[Launcher("Name Changer", true, "al_name_changer")]
|
||||
[Launcher("Name Changer", true, "al_name_changer", "Customization")]
|
||||
[RequiresUpgrade("name_changer")]
|
||||
[WinOpen("name_changer")]
|
||||
public partial class NameChanger : UserControl, IShiftOSWindow {
|
||||
|
|
|
@ -37,7 +37,7 @@ using ShiftOS.Objects;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Pong", true, "al_pong")]
|
||||
[Launcher("Pong", true, "al_pong", "Games")]
|
||||
[WinOpen("pong")]
|
||||
public partial class Pong : UserControl, IShiftOSWindow
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ using ShiftOS.WinForms.Tools;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Shifter", true, "al_shifter")]
|
||||
[Launcher("Shifter", true, "al_shifter", "Customization")]
|
||||
[RequiresUpgrade("shifter")]
|
||||
[WinOpen("shifter")]
|
||||
public partial class Shifter : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -13,7 +13,7 @@ using static ShiftOS.Engine.SkinEngine;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Shiftnet", false)]
|
||||
[Launcher("Shiftnet", false, null, "Networking")]
|
||||
public partial class Shiftnet : UserControl, IShiftOSWindow
|
||||
{
|
||||
public Shiftnet()
|
||||
|
|
|
@ -37,7 +37,7 @@ using static ShiftOS.Engine.SkinEngine;
|
|||
using backend = ShiftOS.Engine.Shiftorium;
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Shiftorium", true, "al_shiftorium")]
|
||||
[Launcher("Shiftorium", true, "al_shiftorium", "Utilities")]
|
||||
[RequiresUpgrade("shiftorium_gui")]
|
||||
[WinOpen("shiftorium")]
|
||||
public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -37,7 +37,7 @@ using ShiftOS.WinForms.Tools;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Skin Loader", true, "al_skin_loader")]
|
||||
[Launcher("Skin Loader", true, "al_skin_loader", "Customization")]
|
||||
[RequiresUpgrade("skinning")]
|
||||
[WinOpen("skin_loader")]
|
||||
public partial class Skin_Loader : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -46,7 +46,7 @@ using ShiftOS.Objects;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Terminal", false)]
|
||||
[Launcher("Terminal", false, null, "Utilities")]
|
||||
[WinOpen("terminal")]
|
||||
public partial class Terminal : UserControl, IShiftOSWindow
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ using ShiftOS.Engine;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("TextPad", true, "al_textpad")]
|
||||
[Launcher("TextPad", true, "al_textpad", "Accessories")]
|
||||
[RequiresUpgrade("textpad")]
|
||||
[WinOpen("textpad")]
|
||||
public partial class TextPad : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -39,7 +39,7 @@ using static ShiftOS.Objects.ShiftFS.Utils;
|
|||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[Launcher("Virus Scanner", true, "al_virus_scanner")]
|
||||
[Launcher("Virus Scanner", true, "al_virus_scanner", "Administration")]
|
||||
[RequiresUpgrade("virus_scanner")]
|
||||
[WinOpen("virus_scanner")]
|
||||
public partial class VirusScanner : UserControl, IShiftOSWindow
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace ShiftOS.WinForms
|
|||
};
|
||||
AppearanceManager.Initiate(new WinformsWindowManager());
|
||||
OutOfBoxExperience.Init(new Oobe());
|
||||
Infobox.Init(new WinformsInfobox());
|
||||
Infobox.Init(new Dialog());
|
||||
FileSkimmerBackend.Init(new WinformsFSFrontend());
|
||||
var desk = new WinformsDesktop();
|
||||
Desktop.Init(desk);
|
||||
|
@ -79,84 +79,6 @@ namespace ShiftOS.WinForms
|
|||
}
|
||||
}
|
||||
|
||||
internal class WinformsInfobox : IInfobox
|
||||
{
|
||||
public void Open(string title, string msg)
|
||||
{
|
||||
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);
|
||||
btnok.Show(); btnok.Click += (o, a) =>
|
||||
{
|
||||
frm.Close();
|
||||
};
|
||||
pnl.Controls.Add(flow);
|
||||
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 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
|
||||
{
|
||||
|
|
|
@ -303,10 +303,10 @@
|
|||
Dependencies: "mud_fundamentals;app_launcher"
|
||||
},
|
||||
{
|
||||
Name: "Another test upgrade",
|
||||
Cost: 1,
|
||||
Description: "Read the ID or Name",
|
||||
Dependencies: "test_upgrade"
|
||||
Name: "App Launcher Categories",
|
||||
Cost: 1000,
|
||||
Dependencies: "app_launcher",
|
||||
Description: "Is your App Launcher getting full of items? Perhaps a little too full? Are you having trouble finding things? This upgrade should help - it'll sort all App Launcher items into categories for you."
|
||||
},
|
||||
{
|
||||
Name: "Draggable windows",
|
||||
|
|
|
@ -244,6 +244,9 @@
|
|||
<EmbeddedResource Include="Applications\ColorPicker.resx">
|
||||
<DependentUpon>ColorPicker.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\Dialog.resx">
|
||||
<DependentUpon>Dialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\FileDialog.resx">
|
||||
<DependentUpon>FileDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -230,6 +230,20 @@ namespace ShiftOS.WinForms
|
|||
PopulatePanelButtons();
|
||||
}
|
||||
|
||||
public ToolStripMenuItem GetALCategoryWithName(string text)
|
||||
{
|
||||
foreach(ToolStripMenuItem menuitem in apps.DropDownItems)
|
||||
{
|
||||
if (menuitem.Text == text)
|
||||
return menuitem;
|
||||
}
|
||||
|
||||
var itm = new ToolStripMenuItem();
|
||||
itm.Text = text;
|
||||
apps.DropDownItems.Add(itm);
|
||||
return itm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populates the app launcher.
|
||||
/// </summary>
|
||||
|
@ -239,6 +253,10 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
apps.DropDownItems.Clear();
|
||||
|
||||
Dictionary<string, List<ToolStripMenuItem>> sortedItems = new Dictionary<string, List<ToolStripMenuItem>>();
|
||||
|
||||
|
||||
|
||||
foreach (var kv in items)
|
||||
{
|
||||
var item = new ToolStripMenuItem();
|
||||
|
@ -247,7 +265,34 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
|
||||
};
|
||||
apps.DropDownItems.Add(item);
|
||||
if (sortedItems.ContainsKey(kv.DisplayData.Category))
|
||||
{
|
||||
sortedItems[kv.DisplayData.Category].Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
sortedItems.Add(kv.DisplayData.Category, new List<ToolStripMenuItem>());
|
||||
sortedItems[kv.DisplayData.Category].Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var kv in sortedItems)
|
||||
{
|
||||
if (Shiftorium.UpgradeInstalled("app_launcher_categories"))
|
||||
{
|
||||
var cat = GetALCategoryWithName(kv.Key);
|
||||
foreach(var subItem in kv.Value)
|
||||
{
|
||||
cat.DropDownItems.Add(subItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(var subItem in kv.Value)
|
||||
{
|
||||
apps.DropDownItems.Add(subItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Shiftorium.UpgradeInstalled("al_shutdown"))
|
||||
|
|
|
@ -44,8 +44,10 @@ namespace ShiftOS.Engine
|
|||
/// <param name="name">The text displayed on the launcher item</param>
|
||||
/// <param name="requiresUpgrade">Whether or not an upgrade must be installed to see the launcher</param>
|
||||
/// <param name="upgradeID">The ID of the upgrade - leave blank if requiresUpgrade is false.</param>
|
||||
public LauncherAttribute(string name, bool requiresUpgrade, string upgradeID = "")
|
||||
/// <param name="category">The category that the item will appear in.</param>
|
||||
public LauncherAttribute(string name, bool requiresUpgrade, string upgradeID = "", string category = "Other")
|
||||
{
|
||||
Category = category;
|
||||
Name = name;
|
||||
RequiresUpgrade = requiresUpgrade;
|
||||
ID = upgradeID;
|
||||
|
@ -54,6 +56,7 @@ namespace ShiftOS.Engine
|
|||
public string Name { get; set; }
|
||||
public bool RequiresUpgrade { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string Category { get; private set; }
|
||||
public bool UpgradeInstalled
|
||||
{
|
||||
get
|
||||
|
|
|
@ -65,6 +65,11 @@ namespace ShiftOS.Engine
|
|||
_infobox.PromptText(title, message, callback);
|
||||
}
|
||||
|
||||
public static void PromptYesNo(string title, string message, Action<bool> callback)
|
||||
{
|
||||
_infobox.PromptYesNo(title, message, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inits an infobox
|
||||
/// </summary>
|
||||
|
@ -80,5 +85,6 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
void Open(string title, string msg);
|
||||
void PromptText(string title, string message, Action<string> callback);
|
||||
void PromptYesNo(string title, string message, Action<bool> callback);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue