aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/WinformsDesktop.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-02 13:51:29 -0500
committerMichael <[email protected]>2017-02-02 13:51:29 -0500
commit3a41ba45e7ac0df930066a79540f82544dbd8114 (patch)
tree341d707da673b0db997b5b4f93a4a3e42d047259 /ShiftOS.WinForms/WinformsDesktop.cs
parente55e195d88ba4a3bfea47cb8784564a43f426e48 (diff)
downloadshiftos_thereturn-3a41ba45e7ac0df930066a79540f82544dbd8114.tar.gz
shiftos_thereturn-3a41ba45e7ac0df930066a79540f82544dbd8114.tar.bz2
shiftos_thereturn-3a41ba45e7ac0df930066a79540f82544dbd8114.zip
Redesign the Infobox, categorize AL items
Diffstat (limited to 'ShiftOS.WinForms/WinformsDesktop.cs')
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.cs47
1 files changed, 46 insertions, 1 deletions
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;
+ }
+
/// <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"))