public static async Task TryExecuteAsync(this IViewModelCommand command, object arg)
 {
     if (command != null && command.CanExecute(arg))
     {
         await command.ExecuteAsync(arg);
     }
 }
 public static async Task TryExecuteAsync(this IViewModelCommand command)
 {
     if (command != null && command.CanExecute())
     {
         await command.ExecuteAsync();
     }
 }
 public static void TryExecute(this IViewModelCommand command)
 {
     if (command != null && command.CanExecute())
     {
         command.Execute();
     }
 }
 public static void TryExecute(this IViewModelCommand command, object arg)
 {
     if (command != null && command.CanExecute(arg))
     {
         command.Execute(arg);
     }
 }
Beispiel #5
0
        public static bool RedirectCanExecute <TViewModel, TEventArgs>(
            this IViewModelCommand <TViewModel, TEventArgs> @this,
            object viewModel,
            object eventArgs)
        {
            Contract.Requires(@this != null);
            Contract.Requires(viewModel != null);
            Contract.Requires(eventArgs != null);

            var(tViewModel, tEventArgs) = castHelper <TViewModel, TEventArgs>(viewModel, eventArgs, @this.getCommandName());
            return(@this.CanExecute(tViewModel, tEventArgs));
        }