예제 #1
0
            public override IMvxCommand ToCommand(object owner)
            {
                var         executeAction  = new Action(() => ExecuteMethodInfo.Invoke(owner, new object[0]));
                Func <bool> canExecuteFunc = null;

                if (CanExecutePropertyInfo != null)
                {
                    canExecuteFunc = () => (bool)CanExecutePropertyInfo.GetValue(owner, null);
                }

                return(new MvxCommand(executeAction, canExecuteFunc));
            }
예제 #2
0
            public override IMvxCommand ToCommand(object owner)
            {
                var executeAction = new Action <object>((obj) => ExecuteMethodInfo.Invoke(owner, new[] { obj }));
                Func <object, bool> canExecuteFunc = null;

                if (CanExecutePropertyInfo != null)
                {
                    canExecuteFunc = (ignored) => (bool)CanExecutePropertyInfo.GetValue(owner, null);
                }

                return(new MvxCommand <object>(executeAction, canExecuteFunc));
            }
예제 #3
0
            public override IMvxCommand ToCommand(object owner)
            {
                var         executeAction  = new Action(() => ExecuteMethodInfo.Invoke(owner, Array.Empty <object>()));
                Func <bool>?canExecuteFunc = null;

                if (CanExecutePropertyInfo != null)
                {
                    canExecuteFunc = () => (bool)(CanExecutePropertyInfo.GetValue(owner, null) ?? true);
                }

                return(new MvxCommand(executeAction, canExecuteFunc));
            }