コード例 #1
0
 public ServiceSettings(Profile selectedProfile)
 {
     _selectedProfile = selectedProfile;
     InitializeComponent();
     UpdateDropDown();
     PopulateListBoxes();
     chkStartup.Checked = Properties.Settings.Default.StartOnWindowsStartup;
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 private void CbxProfilesSelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbxProfiles.SelectedIndex != -1 && !_ignoreIndexChange)
     {
         SaveSelectedServices();
         _selectedProfile = Properties.Settings.Default.Profiles[cbxProfiles.SelectedIndex];    
         PopulateListBoxes();
     }            
 }
コード例 #4
0
 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();              
     }
 }
コード例 #5
0
ファイル: TabSettings.cs プロジェクト: davyxu/ServiceMonitor
        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);
        }