Пример #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainWindow()
        {
            _environment = KeyboardApplicationEnvironment.Create(this);
            _host        = _environment.Host;

            InitializeComponent();
        }
Пример #2
0
        /// <summary>
        /// Create a new environment and associate it with a new host.
        /// </summary>
        /// <param name="window">The window to attach to.</param>
        /// <param name="getGazeClickParameters">The gaze click parameter provider.</param>
        /// <returns>The new environment.</returns>
        public static KeyboardApplicationEnvironment Create(Window window, GazeMouse.GetGazeClickParameters getGazeClickParameters)
        {
            var environment = new KeyboardApplicationEnvironment(window, getGazeClickParameters);
            var host        = KeyboardHost.Create(environment);

            environment.Host   = host;
            window.DataContext = host;

            return(environment);
        }
Пример #3
0
        public MainWindow()
        {
            GeoWatcher.PositionChanged += GeoWatcher_PositionChanged;
            GeoWatcher.Start(false);

            ShowSettings = new RelayCommand(OnShowSettings);

            IKeyboardApplicationEnvironment environment = KeyboardApplicationEnvironment.Create(this);

            _host = environment.Host;

            InitializeComponent();

            EulaWindow.ShowDialogOnFirstRun();
        }
Пример #4
0
        void Walk(KeyLayout key)
        {
            var character = key as CharacterKeyLayout;

            if (character != null)
            {
                var unshifted = character.Value ?? character.Caption;
                _keystrokes.Add(KeyboardHost.AutoEscape(unshifted));
                KeystrokeCasesTest.CheckCovered(unshifted);

                var shifted = character.ShiftValue ?? character.ShiftCaption ?? (unshifted.ToUpperInvariant() != unshifted ? unshifted.ToUpperInvariant() : unshifted);
                _keystrokes.Add(KeyboardHost.AutoEscape(shifted));
                KeystrokeCasesTest.CheckCovered(shifted);

                switch (unshifted)
                {
                case "{HOME}":
                case "{END}":
                case "{LEFT}":
                case "{RIGHT}":
                    Assert.AreEqual("+" + unshifted, shifted, "Special case shifts");
                    break;
                }
            }
            else
            {
                var group = key as ConditionalGroupLayout;
                if (group != null)
                {
                    foreach (var conditional in group.Conditionals)
                    {
                        foreach (var childKey in conditional.Keys)
                        {
                            Walk(childKey);
                        }
                    }
                }
            }
        }
Пример #5
0
 internal PhraseItem(KeyboardHost host, int index)
     : base(host, index)
 {
 }
 internal SuggestionItem(KeyboardHost host, int index)
     : base(host, index)
 {
 }
        internal static void CheckCovered(string keystrokeValue)
        {
            var escapedKeystrokeValue = KeyboardHost.AutoEscape(keystrokeValue);

            Assert.IsTrue(strokeToSlice.ContainsKey(escapedKeystrokeValue), "Tested keystroke");
        }
        static void Simple(string keystroke)
        {
            var escapedKeystroke = KeyboardHost.AutoEscape(keystroke);

            strokeToSlice.Add(escapedKeystroke, new TextSlice("AB C" + keystroke + "D EF", Before.Start + keystroke.Length, 0, true));
        }