public void InstallConfiguration(ConnectionDefinitionFile pConfigFile) { var fileName = Configuration.Configuration.Current.ConnecitonDataPath + "\\" + pConfigFile.ConnectionName + ".openvpn"; if (pConfigFile.AuthorityCert != null) { CertificateManager.Current.InstallCertificate(pConfigFile.AuthorityCert); } pConfigFile.SaveFile(fileName); var configuration = new OpenVPNConfiguration(_configs.Count, pConfigFile); configuration.Deleted += OnDeleted; _configs.Add(configuration); if (TapDeviceManager.GetTapDevices().ToArray().Length < _configs.Count) { TapDeviceManager.SetupTapDevice(); } if (NewConfiguration != null) { NewConfiguration(configuration); } }
public OpenVPNConfigurations() { foreach (var co in _configs) { var con = co; con.OutputRecieved += pLine => OnOutputRecieved(con, pLine); con.StatusChanged += pStatus => OnStatusChanged(con, pStatus); con.InterfaceChanged += pInterface => OnInterfaceChanged(con, pInterface); con.AuthInfoRequired += () => OnAuthInfoRequired(con); } while (TapDeviceManager.GetTapDevices().ToArray().Length < _configs.Count) { TapDeviceManager.SetupTapDevice(); } foreach (var config in _configs) { config.Deleted += OnDeleted; } }
public MainWindow() { InitializeComponent(); try { if (TapDeviceManager.GetTapDevices().ToArray().Length == 0) { TapDeviceManager.SetupTapDevice(); } } catch (Win32Exception we) { TapDeviceManager.SetupTapDevice(); } var dialogs = new ViewModelDialogs(this); _viewModel = new ConfigurationViewModel(dialogs); DataContext = _viewModel; GlassMargin = new Margins(12, 12, 105, 12); }