@@ -187,41 +187,39 @@ private async void EnableEncryptionAction()
187187 settings . NegativeButtonText = Strings . Cancel ;
188188 settings . DefaultButtonFocus = MessageDialogResult . Affirmative ;
189189
190- if ( await _dialogCoordinator . ShowMessageAsync ( this , Strings . Disclaimer ,
191- Strings . ProfileEncryptionDisclaimer ,
192- MessageDialogStyle . AffirmativeAndNegative ) == MessageDialogResult . Affirmative )
190+ if ( await _dialogCoordinator . ShowMessageAsync ( this , Strings . Disclaimer , Strings . ProfileEncryptionDisclaimer , MessageDialogStyle . AffirmativeAndNegative , settings ) != MessageDialogResult . Affirmative )
191+ return ;
192+
193+ var customDialog = new CustomDialog
193194 {
194- var customDialog = new CustomDialog
195- {
196- Title = Strings . SetMasterPassword
197- } ;
195+ Title = Strings . SetMasterPassword
196+ } ;
198197
199- var credentialsSetPasswordViewModel = new CredentialsSetPasswordViewModel ( async instance =>
200- {
201- await _dialogCoordinator . HideMetroDialogAsync ( this , customDialog ) ;
198+ var credentialsSetPasswordViewModel = new CredentialsSetPasswordViewModel ( async instance =>
199+ {
200+ await _dialogCoordinator . HideMetroDialogAsync ( this , customDialog ) ;
202201
203- try
204- {
205- ProfileManager . EnableEncryption ( SelectedProfileFile , instance . Password ) ;
206- }
207- catch ( Exception ex )
208- {
209- var metroDialogSettings = AppearanceManager . MetroDialog ;
210- metroDialogSettings . AffirmativeButtonText = Strings . OK ;
211-
212- await _dialogCoordinator . ShowMessageAsync ( this , Strings . EncryptionError ,
213- $ "{ Strings . EncryptionErrorMessage } \n \n { ex . Message } ",
214- MessageDialogStyle . Affirmative , metroDialogSettings ) ;
215- }
216- } , async _ => { await _dialogCoordinator . HideMetroDialogAsync ( this , customDialog ) ; } ) ;
217-
218- customDialog . Content = new CredentialsSetPasswordDialog
202+ try
219203 {
220- DataContext = credentialsSetPasswordViewModel
221- } ;
204+ ProfileManager . EnableEncryption ( SelectedProfileFile , instance . Password ) ;
205+ }
206+ catch ( Exception ex )
207+ {
208+ var metroDialogSettings = AppearanceManager . MetroDialog ;
209+ metroDialogSettings . AffirmativeButtonText = Strings . OK ;
222210
223- await _dialogCoordinator . ShowMetroDialogAsync ( this , customDialog ) ;
224- }
211+ await _dialogCoordinator . ShowMessageAsync ( this , Strings . EncryptionError ,
212+ $ "{ Strings . EncryptionErrorMessage } \n \n { ex . Message } ",
213+ MessageDialogStyle . Affirmative , metroDialogSettings ) ;
214+ }
215+ } , async _ => { await _dialogCoordinator . HideMetroDialogAsync ( this , customDialog ) ; } ) ;
216+
217+ customDialog . Content = new CredentialsSetPasswordDialog
218+ {
219+ DataContext = credentialsSetPasswordViewModel
220+ } ;
221+
222+ await _dialogCoordinator . ShowMetroDialogAsync ( this , customDialog ) ;
225223 }
226224
227225 public ICommand ChangeMasterPasswordCommand => new RelayCommand ( _ => ChangeMasterPasswordAction ( ) ) ;
0 commit comments