private void Callback(Confirmation vm) { if (vm.Confirmed) { LoadData(); } }
private void OnPrintGrpah() { var notification = new Confirmation(); notification.Title = "Plainion.GraphViz.Viewer"; PrintGraphRequest.Raise(notification, c => { }); }
private void OnPopupClosed(Confirmation conf) { if (conf.Confirmed) { MyMessage = ((conf.Content) as ContentModel).ContentMessage; } }
private void OnShowConfirmation() { var confirmation = new Confirmation(); confirmation.Title = "Really?"; // TODO: unfort. i couldnt find a way to provide a DataTemplate for ConfirmationContent to the new window confirmation.Content = new ConfirmationContent( "Here goes the question, doesn't it?" ); ConfirmationRequest.Raise( confirmation, c => Response = c.Confirmed ? "yes" : "no" ); }
private void OnOpenSettingsEditor() { var notification = new Confirmation(); notification.Title = "Settings"; SettingsEditorRequest.Raise(notification, c => { if (c.Confirmed && myPresentation != null) { myPresentation.InvalidateLayout(); } }); }
private void RaiseConfirmPopup() { Confirmation confirmation = new Confirmation(); confirmation.Title = "提示"; confirmation.Content = "是否真的需要?"; this._confrimCancelInteractionRequest.Raise( confirmation, (confirm) => { if (confirm.Confirmed) { } }); }
private void OnShowConfirmation() { var confirmation = new Confirmation(); confirmation.Title = "Really?"; confirmation.Content = new Border { BorderBrush = Brushes.Green, BorderThickness = new System.Windows.Thickness( 2 ), Padding = new System.Windows.Thickness( 10 ), Child = new TextBlock { Text = "Here goes the question, doesn't it?" } }; ConfirmationRequest.Raise( confirmation, c => Response = c.Confirmed ? "yes" : "no" ); }
public void WhenWindowContentIsNotSet_ShouldUseDefaultWindowForConfirmations() { TestablePopupWindowAction popupWindowAction = new TestablePopupWindowAction(); popupWindowAction.IsModal = true; popupWindowAction.CenterOverAssociatedObject = true; INotification notification = new Confirmation(); notification.Title = "Title"; notification.Content = "Content"; Assert.AreEqual(popupWindowAction.IsModal, true); Assert.AreEqual(popupWindowAction.CenterOverAssociatedObject, true); Window window = popupWindowAction.GetWindow(notification); Assert.IsInstanceOfType(window, typeof(DefaultConfirmationWindow)); DefaultConfirmationWindow defaultWindow = window as DefaultConfirmationWindow; Assert.ReferenceEquals(defaultWindow.Confirmation, notification); }
private async void Delete(Confirmation conf) { if (conf.Confirmed) { var ids = selectedItems.OfType<Product>().Select(x => x.Id).ToList(); IsBusy = true; var task = await productsRepository.Delete(ids); IsBusy = false; if (task.Succeed) { var args = new ProductDeletedBatchEventArgs(ids, false); eventAggregator.GetEvent<ProductDeletedBatchEvent>().Publish(args); } } }
private void PromtDelete() { var sb = new StringBuilder(); sb.AppendLine("Следующие позиции будут удалены:"); foreach (var x in selectedItems.OfType<Product>()) { sb.AppendFormat("- {0} {1}", x.Name, x.Size); sb.AppendLine(); } var conf = new Confirmation { Title = "Внимание!", Content = sb.ToString(), }; deleteRequest.Raise(conf, Delete); }
private void OnError(object sender, ErrorEventArgs e) { lock (_lock) { if (!Cancelled) { if (e.ErrorCode == (int)SystemErrorCodes.ERROR_CANCELLED) { _completedStepVmFactory.GetViewModelInstance().Result = OperationResult.Cancelled; } else { _progressStepVmFactory.GetViewModelInstance().Message = e.ErrorMessage; _completedStepVmFactory.GetViewModelInstance().Message = e.ErrorMessage; _completedStepVmFactory.GetViewModelInstance().Result = OperationResult.Failed; if (_installer.Command.Display == Display.Full) { var code = e.UIHint & 0xF; switch (code) { case 0: { var notification = new Notification { Title = Resources.SDKTitle, Content = e.ErrorMessage }; OKDialogRequest.Raise(notification); e.Result = Result.Ok; } break; case 1: case 4: { var confirmation = new Confirmation { Title = Resources.SDKTitle, Content = e.ErrorMessage }; switch (e.UIHint & 0xF) { case 1: OKCancelDialogRequest.Raise(confirmation); e.Result = confirmation.Confirmed ? Result.Ok : Result.Cancel; break; case 4: YesNoDialogRequest.Raise(confirmation); e.Result = confirmation.Confirmed ? Result.Ok : Result.Cancel; break; } } break; case 2: case 3: { var refusedConfirmation = new RefusedConfirmation(); switch (e.UIHint & 0xF) { case 2: AbortRetryIgnoreDialogRequest.Raise(refusedConfirmation); e.Result = refusedConfirmation.Refused ? Result.Abort : (refusedConfirmation.Confirmed ? Result.Retry : Result.Ignore); if (!refusedConfirmation.Refused) { _completedStepVmFactory.GetViewModelInstance().Result = OperationResult.Successful; } break; case 3: YesNoCancelDialogRequest.Raise(refusedConfirmation); e.Result = refusedConfirmation.Confirmed ? Result.Yes : (refusedConfirmation.Refused ? Result.No : Result.Cancel); break; } } break; } } } } else { e.Result = Result.Cancel; } } }
private async void Delete(Confirmation conf) { if (conf.Confirmed) { IsBusy = true; var ids = selectedItems.OfType<FileDescription>().Select(x => x.Id).ToArray(); var task = await filesRepository.DeleteAsync(ids); if (task.Succeed) { await RefreshAsync(); } IsBusy = false; } }
private async void Delete(Confirmation conf) { if (conf.Confirmed) { var ids = selectedItems .OfType<FileDescription>() .OrderByDescending(x => x.UploadDate) .Select(x => x.Id) .ToArray(); IsBusy = true; var task = await productsRepository.DetachFiles(productId, ids); IsBusy = false; if (task.Succeed) { await LoadFiles(); } } }