예제 #1
0
 public PathEngine(string term, Model.Keyboard keyboard)
 {
     Term       = term;
     Keyboard   = keyboard;
     _actions   = new Actions();
     _startChar = 'A';
 }
        public List <KeyRowView> GetKeyboard(string keyboardType)
        {
            KeyboardType type;

            if (Enum.TryParse(keyboardType, out type))
            {
                Model.Keyboard keyboard = _keyboards.GetKeyboard(type);

                return(KeyRowView.ParseViewModel(keyboard.Keys));
            }
            else
            {
                throw new InvalidKeyboardTypeException($"{keyboardType} is not a valid keyboard type.");
            }
        }
        public List <Model.PathAction> GetKeyboardPath(string searchTerm, string keyboardType)
        {
            List <Model.PathAction> pathActions = new List <Model.PathAction>();

            KeyboardType type;

            if (Enum.TryParse(keyboardType, out type))
            {
                Model.Keyboard keyboard = _keyboards.GetKeyboard(type);

                PathEngine engine = new PathEngine(searchTerm, keyboard);
                return(engine.GeneratePath());
            }
            else
            {
                throw new InvalidKeyboardTypeException($"{keyboardType} is not a valid keyboard type.");
            }
        }