public void SidebarButton_Click(object sender, EventArgs e) { var s = (Panel)sender; if (s.Name.Contains("al")) { var itm = (ApplauncherItem)s.Tag; var li = new LuaInterpreter(); li.mod(itm.Lua); li = null; } else if (s.Name.Contains("ashow")) { pnlapplauncher.Show(); foreach (Control ctrl in this.Controls) { ctrl.MouseDown += (object se, MouseEventArgs a) => { pnlapplauncher.Hide(); }; } } else { try { PanelButton pbtn = (PanelButton)s.Tag; API.ToggleMinimized(pbtn.FormToManage); } catch (Exception ex) { } } }
private void ResetPanelButtons() { // Clear the panel button list. this.PanelButtonList.Controls.Clear(); foreach (var window in CurrentSystem.GetWindows()) { // Create a panel button for the window. var panelButton = new PanelButton(this, window); // Add it to our UI. this.PanelButtonList.Controls.Add(panelButton); } }
public static void CloseForm(Form formToClose, PanelButton pbtn, WindowAnimationStyle style) { var t = new Timer(); switch (style) { case WindowAnimationStyle.Fade: _CanClose = false; t.Interval = API.CurrentSkin.WindowFadeTime; t.Tick += (object s, EventArgs a) => { if (API.Upgrades["fancyeffects"] == true) { try { if (formToClose.Opacity > 0) { formToClose.Invoke(new Action(() => { formToClose.Opacity -= Convert.ToDouble(API.CurrentSkin.WindowFadeSpeed); formToClose.Refresh(); })); } else { API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); t.Stop(); } } catch (Exception ex) { formToClose = null; } } else { API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); t.Stop(); } }; t.Start(); break; case WindowAnimationStyle.Zoom: _CanClose = false; t.Interval = 1; int w = formToClose.Width; int h = formToClose.Height; int maxw = w / 2; int maxh = h / 2; t.Tick += (object s, EventArgs a) => { if (API.Upgrades["fancyeffects"] == true) { formToClose.MinimumSize = new Size(maxw, maxh); formToClose.Opacity -= 0.1; formToClose.Left += 50; formToClose.Top += 50; formToClose.Width -= 50; formToClose.Height -= 50; if (formToClose.Size == formToClose.MinimumSize) { API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); t.Stop(); } } else { API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); t.Stop(); } }; t.Start(); break; break; case WindowAnimationStyle.ToAppLauncher: _CanClose = false; t.Interval = 1; int w2 = formToClose.Width; int h2 = formToClose.Height; int maxw2 = w2 / 2; int maxh2 = h2 / 2; t.Tick += (object s, EventArgs a) => { formToClose.MinimumSize = new Size(maxw2, maxh2); formToClose.Opacity -= 0.1; if (API.Upgrades["fancyeffects"] == true) { switch (API.CurrentSkin.desktoppanelposition) { case "Bottom": formToClose.Left += 50; formToClose.Top += 50; break; case "Top": formToClose.Left -= 50; formToClose.Top -= 50; break; } formToClose.Width -= 50; formToClose.Height -= 50; if (formToClose.Size == formToClose.MinimumSize) { API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); t.Stop(); } } else { API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); t.Stop(); } }; t.Start(); break; default: API.PanelButtons.Remove(pbtn); API.CurrentSession.SetupPanelButtons(); API.UpdateWindows(); formToClose.Dispose(); //Room for more animations, but just close the form if none is selected. break; } }
// ERROR: Handles clauses are not supported in C# private void Template_Load(object sender, EventArgs e) { setupall(); if (ParentForm.Name == "Terminal" && API.Upgrades["windowedterminal"] == false) { HideAll(); } string x = ParentForm.Width.ToString(); string y = ParentForm.Height.ToString(); ParentForm.MinimumSize = new Size(Convert.ToInt16(x), Convert.ToInt16(y)); string mx = ParentForm.MinimumSize.Width.ToString(); string my = ParentForm.MinimumSize.Height.ToString(); Form frm = ParentForm; pbtn = new PanelButton(AppName, AppIcon, ref frm); API.PanelButtons.Add(pbtn); if (API.CurrentSession != null) { API.CurrentSession.SetupPanelButtons(); } ParentForm.FormClosing += new FormClosingEventHandler(this.Clock_FormClosing); var vtimer = new Timer(); vtimer.Interval = 1000; vtimer.Tick += (object s, EventArgs a) => { try { if (API.Upgrades["titlebar"] == true) { titlebar.Show(); } else { titlebar.Hide(); } } catch (Exception ex) { API.LogException(ex.Message, false); } if (Viruses.InfectedWith("windowmicrofier")) { if (this.Width > 0) { this.ParentForm.MinimumSize = new Size(0, 0); this.ParentForm.Width -= 1; } if (this.Height > 0) { this.ParentForm.Height -= 1; } } try { if (this.ParentForm.TopMost == API.CurrentSession.UnityEnabled) { this.ParentForm.TopMost = !this.ParentForm.TopMost; } } catch { //FAIL. } }; vtimer.Start(); //try { ParentForm.Name = AppName.ToLower().Replace(" ", "_"); /*} * catch(Exception ex) * { * ParentForm.Name = "null"; * }*/ ParentForm.Tag = ParentForm.Location; WindowComposition.WindowsEverywhere(this.ParentForm); }