async Task OkAction(object commandParam) { CancellationTokenSource cts = new CancellationTokenSource(); var progressVm = new ProgressDialogViewModel(cts); this.dialogServiceViewModel.ShowProgressDialog(progressVm); try { await this.loginService.SignIn(new NetworkCredential(this.Username, this.Password), true, this.RememberCredentials); } finally { progressVm.OperationEnded = true; } if (this.loginService.IsSignedIn) { // Since execution is async and caller does not await, need to send close request. // Cannot returnn dialog command. //var dialogCommandParam = commandParam as DialogCommandParameter; //if (dialogCommandParam != null) //{ // dialogCommandParam.Close = true; //} this.CloseRequested?.Invoke(); } else { this.ErrorMessage = "Sign in failed."; } }
public void ShowProgressDialog(ProgressDialogViewModel vm) { if (this.ShowProgressDialogRequested != null) { this.ShowProgressDialogRequested(vm); } }