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); }
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(); } }