protected void CloseView() { if (CloseCommand != null && CloseCommand.CanExecute(null)) { CloseCommand.Execute(null); } }
public void CanAlwaysExecute() { var classUnderTest = new CloseCommand(Mock.Of <IClosableWindow>()); var result = classUnderTest.CanExecute(null); result.Should().BeTrue("because it should always be possible to cancel"); }
private void ToolTip_Closed(object sender, RoutedEventArgs e) { if (CloseCommand != null) { if (CloseCommand.CanExecute(AssociatedObject?.DataContext)) { CloseCommand.Execute(AssociatedObject?.DataContext); } } }
private void HandleClosing(object?sender, CancelEventArgs e) { if (this.IsHandlingBypassed() || CloseCommand == null || !CloseCommand.CanExecute(this)) { return; } _closingIsUncontrolled = true; CloseCommand.Execute(this); }
private void OnClose(object sender, EventArgs e) { Image image = (Image)sender; image.SetAnimation(); if (CloseCommand != null && CloseCommand.CanExecute(ShoppingList)) { CloseCommand.Execute(ShoppingList); } }
private void OnClosing() { if (CloseCommand != null) { if (CloseCommand.CanExecute(null)) { CloseCommand.Execute(null); } } else { UpdateSearchControlVisiblity(false, true); } }
private bool CanRemove(object obj) { return(ViewModel != null && CloseCommand.CanExecute(obj)); }