Exemplo n.º 1
0
 private Profile ChangeToProfile(Profile selection)
 {
     if (File.Exists(selection.Path))
     {
         MonitorSwitcher.LoadDisplaySettings(selection.Path);
     }
     else
     {
         if (MessageBox.Show("Profile not found. Delete profile?", "Error", MessageBoxButtons.YesNo,
                             MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
         {
             bDelete_Click(null, null);
         }
     }
     return(selection);
 }
Exemplo n.º 2
0
        private void bSaveProfile_Click(object sender, EventArgs e)
        {
            if (sfdProfileXML.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                MonitorSwitcher.SaveDisplaySettings(sfdProfileXML.FileName);

                //Seralise the information
                Profile profile = new Profile {
                    Name = Path.GetFileNameWithoutExtension(sfdProfileXML.FileName),
                    Path = sfdProfileXML.FileName
                };
                string serialisedProfile = SerialiseProfile(profile);

                AddToProfileList(profile);
                Properties.Settings.Default.Profiles.Add(serialisedProfile);
                Properties.Settings.Default.Save();
            }
        }