public async void ExecuteSaveSpisInstanceSettingsCommand(object parameter) { this.Busy = true; this.BusyContent = "Saving SPIS instanse settings"; try { await Task.Factory.StartNew(() => { var encryptionPassword = ConfigurationManager.AppSettings["EncryptionPassword"]; var encryptedPassword = Encryption.EncryptString(SpisCertificatePassword, encryptionPassword); SpisInstanceSettings.Password = encryptedPassword; SpisInstanceSettings.ClientCertificate = null; SpisInstanceSettings.ClientCertificate = SpisCertificate.Export(X509ContentType.Pkcs12, SpisCertificatePassword); InstanceService.SaveSpisInstanceSettings(SelectedInstance, SpisInstanceSettings); MessageBox.Show("SPIS instance settings has been successfully saved.", "SPIS instance settingse", MessageBoxButton.OK, MessageBoxImage.Information); }); } catch (Exception ex) { MessageBox.Show("Error when saving SPIS instance settings " + Environment.NewLine + ex.Message, "SPIS instance settingse", MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.Busy = false; } }