Example #1
0
        /// <summary>
        /// 通过字符串解析出对应的 InputGestureCollection
        /// </summary>
        /// <param name="gestures"></param>
        /// <returns></returns>
        public static InputGestureCollection Parse(string gestures)
        {
            var parser = new InputGestureParser();

            parser.SetupGestures(gestures, string.Empty);
            return(parser._gestures);
        }
Example #2
0
        //public static ClientCommand NewCommand(Type cmdType)
        //{
        //    var cmdInfo = UIModel.WPFCommands.Find(cmdType);
        //    return NewCommand(cmdInfo);
        //}

        //public static ClientCommand NewCommand(string name)
        //{
        //    var cmdInfo = UIModel.WPFCommands.Find(name);
        //    return NewCommand(cmdInfo);
        //}

        internal static ClientCommand CreateCommand(WPFCommand meta, object cmdArg)
        {
            var command = Activator.CreateInstance(meta.RuntimeType) as ClientCommand;

            command.Meta      = meta;
            command.Parameter = cmdArg;
            command.Label     = meta.Label.Translate();

            //元数据中所有的扩展属性都会拷贝到 ClientCommand 上。
            command.CopyExtendedProperties(meta);

            var gestures = InputGestureParser.Parse(meta.Gestures);

            command.UICommand = new UICommand(command, typeof(CommandRepository), gestures);

            command.NotifyCreated();

            OnCommandCreated(command);

            return(command);
        }
Example #3
0
 /// <summary>
 /// 通过字符串解析出对应的 InputGestureCollection
 /// </summary>
 /// <param name="gestures"></param>
 /// <returns></returns>
 public static InputGestureCollection Parse(string gestures)
 {
     var parser = new InputGestureParser();
     parser.SetupGestures(gestures, string.Empty);
     return parser._gestures;
 }