private async void AddAction() { CustomDialog customDialog = new CustomDialog() { Title = LocalizationManager.GetStringByKey("String_Header_AddCredential") }; CredentialViewModel credentialViewModel = new CredentialViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); CredentialInfo credentialInfo = new CredentialInfo { ID = instance.ID, Name = instance.Name, Username = instance.Username, Password = instance.Password }; CredentialManager.AddCredential(credentialInfo); TimerLockUIStart(); // Reset timer }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, CredentialManager.GetNextID()); customDialog.Content = new CredentialDialog { DataContext = credentialViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }
private async void EditAction() { CustomDialog customDialog = new CustomDialog() { Title = Application.Current.Resources["String_Header_EditCredential"] as string }; CredentialViewModel credentialViewModel = new CredentialViewModel(instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); CredentialManager.RemoveCredential(SelectedCredential); CredentialInfo credentialInfo = new CredentialInfo { ID = instance.ID, Name = instance.Name, Username = instance.Username, Password = instance.Password }; CredentialManager.AddCredential(credentialInfo); TimerLockUIStart(); // Reset timer }, instance => { dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, SelectedCredential.ID, SelectedCredential); customDialog.Content = new CredentialDialog { DataContext = credentialViewModel }; await dialogCoordinator.ShowMetroDialogAsync(this, customDialog); }