private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     if (MasterViewModel.Settings.GazePlusClickMode)
     {
         gazePointer.Click();
     }
 }
        public void OnXamlRendered(FrameworkElement control)
        {
            GazeInput.IsDeviceAvailableChanged += GazeInput_IsDeviceAvailableChanged;

            WarnUserToPlugInDevice();

            var buttonControl = control.FindChildByName("TargetButton") as Button;

            buttonControl.Click += TargetButton_Click;

            if (buttonControl != null)
            {
                gazeButtonControl = GazeInput.GetGazeElement(buttonControl);

                if (gazeButtonControl == null)
                {
                    gazeButtonControl = new GazeElement();
                    GazeInput.SetGazeElement(buttonControl, gazeButtonControl);
                }

                if (gazeButtonControl != null)
                {
                    gazeButtonControl.DwellProgressFeedback += OnProgressFeedback;
                    gazeButtonControl.Invoked      += OnGazeInvoked;
                    gazeButtonControl.StateChanged += GazeButtonControl_StateChanged;
                }
            }

            gazePointer = GazeInput.GetGazePointer(null);

            CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler <CoreWindow, KeyEventArgs>(delegate(CoreWindow sender, KeyEventArgs args)
            {
                gazePointer.Click();
            });
        }