private void SaveSettings() { LocalSettings sett = Program.Settings; sett.MinToTray = MinToTrayCheckBox.Checked; sett.StartedBalloon = notificationOnAdditionCheckBox.Checked; sett.CompletedBaloon = notificationOnCompletionCheckBox.Checked; sett.ColorTray = ColorTrayIconCheckBox.Checked; sett.MinOnClose = minimizeOnCloseCheckBox.Checked; sett.UploadPrompt = UploadPromptCheckBox.Checked; sett.UseLocalCookies = useLocalCookiesCheckBox.Checked; sett.AutoCheckupdate = AutoCheckUpdateCheckBox.Checked; sett.UpdateToBeta = UpdateToBetaCheckBox.Checked; sett.AutoUpdateGeoip = AutoUpdateGeoipCheckBox.Checked; sett.DeleteTorrentWhenAdding = DeleteTorrentCheckBox.Checked; sett.DefaultDoubleClickAction = defaultActionComboBox.SelectedIndex; sett.PlinkPath = PlinkPathTextBox.Text; sett.StateImagePath = stateImageBrowse.FileName; sett.InfopanelImagePath = infopanelImageBrowse.FileName; sett.ToolbarImagePath = toolbarImageBrowse.FileName; sett.TrayImagePath = trayImageBrowse.FileName; sett.Servers.Clear(); foreach (ListViewItem lvi in listServers.Items) { TransmissionServer ts = lvi.Tag as TransmissionServer; sett.Servers.Add(lvi.Name, lvi.Tag as TransmissionServer); } if (AutoConnectComboBox.SelectedItem != null && sett.Servers.ContainsKey(AutoConnectComboBox.SelectedItem as string)) { sett.AutoConnect = AutoConnectComboBox.SelectedItem as string; } else { sett.AutoConnect = ""; } if (CurrentProfileComboBox.SelectedItem != null && sett.Servers.ContainsKey(CurrentProfileComboBox.SelectedItem as string)) { sett.CurrentProfile = CurrentProfileComboBox.SelectedItem as string; } else { sett.CurrentProfile = ""; } sett.DontSavePasswords = DontSavePasswordsCheckBox.Checked; sett.RssFeeds.Clear(); foreach (ListViewItem lvi in listRssFeeds.Items) { sett.RssFeeds.Add(lvi.Name, lvi.SubItems[1].Text); } sett.Commit(); if (StartOnSystemCheckBox.Checked) { Util.SetAutoStart(AboutDialog.AssemblyTitle, Toolbox.GetExecuteLocation()); } else { Util.UnSetAutoStart(AboutDialog.AssemblyTitle); } }
private void LoadSettings() { LocalSettings sett = Program.Settings; removeServerToolStripMenuItem.Enabled = removeServerButton.Enabled = tabServerSettings.Enabled = false; listServers.Items.Clear(); AutoConnectComboBox.Items.Clear(); AutoConnectComboBox.Items.Add("-"); AutoConnectComboBox.SelectedIndex = 0; CurrentProfileComboBox.Items.Clear(); foreach (KeyValuePair <string, TransmissionServer> s in sett.Servers) { listServers.Items.Add(CreateServerItem(s.Key, s.Value)); int a = AutoConnectComboBox.Items.Add(s.Key); int c = CurrentProfileComboBox.Items.Add(s.Key); if (s.Key.Equals(sett.AutoConnect)) { AutoConnectComboBox.SelectedIndex = a; } if (s.Key.Equals(sett.CurrentProfile)) { CurrentProfileComboBox.SelectedIndex = c; } } listRssFeeds.Items.Clear(); foreach (KeyValuePair <string, string> s in sett.RssFeeds) { listRssFeeds.Items.Add(new ListViewItem(new string[] { s.Key, s.Value })).Name = s.Key; } try { defaultActionComboBox.SelectedIndex = sett.DefaultDoubleClickAction; } catch { } notificationOnCompletionCheckBox.Enabled = notificationOnAdditionCheckBox.Enabled = minimizeOnCloseCheckBox.Enabled = ColorTrayIconCheckBox.Enabled = MinToTrayCheckBox.Checked = sett.MinToTray; notificationOnAdditionCheckBox.Checked = sett.StartedBalloon; notificationOnCompletionCheckBox.Checked = sett.CompletedBaloon; ColorTrayIconCheckBox.Checked = sett.ColorTray; minimizeOnCloseCheckBox.Checked = sett.MinOnClose; UploadPromptCheckBox.Checked = sett.UploadPrompt; useLocalCookiesCheckBox.Checked = sett.UseLocalCookies; AutoCheckUpdateCheckBox.Checked = sett.AutoCheckupdate; UpdateToBetaCheckBox.Checked = sett.UpdateToBeta; AutoUpdateGeoipCheckBox.Checked = sett.AutoUpdateGeoip; DeleteTorrentCheckBox.Checked = sett.DeleteTorrentWhenAdding; DontSavePasswordsCheckBox.Checked = sett.DontSavePasswords; PlinkPathTextBox.Text = sett.PlinkPath; stateImageBrowse.FileName = sett.StateImagePath; infopanelImageBrowse.FileName = sett.InfopanelImagePath; toolbarImageBrowse.FileName = sett.ToolbarImagePath; trayImageBrowse.FileName = sett.TrayImagePath; StartOnSystemCheckBox.Checked = Util.IsAutoStartEnabled(AboutDialog.AssemblyTitle, Toolbox.GetExecuteLocation()); }