public ServiceSettings(Profile selectedProfile) { _selectedProfile = selectedProfile; InitializeComponent(); UpdateDropDown(); PopulateListBoxes(); chkStartup.Checked = Properties.Settings.Default.StartOnWindowsStartup; }
private void BtnDeleteClick(object sender, EventArgs e) { int selectedIndex = cbxProfiles.SelectedIndex; selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : 0; _selectedProfile = Properties.Settings.Default.Profiles[selectedIndex]; Properties.Settings.Default.Profiles.Remove((Profile)cbxProfiles.SelectedItem); PopulateListBoxes(); UpdateDropDown(); }
private void CbxProfilesSelectedIndexChanged(object sender, EventArgs e) { if (cbxProfiles.SelectedIndex != -1 && !_ignoreIndexChange) { SaveSelectedServices(); _selectedProfile = Properties.Settings.Default.Profiles[cbxProfiles.SelectedIndex]; PopulateListBoxes(); } }
private void BtnNewClick(object sender, EventArgs e) { var dlg = new InputText { Title = "Enter Profile Name", TextLabel = "Profile Name" }; if (dlg.ShowDialog() == DialogResult.OK) { if (!IsValidName(dlg.TextValue)) { MessageBox.Show(Properties.Resources.Profile_name_should_be_unique_Error_Text, Properties.Resources.Error_Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SaveSelectedServices(); _selectedProfile = new Profile {Name = dlg.TextValue}; Properties.Settings.Default.Profiles.Add(_selectedProfile); PopulateListBoxes(); UpdateDropDown(); } }
public static void SaveSettings(string filename, List<TabInfo> list ) { var profile = new Profile(); profile.Tabs = list; var ser = new JavaScriptSerializer(); var content = ser.Serialize(profile); File.WriteAllText(filename, content, Encoding.UTF8); }