public ProxyServerConfigurationViewModel(IProxyConfigurationService proxyConfService, IDialogMessageService dialogMessageService) { _proxyConfService = proxyConfService; _dialogMessageService = dialogMessageService; ProxyConfigurationList = new ObservableCollection <ProxyConfiguration>(); ProxyConfigurationItem = new ProxyConfiguration(); EnableControl = true; GetAllProxyConfCommand = new RelayCommand(GetProxyConfigurationList); ShowProxyConfigurationCommandd = new RelayCommand <ProxyConfiguration>(ShowProxyConfiguration); SaveCommand = new RelayCommand(SaveProxyConfiguration); ApplyProxyConfCommand = new RelayCommand(ApplyProxyConf); ClearProxyConfCommand = new RelayCommand(ClearProxy); }
/// <summary> /// Initializes a new instance of the LicenseManager class. /// </summary> /// <param name="licenseCacheStorage">The reference to the license cache /// storage object.</param> /// <param name="proxyConfigurationService">The reference to the proxy configuration /// service object.</param> public LicenseManager( ILicenseCacheStorage licenseCacheStorage, IProxyConfigurationService proxyConfigurationService) { Debug.Assert(licenseCacheStorage != null); Debug.Assert(proxyConfigurationService != null); _licenseCacheStorage = licenseCacheStorage; _proxyConfigurationService = proxyConfigurationService; this.LicenseActivationStatus = LicenseActivationStatus.None; if (this.AppLicense != null) { this.LicenseActivationStatus = LicenseActivationStatus.Activated; } else if (this.ExpiredLicense != null) { this.LicenseActivationStatus = LicenseActivationStatus.Expired; } }
/// <summary> /// Method shows user a dialog that asks proxy server credentials /// </summary> /// <param name="proxyConfigurationService">The reference to the proxy configuration /// service object to set credentials for.</param> /// <returns>Returns true in case user entered proxy server settings and pressed OK or false if he pressed Cancel.</returns> /// <exception cref="ArgumentNullException"><paramref name="proxyConfigurationService"/> /// is a null reference.</exception> public static bool AskAndSetProxyCredentials( IProxyConfigurationService proxyConfigurationService) { if (proxyConfigurationService == null) { throw new ArgumentNullException("proxyConfigurationService"); } // create dialog AuthenticationDlg dlg = new AuthenticationDlg(); // set title and caption dlg.Title = (string)Application.Current.FindResource("ProxyAuthenticationRequiredTitle"); dlg.Text = _FormatDialogText(); // set presaved username var settings = proxyConfigurationService.Settings; if (settings.UseAuthentication) { dlg.Username = settings.Username; dlg.RememberMe = true; } // save override cursor and set it to null, so user won't see wait cursor during work with the dialog Cursor overrideCursor = null; if (Mouse.OverrideCursor != null) { overrideCursor = Mouse.OverrideCursor; Mouse.OverrideCursor = null; } // show dialog Nullable<bool> result = dlg.ShowDialog(); // restore override cursor if needed if (overrideCursor != null) Mouse.OverrideCursor = overrideCursor; // if user pressed OK if (result.HasValue && result.Value) { // save credentials to user settings storage var username = dlg.Username; var password = dlg.Password; if (!dlg.RememberMe) { username = null; password = null; } settings.UseAuthentication = dlg.RememberMe; settings.Username = username; settings.Password = password; proxyConfigurationService.Update(); // save username and password in local cache to show them next time _credentials.UserName = dlg.Username; _credentials.Password = dlg.Password; // set credentials to default web proxy _SetDefaultProxyServerCredentials(_credentials.UserName, _credentials.Password); return true; } return false; }
/// <summary> /// Method shows user a dialog that asks proxy server credentials /// </summary> /// <param name="proxyConfigurationService">The reference to the proxy configuration /// service object to set credentials for.</param> /// <returns>Returns true in case user entered proxy server settings and pressed OK or false if he pressed Cancel.</returns> /// <exception cref="ArgumentNullException"><paramref name="proxyConfigurationService"/> /// is a null reference.</exception> static public bool AskAndSetProxyCredentials( IProxyConfigurationService proxyConfigurationService) { if (proxyConfigurationService == null) { throw new ArgumentNullException("proxyConfigurationService"); } // create dialog AuthenticationDlg dlg = new AuthenticationDlg(); // set title and caption dlg.Title = (string)Application.Current.FindResource("ProxyAuthenticationRequiredTitle"); dlg.Text = _FormatDialogText(); // set presaved username var settings = proxyConfigurationService.Settings; if (settings.UseAuthentication) { dlg.Username = settings.Username; dlg.RememberMe = true; } // save override cursor and set it to null, so user won't see wait cursor during work with the dialog Cursor overrideCursor = null; if (Mouse.OverrideCursor != null) { overrideCursor = Mouse.OverrideCursor; Mouse.OverrideCursor = null; } // show dialog Nullable <bool> result = dlg.ShowDialog(); // restore override cursor if needed if (overrideCursor != null) { Mouse.OverrideCursor = overrideCursor; } // if user pressed OK if (result.HasValue && result.Value) { // save credentials to user settings storage var username = dlg.Username; var password = dlg.Password; if (!dlg.RememberMe) { username = null; password = null; } settings.UseAuthentication = dlg.RememberMe; settings.Username = username; settings.Password = password; proxyConfigurationService.Update(); // save username and password in local cache to show them next time _credentials.UserName = dlg.Username; _credentials.Password = dlg.Password; // set credentials to default web proxy _SetDefaultProxyServerCredentials(_credentials.UserName, _credentials.Password); return(true); } return(false); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Inits startup state of radio buttons. /// </summary> protected void _InitPageContent() { App appCurrent = App.Current; appCurrent.Exit += new ExitEventHandler(_CurrentExit); appCurrent.ProjectClosed += new EventHandler(_AppProjectClosed); this.Loaded += new RoutedEventHandler(_PageLoaded); this.Unloaded += new RoutedEventHandler(_PageUnloaded); textBoxPeriod.KeyDown += new WinInput.KeyEventHandler(_NumericTextBoxKeyDown); textBoxTimeDomain.KeyDown += new WinInput.KeyEventHandler(_NumericTextBoxKeyDown); Settings settings = Settings.Default; ShowQuickHelpButton.IsChecked = appCurrent.MainWindow.IsHelpVisible; ShowQuickHelpButton.Click += new RoutedEventHandler(_ShowQuickHelpButtonClick); AllwaysAskBeforeDeletingButton.Click += new RoutedEventHandler(_AllwaysAskBeforeDeletingButtonClick); FleetSetupWizardButton.Click += new RoutedEventHandler(_FleetSetupWizardButtonClick); RouteLocationsVirtualWarningButton.Click += new RoutedEventHandler(_RouteLocationsVirtualWarningButtonClick); // Initialize projects path text box. ProjectsPathEdit.Text = _GetProjectsPath(settings); // Initialize plug-ins path text box. PlugInsPathEdit.Text = _GetPlugInsPath(settings); ProjectsPathEdit.TextChanged += _ProjectsPathEditTextChanged; PlugInsPathEdit.TextChanged += _PlugInsPathEditTextChanged; _proxyConfigurationService = appCurrent.Container.Resolve<IProxyConfigurationService>(); this.ProxySettings.DataContext = _proxyConfigurationService.Settings; _InitUpdateValues(); }