private void Authenticate() { try { string username = ProtectedDataStorage.Unprotect(Settings.Default.EncryptedUsername); string password = ProtectedDataStorage.Unprotect(Settings.Default.EncryptedPassword); CredentialsManager.Signin(username, password); } catch (AuthenticationException e) { InformationDispatcher.Default.Dispatch(e, DebugLogContext.Current); } }
private void SaveSettings() { // General tab Settings.Default.ShowRibbonBranding = showRibbonBrandingCheckBox.Checked; // Services tab Settings.Default.WebServiceAddress = serverAddressTextBox.Text; Settings.Default.AutoConnect = autoConnectCheckBox.Checked; Settings.Default.EncryptedUsername = ProtectedDataStorage.Protect(usernameTextBox.Text); Settings.Default.EncryptedPassword = ProtectedDataStorage.Protect(passwordTextBox.Text); // Save settings Settings.Default.Save(); }
private void LoadSettings() { // General tab showRibbonBrandingCheckBox.Checked = Settings.Default.ShowRibbonBranding; // Services tab serverAddressTextBox.Text = Settings.Default.WebServiceAddress; autoConnectCheckBox.Checked = Settings.Default.AutoConnect; string username = Settings.Default.EncryptedUsername; usernameTextBox.Text = !string.IsNullOrEmpty(username) ? ProtectedDataStorage.Unprotect(username) : string.Empty; string password = Settings.Default.EncryptedPassword; passwordTextBox.Text = !string.IsNullOrEmpty(password) ? ProtectedDataStorage.Unprotect(password) : string.Empty; }