public void LoadProfile(string name) { if (!MonitorSwitcher.LoadDisplaySettings(ProfileFileFromName(name))) { trayIcon.BalloonTipTitle = "Failed to load Multi Monitor profile"; trayIcon.BalloonTipText = "MonitorSwitcher was unable to load the previously saved profile \"" + name + "\""; trayIcon.BalloonTipIcon = ToolTipIcon.Error; trayIcon.ShowBalloonTip(5000); } }
public void OnMenuSave(object sender, EventArgs e) { if (!MonitorSwitcher.SaveDisplaySettings(ProfileFileFromName(((ToolStripMenuItem)sender).Text))) { trayIcon.BalloonTipTitle = "Failed to save Multi Monitor profile"; trayIcon.BalloonTipText = "MonitorSwitcher was unable to save the current profile to name\"" + ((ToolStripMenuItem)sender).Text + "\""; trayIcon.BalloonTipIcon = ToolTipIcon.Error; trayIcon.ShowBalloonTip(5000); } }
public void OnMenuSaveAs(object sender, EventArgs e) { string profileName = "New Profile"; if (InputBox("Save as new profile", "Enter name of new profile", ref profileName) == DialogResult.OK) { string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars()); foreach (char invalidChar in invalidChars) { profileName = profileName.Replace(invalidChar.ToString(), ""); } if (profileName.Trim().Length > 0) { if (!MonitorSwitcher.SaveDisplaySettings(ProfileFileFromName(profileName))) { trayIcon.BalloonTipTitle = "Failed to save Multi Monitor profile"; trayIcon.BalloonTipText = "MonitorSwitcher was unable to save the current profile to a new profile with name\"" + profileName + "\""; trayIcon.BalloonTipIcon = ToolTipIcon.Error; trayIcon.ShowBalloonTip(5000); } } } }