private GroupBox GetTaskBarClickAction() { var rbShowSettings = new RadioButton { Text = "Show Settings", Dock = DockStyle.Top }; rbShowSettings.Click += (sender, args) => { Program.Settings.TaskIconClickShowsSettings = rbShowSettings.Checked; INISettings.SaveSettings(Program.Settings); }; var rbArrangeWindows = new RadioButton { Text = "Arrange Windows", Dock = DockStyle.Bottom }; rbArrangeWindows.Click += (sender, args) => { Program.Settings.TaskIconClickShowsSettings = rbShowSettings.Checked; INISettings.SaveSettings(Program.Settings); }; rbShowSettings.Checked = Program.Settings.TaskIconClickShowsSettings; var grpBox = new GroupBox { Text = "Clicking on System Tray Icon will..." }; grpBox.Controls.Add(rbShowSettings); grpBox.Controls.Add(rbArrangeWindows); grpBox.Height = rbArrangeWindows.Height * 3; return(grpBox); }
private void ToolStripButtonClick(object sender, EventArgs e) { var newPlacement = GetPlacement(); var changeType = (PlacementChangeType)((ToolStripButton)sender).Tag; log.Info($"User triggered {changeType} for placement {newPlacement}"); switch (changeType) { case PlacementChangeType.Added: case PlacementChangeType.Updated: INISettings.SavePlacement(newPlacement); break; case PlacementChangeType.Deleted: INISettings.DeletePlacement(newPlacement); break; case PlacementChangeType.None: break; default: throw new ArgumentOutOfRangeException(); } PlacementChangedEvent?.Invoke(this, new PlacementChangedEventArgs(newPlacement, changeType)); }
public ProcessListItem(int id, string name, string caption) { this.id = id; Text = name; Caption = caption; // Check for a saved placement (_placement, _monitor) = INISettings.GetAppPlacement(name); SubItems.Add(new ListViewSubItem(this, _placement.Name)); SubItems.Add(new ListViewSubItem(this, _monitor)); }
private void SavePlacement() { INISettings.SaveAppPlacement(Text, _placement, _monitor); }