示例#1
0
        public static IEnumerable<Action<PadEditor>> ResolveMacro(Mode mode, string macro)
        {
            List<Action<PadEditor>> keys = new List<Action<PadEditor>>();

            macro = macro.Substring(0);

            while(macro.Length > 0) {
                if(Char.IsDigit(macro[0])) {
                    string digits = new String(macro.TakeWhile(c => Char.IsDigit(c)).ToArray());

                    macro = macro.Substring(digits.Length);
                    keys.Add(new Action<PadEditor>(pe =>
                        pe.AddToCount(digits)));
                }
                else {
                    EditGesture gesture = ResolveKeyName(ref macro);

                    if(mode.Gestures.ContainsKey(gesture))
                        keys.Add(mode.Gestures[gesture]);
                    else
                        throw new Exception("Key not found: " + gesture.ToString());
                }
            }

            return keys;
        }
示例#2
0
 public static bool HasMacros(Mode mode)
 {
     return maps.ContainsKey(mode);
 }
示例#3
0
文件: PadEditor.cs 项目: faboo/Agent
        private void SetMode(Mode mode)
        {
            currentMode = mode;
            Pad.Cursor.Type = mode.Cursor;

            RevertMode();
        }
示例#4
0
 public static IDictionary<InputGesture, Action<PadEditor>> GetMacros(Mode mode)
 {
     return maps[mode];
 }
示例#5
0
文件: PadEditor.cs 项目: faboo/Agent
 private void OnMappingAdded(Mode mode, InputGesture gesture, Action<PadEditor> action)
 {
     if(mode == currentMode)
         BindMacro(gesture, action);
 }