/// <summary> /// creates a new form /// </summary> /// <param name="config">parent config</param> public ViewVPNStatus(VPNConfig config) { InitializeComponent(); m_config = config; }
/// <summary> /// Creats a usercontrol /// </summary> /// <param name="config">parent which holgs this control</param> /// <seealso cref="init"/> public VPNInfoBox(VPNConfig config) { InitializeComponent(); m_config = config; }
/// <summary> /// Read all configs, initialize/add controls, etc. /// </summary> public void ReadConfigs() { // unload config first, if needed UnloadConfigs(); // find config files List <String> configs = UtilsHelper.LocateOpenVPNConfigs(Properties.Settings.Default.vpnconf); configs.AddRange(UtilsHelper.LocateOpenVPNManagerConfigs(false)); // insert configs in context menu and panel int atIndex = 2; if (configs != null) { toolStripSeparator2.Visible = true; foreach (string cfile in configs) { try { VPNConfig c = VPNConfig.CreateUserspaceConnection( Properties.Settings.Default.vpnbin, cfile, Properties.Settings.Default.debugLevel, Properties.Settings.Default.smartCardSupport, this); m_configs.Add(c); contextMenu.Items.Insert(atIndex++, c.Menuitem); pnlStatus.Controls.Add(c.InfoBox); } catch (ArgumentException e) { RTLMessageBox.Show(this, ProgramVPN.res.GetString("BOX_Config_Error") + Environment.NewLine + cfile + ": " + e.Message, MessageBoxIcon.Exclamation); } } } configs = UtilsHelper.LocateOpenVPNManagerConfigs(true); if (Helper.CanUseService()) { configs.AddRange(Helper.LocateOpenVPNServiceConfigs()); } toolStripSeparator2.Visible = configs.Count > 0; foreach (string cfile in configs) { try { VPNConfig c = VPNConfig.CreateServiceConnection( cfile, Properties.Settings.Default.debugLevel, Properties.Settings.Default.smartCardSupport, this); m_configs.Add(c); contextMenu.Items.Insert(atIndex++, c.Menuitem); pnlStatus.Controls.Add(c.InfoBox); } catch (ArgumentException e) { RTLMessageBox.Show(this, ProgramVPN.res.GetString("BOX_Config_Error") + Environment.NewLine + cfile + ": " + e.Message, MessageBoxIcon.Error); } } }