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); } }
public static void RedirectExecute <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()); @this.Execute(tViewModel, tEventArgs); }