private void CheckVisibilityMenu () { if(currentButtonActive.IsActive) myTransform.localPosition = showPosition; else { myTransform.localPosition = hidePoistion; currentButtonActive = null; } }
public formModules(ModuleHandler _module, UtilityHandler _utility) { module = _module; utility = _utility; InitializeComponent(); currentFilter = ButtonFilter.All; changelogOpen = false; GenerateButtons(currentFilter); GenerateHeaders(); this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - (this.Size.Width + 5), Screen.PrimaryScreen.WorkingArea.Height - (this.Size.Height + 5)); }
private void label_Click(object sender, EventArgs e) { Label lbl = (Label)sender; switch (lbl.Name) { case "lblAllModules": currentFilter = ButtonFilter.All; GenerateButtons(currentFilter); break; case "lblInstalledModules": currentFilter = ButtonFilter.Installed; GenerateButtons(currentFilter); break; case "lblAvailableModules": currentFilter = ButtonFilter.NotInstalled; GenerateButtons(currentFilter); break; } string pnlName = "pnlHead" + lbl.Name.Substring(3, lbl.Name.Length - 3); foreach (Control cntrl in this.Controls) { if (cntrl.Name.Contains("pnlHead")) { Panel pnl = (Panel)cntrl; if (pnl.Name == pnlName) { pnl.Visible = true; } else { pnl.Visible = false; } } } }
private void ShowCurrentInfo (ButtonFilter currentButton) { int index = buttons.IndexOf(currentButton); information.ForEach (c => c.SetActive (false)); information [index].SetActive (true); }
private void OnButtonSelected (ButtonFilter currentButton) { currentButtonActive = currentButton; ShowCurrentInfo (currentButton); }
private void GenerateButtons(ButtonFilter filter) { pnlButtons.Controls.Clear(); List <ModuleData> filtered = new List <ModuleData>(); switch (filter) { case ButtonFilter.All: filtered = module.InstalledModules.OrderBy(m => m.Name).ToList(); break; case ButtonFilter.Installed: filtered = module.InstalledModules.Where(m => m.IsActive == true).OrderBy(m => m.Name).ToList(); break; case ButtonFilter.NotInstalled: filtered = module.InstalledModules.Where(m => m.IsActive == false).OrderBy(m => m.Name).ToList(); break; } string modulePath = module.AppModulePath; int icony = 1; int y = 1; foreach (ModuleData data in filtered) { PictureBox icon = new PictureBox(); icon.SizeMode = PictureBoxSizeMode.StretchImage; if (File.Exists(data.Path + "\\" + data.Icon)) { var bytes = File.ReadAllBytes(data.Path + "\\" + data.Icon); var ms = new MemoryStream(bytes); icon.Image = Image.FromStream(ms); } else { icon.Image = Properties.Resources.Jovo_Logo1; } icon.Location = new Point(1, icony); icon.Size = new Size(28, 28); pnlButtons.Controls.Add(icon); Button button = new Button(); button.AutoSize = true; button.AutoSizeMode = AutoSizeMode.GrowAndShrink; button.BackColor = Color.White; button.FlatAppearance.BorderColor = Color.White; button.FlatAppearance.BorderSize = 1; button.FlatAppearance.MouseOverBackColor = Color.White; button.FlatStyle = FlatStyle.Flat; button.Font = new Font("Segoe UI", 10F, FontStyle.Regular); button.MouseEnter += btn_MouseEnter; button.MouseLeave += btn_MouseLeave; button.Click += btn_Click; button.Location = new Point(60, y); button.Name = "btn" + data.Name; button.Tag = data; button.Size = new Size(220, 30); button.Text = data.Text; pnlButtons.Controls.Add(button); y += 31; icony += 31; } if (filtered.Count > 0) { UpdateInfoPanel(filtered.Last()); } }