Example #1
0
 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");
        }
Example #3
0
 private void ToolTip_Closed(object sender, RoutedEventArgs e)
 {
     if (CloseCommand != null)
     {
         if (CloseCommand.CanExecute(AssociatedObject?.DataContext))
         {
             CloseCommand.Execute(AssociatedObject?.DataContext);
         }
     }
 }
Example #4
0
        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);
            }
        }
Example #6
0
 private void OnClosing()
 {
     if (CloseCommand != null)
     {
         if (CloseCommand.CanExecute(null))
         {
             CloseCommand.Execute(null);
         }
     }
     else
     {
         UpdateSearchControlVisiblity(false, true);
     }
 }
Example #7
0
 private bool CanRemove(object obj)
 {
     return(ViewModel != null && CloseCommand.CanExecute(obj));
 }