private void SaveToSharedFolderToolStripMenuItem_Click(object sender, EventArgs e) { if (!_appSettingsService.Settings.UseSharedSyncFolder) { MessageBox.Show(Resources.FormMain_saveToSharedFolderMenuDisabled, Resources.FormMain__Could_not_save, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(_appSettingsService.Settings.SyncFolderPath) || !Directory.Exists(_appSettingsService.Settings.SyncFolderPath)) { MessageBox.Show(Resources.FormMain_saveToSharedFoldrMenuInvalidPath, Resources.FormMain__Could_not_save, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var formSetPassword = new FormSetPassword(); if (formSetPassword.ShowDialog(this) != DialogResult.OK) { formSetPassword.Dispose(); return; } string password = formSetPassword.VerifiedPassword; _passwordStorage.Set("SharedFolderPassword", password); formSetPassword.Dispose(); bool result = _logicManager.SaveToSharedFolder(); if (result) { MessageBox.Show("Database successfully saved to sync folder", Resources.FormMain__Database_Saved, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Failed to save database to sync folder path", Resources.FormMain__Could_not_save, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e) { var formSetPassword = new FormSetPassword { Text = "Choose a new password" }; if (formSetPassword.ShowDialog(this) != DialogResult.OK) { formSetPassword.Dispose(); return; } string password = formSetPassword.VerifiedPassword; formSetPassword.Dispose(); _passwordStorage.Set(PwdKey, password); _logicManager.SaveDatabase(); _appSettingsService.Settings.PasswordDerivedString = GeneralConverters.GeneratePasswordDerivedString(_appSettingsService.Settings.ApplicationSaltValue + password + _appSettingsService.Settings.ApplicationSaltValue); _appSettingsService.SaveSettings(); UpdateApplicationState(); }