/// <summary> /// Event fired when tmrCheckPrimaryScreen elapses - used to ensure we have recorded the correct primary display /// </summary> private void tmrCheckPrimaryScreen_Tick(object sender, EventArgs e) { if (RegistryManagement.GetRegistryValue("PrimaryMonitor") != VNC_Screen.GetPrimaryScreen().DeviceName) { RegistryManagement.SetRegistryValue("PrimaryMonitor", VNC_Screen.GetPrimaryScreen().DeviceName); } }
/// <summary> /// Event fired when tmrShowSwitchUI elapses - used to force frmSwitchUI to show if invoked via an appropriate command /// </summary> private void tmrShowSwitchUI_Tick(object sender, EventArgs e) { bool showuinow = false; if (RegistryManagement.GetRegistryValue("ShowUINow") != "") { showuinow = Convert.ToBoolean(RegistryManagement.GetRegistryValue("ShowUINow")); } if (showuinow) { RegistryManagement.SetRegistryValue("ShowUINow", "false"); ShowSwitchUI(true); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; string[] envargs = Environment.GetCommandLineArgs(); //Run custom actions if command line switches are present if (envargs.Length > 1) { for (int index = 1; index < envargs.Length; index++) { envargs[index] = envargs[index].TrimStart('-'); switch (envargs[index]) { //If application already running, force the UI to appear (this is used in Desktop shortcut) case "showui": if (AlreadyRunning()) { Application.Run(new frmTray(true)); } else { RegistryManagement.SetRegistryValue("ShowUINow", "true"); } break; //Start application with main UI not visible, used for logon event case "startup": Application.Run(new frmTray(false)); break; default: break; } } } else { //If already running, show UI, else exit program if (AlreadyRunning()) { Application.Run(new frmTray(true)); } } }
/// <summary> /// When the combobox value is changed, set the Registry value using the selected value, and update position of form /// </summary> private void cmbDisplaySelector_SelectedIndexChanged(object sender, EventArgs e) { RegistryManagement.SetRegistryValue("DisplayDevice", cmbDisplaySelector.SelectedValue.ToString()); RefreshSwitchUI(false); }