/// <summary> /// Show settings, if wanted, detect defaults. /// </summary> /// <param name="Detect"></param> public void ShowSettings(bool detect) { String runningConnections = ""; foreach (VPNConfig c in m_configs) { if (c.Running) { runningConnections += "\r\n" + c.Name; } } if (runningConnections != "") { if (RTLMessageBox.Show(this, Program.res.GetString("BOX_Settings_Close") + "\r\n" + runningConnections, MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2, MessageBoxIcon.Exclamation) != DialogResult.Yes) { return; } } // remember visible-state, hide everything, unload everything bool reShow = Visible; niIcon.Visible = false; Hide(); if (Properties.Settings.Default.allowRemoteControl) { m_simpleComm.stopServer(); } UnloadConfigs(); // show settings, detect settings FrmSettings m_settingsDialog = new FrmSettings(); if (detect) { m_settingsDialog.Detect(); } m_settingsDialog.ShowDialog(); // reread settings, show icon, show form if needed ReadConfigs(); if (Properties.Settings.Default.allowRemoteControl) { m_simpleComm.startServer(); } niIcon.Visible = true; if (reShow) { Show(); } }
/// <summary> /// Show settings, if wanted, detect defaults. /// </summary> /// <param name="Detect"></param> public void ShowSettings(bool detect) { String runningConnections = ""; foreach (VPNConfig c in m_configs) { if (c.Running) runningConnections += "\r\n" + c.Name; } if (runningConnections != "") { if (RTLMessageBox.Show(this, Program.res.GetString("BOX_Settings_Close") + "\r\n" + runningConnections, MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2, MessageBoxIcon.Exclamation) != DialogResult.Yes) return; } // remember visible-state, hide everything, unload everything bool reShow = Visible; niIcon.Visible = false; Hide(); if (Properties.Settings.Default.allowRemoteControl) m_simpleComm.stopServer(); UnloadConfigs(); // show settings, detect settings FrmSettings m_settingsDialog = new FrmSettings(); if (detect) m_settingsDialog.Detect(); m_settingsDialog.ShowDialog(); // reread settings, show icon, show form if needed ReadConfigs(); if (Properties.Settings.Default.allowRemoteControl) m_simpleComm.startServer(); niIcon.Visible = true; if (reShow) Show(); }