コード例 #1
0
        /// <summary>
        /// Perform named action.
        /// </summary>
        /// <param name="ob">The object.</param>
        /// <param name="name">Name of action.</param>
        internal static ICommand Create(object ob, string name)
        {
            var type   = ob.GetType();
            var method = type.GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(object), typeof(EventArgs) }, null);

            ICommand action;

            if (method != null)
            {
                action = new HandlerToCommand(ob, method);
            }
            else
            {
                action = null;
            }

            return(action);
        }
コード例 #2
0
        public ICommand GetAction(string name)
        {
            var command = HandlerToCommand.Create(this, name);

            return(command);
        }