diff --git a/ShiftOS.WinForms/Applications/Artpad.cs b/ShiftOS.WinForms/Applications/Artpad.cs index 6f147ed..ec26cef 100644 --- a/ShiftOS.WinForms/Applications/Artpad.cs +++ b/ShiftOS.WinForms/Applications/Artpad.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 19fd223..6f37189 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/Dialog.Designer.cs b/ShiftOS.WinForms/Applications/Dialog.Designer.cs index 7f9a9b2..c75c0b3 100644 --- a/ShiftOS.WinForms/Applications/Dialog.Designer.cs +++ b/ShiftOS.WinForms/Applications/Dialog.Designer.cs @@ -52,11 +52,139 @@ namespace ShiftOS.WinForms.Applications /// 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; } } \ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/Dialog.cs b/ShiftOS.WinForms/Applications/Dialog.cs index c19595e..4d13e23 100644 --- a/ShiftOS.WinForms/Applications/Dialog.cs +++ b/ShiftOS.WinForms/Applications/Dialog.cs @@ -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 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 callback) + { + new Dialog().PromptTextInternal(title, message, callback); + } + + public void PromptYesNo(string title, string message, Action callback) + { + new Dialog().PromptYesNoInternal(title, message, callback); + } + + + + public void PromptYesNoInternal(string title, string message, Action 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); + }; + } } } diff --git a/ShiftOS.WinForms/Applications/Dialog.resx b/ShiftOS.WinForms/Applications/Dialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Dialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs index 082352b..db86bbe 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/MUDAuthenticator.cs b/ShiftOS.WinForms/Applications/MUDAuthenticator.cs index 1476037..32731ed 100644 --- a/ShiftOS.WinForms/Applications/MUDAuthenticator.cs +++ b/ShiftOS.WinForms/Applications/MUDAuthenticator.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index ee5336e..1756e99 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -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 { diff --git a/ShiftOS.WinForms/Applications/NameChanger.cs b/ShiftOS.WinForms/Applications/NameChanger.cs index 814526c..8483c22 100644 --- a/ShiftOS.WinForms/Applications/NameChanger.cs +++ b/ShiftOS.WinForms/Applications/NameChanger.cs @@ -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 { diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index f2afbab..82c86e5 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -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 { diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index d7dda28..5b9ea41 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index e97a4cb..eebebd9 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -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() diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index bb6d93e..49a7b7c 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index e40860f..42b103d 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 0a123d6..7b55ec2 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -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 { diff --git a/ShiftOS.WinForms/Applications/TextPad.cs b/ShiftOS.WinForms/Applications/TextPad.cs index fbec440..bbf4846 100644 --- a/ShiftOS.WinForms/Applications/TextPad.cs +++ b/ShiftOS.WinForms/Applications/TextPad.cs @@ -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 diff --git a/ShiftOS.WinForms/Applications/VirusScanner.cs b/ShiftOS.WinForms/Applications/VirusScanner.cs index 1b3405a..3582bd6 100644 --- a/ShiftOS.WinForms/Applications/VirusScanner.cs +++ b/ShiftOS.WinForms/Applications/VirusScanner.cs @@ -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 diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 144dc56..ad6c772 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -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 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 { diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 575cfaa..7d4d7b7 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -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", diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 0b247f3..3012488 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -244,6 +244,9 @@ ColorPicker.cs + + Dialog.cs + FileDialog.cs diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index c9287ff..e2b89fb 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -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; + } + /// /// Populates the app launcher. /// @@ -239,6 +253,10 @@ namespace ShiftOS.WinForms { apps.DropDownItems.Clear(); + Dictionary> sortedItems = new Dictionary>(); + + + 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()); + 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")) diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs index cadfa6d..3f9a88c 100644 --- a/ShiftOS_TheReturn/Desktop.cs +++ b/ShiftOS_TheReturn/Desktop.cs @@ -44,8 +44,10 @@ namespace ShiftOS.Engine /// The text displayed on the launcher item /// Whether or not an upgrade must be installed to see the launcher /// The ID of the upgrade - leave blank if requiresUpgrade is false. - public LauncherAttribute(string name, bool requiresUpgrade, string upgradeID = "") + /// The category that the item will appear in. + 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 diff --git a/ShiftOS_TheReturn/Infobox.cs b/ShiftOS_TheReturn/Infobox.cs index dfc72c2..8854b88 100644 --- a/ShiftOS_TheReturn/Infobox.cs +++ b/ShiftOS_TheReturn/Infobox.cs @@ -65,6 +65,11 @@ namespace ShiftOS.Engine _infobox.PromptText(title, message, callback); } + public static void PromptYesNo(string title, string message, Action callback) + { + _infobox.PromptYesNo(title, message, callback); + } + /// /// Inits an infobox /// @@ -80,5 +85,6 @@ namespace ShiftOS.Engine { void Open(string title, string msg); void PromptText(string title, string message, Action callback); + void PromptYesNo(string title, string message, Action callback); } }