private void SaveButtonApp_Click(object sender, EventArgs e) { // Save settings GuiViewSettings guisettings = new GuiViewSettings(); string btnPath = string.Empty; if (lstButtons.SelectedIndex > 0) btnPath = Buttons[lstButtons.SelectedIndex - 1]; GuiViewSettings.CustomButtonPath = btnPath; SettingsBase settingsBase = new SettingsBase(); settingsBase.SaveSettings<GuiViewSettings>("Graphical Settings", guisettings); controller.LoadButtons(); this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// Save view settings /// </summary> public void UpdateViewSettings() { GuiViewSettings guisettings = new GuiViewSettings(); // NEW: when closing from system tray you don't want to save this if (this.mainForm.WindowState != FormWindowState.Minimized) { guisettings.FormWidth = mainForm.Width; guisettings.FormHeight = mainForm.Height; guisettings.SplitterDistance = mainForm.Splitter.SplitterDistance; } guisettings.VScrollValue = mainForm.TabGeneral.VerticalScroll.Value; guisettings.HScrollValue = mainForm.TabGeneral.HorizontalScroll.Value; guisettings.ShowDetail = mainForm.ShowDetailMenuItem.Checked; guisettings.ShowStatusbar = mainForm.ShowStatusbarMenuItem.Checked; guisettings.ShowToolbar = mainForm.ShowToolbarMenuItem.Checked; foreach (ColumnHeader col in mainForm.TorrentsView.Columns) { guisettings.TorrentViewColumnWidth.Add(col.Width); } foreach (ColumnHeader col in mainForm.PeersView.Columns) { guisettings.PeerViewColumnWidth.Add(col.Width); } foreach (ColumnHeader col in mainForm.PiecesListView.Columns) { guisettings.PieceViewColumnWidth.Add(col.Width); } settingsBase.SaveSettings<GuiViewSettings>("Graphical Settings", guisettings); }