public void SetupAdvancedCategory(string cat) { flapps.Controls.Clear(); foreach (var app in LauncherItemList[cat]) { var catbtn = new Button(); catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; catbtn.ForeColor = LoadedSkin.Menu_TextColor; catbtn.MouseEnter += (o, a) => { catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; }; catbtn.MouseLeave += (o, a) => { catbtn.ForeColor = LoadedSkin.Menu_TextColor; }; catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); catbtn.Width = flapps.Width; catbtn.ImageAlign = ContentAlignment.MiddleRight; catbtn.Height = 24; catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name); flapps.Controls.Add(catbtn); catbtn.Show(); catbtn.Click += (o, a) => { pnladvancedal.Hide(); if (app is LuaLauncherItem) { var interp = new LuaInterpreter(); interp.ExecuteFile((app as LuaLauncherItem).LaunchPath); } else { IShiftOSWindow win = Activator.CreateInstance(app.LaunchType) as IShiftOSWindow; AppearanceManager.SetupWindow(win); } }; } }
/// <summary> /// Populates the app launcher. /// </summary> /// <returns>The app launcher.</returns> /// <param name="items">Items.</param> public void PopulateAppLauncher(LauncherItem[] items) { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { pnladvancedal.Visible = false; flapps.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; flcategories.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; pnlalsystemactions.BackColor = LoadedSkin.SystemPanelBackground; lbalstatus.BackColor = LoadedSkin.ALStatusPanelBackColor; //Fonts lbalstatus.Font = LoadedSkin.ALStatusPanelFont; lbalstatus.ForeColor = LoadedSkin.ALStatusPanelTextColor; btnshutdown.Font = LoadedSkin.ShutdownFont; //Upgrades btnshutdown.Visible = Shiftorium.UpgradeInstalled("al_shutdown"); //Alignments and positions. lbalstatus.TextAlign = LoadedSkin.ALStatusPanelAlignment; if (LoadedSkin.ShutdownButtonStyle == 2) { btnshutdown.Hide(); } else if (LoadedSkin.ShutdownButtonStyle == 1) { btnshutdown.Parent = pnlstatus; btnshutdown.BringToFront(); } else { btnshutdown.Parent = pnlalsystemactions; } if (LoadedSkin.ShutdownOnLeft) { btnshutdown.Location = LoadedSkin.ShutdownButtonFromSide; } else { btnshutdown.Left = (btnshutdown.Parent.Width - btnshutdown.Width) - LoadedSkin.ShutdownButtonFromSide.X; btnshutdown.Top = LoadedSkin.ShutdownButtonFromSide.Y; } //Images lbalstatus.BackgroundImage = GetImage("al_bg_status"); lbalstatus.BackgroundImageLayout = GetImageLayout("al_bg_status"); pnlalsystemactions.BackgroundImage = GetImage("al_bg_system"); pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system"); if (pnlalsystemactions.BackgroundImage != null) { btnshutdown.BackColor = Color.Transparent; } btnshutdown.Font = LoadedSkin.ShutdownFont; btnshutdown.ForeColor = LoadedSkin.ShutdownForeColor; pnladvancedal.Size = LoadedSkin.AALSize; pnlalsystemactions.Height = LoadedSkin.ALSystemActionHeight; pnlstatus.Height = LoadedSkin.ALSystemStatusHeight; flcategories.Width = LoadedSkin.AALCategoryViewWidth; this.flapps.Width = LoadedSkin.AALItemViewWidth; } if (DesktopFunctions.ShowDefaultElements == true) { apps.DropDownItems.Clear(); Dictionary <string, List <ToolStripMenuItem> > sortedItems = new Dictionary <string, List <ToolStripMenuItem> >(); flcategories.Controls.Clear(); LauncherItemList.Clear(); foreach (var kv in items) { var item = new ToolStripMenuItem(); item.Text = (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType); item.Image = (kv.LaunchType == null) ? null : SkinEngine.GetIcon(kv.LaunchType.Name); item.Click += (o, a) => { if (kv is LuaLauncherItem) { var interpreter = new Engine.Scripting.LuaInterpreter(); interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath); } else { Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow); } }; if (sortedItems.ContainsKey(kv.DisplayData.Category)) { sortedItems[kv.DisplayData.Category].Add(item); LauncherItemList[kv.DisplayData.Category].Add(kv); } else { sortedItems.Add(kv.DisplayData.Category, new List <ToolStripMenuItem>()); sortedItems[kv.DisplayData.Category].Add(item); LauncherItemList.Add(kv.DisplayData.Category, new List <LauncherItem> { kv }); } } foreach (var kv in sortedItems) { if (Shiftorium.IsInitiated == true) { if (Shiftorium.UpgradeInstalled("app_launcher_categories")) { var cat = GetALCategoryWithName(kv.Key); foreach (var subItem in kv.Value) { cat.DropDownItems.Add(subItem); } if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { var catbtn = new Button(); catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.ForeColor = LoadedSkin.Menu_TextColor; catbtn.MouseEnter += (o, a) => { catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; }; catbtn.MouseLeave += (o, a) => { catbtn.ForeColor = LoadedSkin.Menu_TextColor; }; catbtn.Text = kv.Key; catbtn.Width = flcategories.Width; catbtn.Height = 24; flcategories.Controls.Add(catbtn); catbtn.Show(); catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text); } } else { foreach (var subItem in kv.Value) { apps.DropDownItems.Add(subItem); } } } } if (Shiftorium.IsInitiated == true) { if (Shiftorium.UpgradeInstalled("al_shutdown")) { apps.DropDownItems.Add(new ToolStripSeparator()); var item = new ToolStripMenuItem(); item.Text = Localization.Parse("{SHUTDOWN}"); item.Click += (o, a) => { TerminalBackend.InvokeCommand("shutdown"); }; apps.DropDownItems.Add(item); if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { if (LoadedSkin.ShutdownButtonStyle == 2) { var catbtn = new Button(); catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; catbtn.ForeColor = LoadedSkin.Menu_TextColor; catbtn.MouseEnter += (o, a) => { catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; }; catbtn.MouseLeave += (o, a) => { catbtn.ForeColor = LoadedSkin.Menu_TextColor; }; catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.Text = "Shutdown"; catbtn.Width = flcategories.Width; catbtn.Height = 24; flcategories.Controls.Add(catbtn); catbtn.Show(); catbtn.Click += (o, a) => TerminalBackend.InvokeCommand("shutdown"); } } } } } LuaInterpreter.RaiseEvent("on_al_populate", items); }