Example #1
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     GazeInput.SetIsCursorVisible(this, false);
     GazeInput.SetCursorRadius(this, 40);
     GazeInput.DwellStrokeThickness       = 6;
     GazeInput.DwellFeedbackEnterBrush    = new SolidColorBrush(Colors.DarkGray);
     GazeInput.DwellFeedbackProgressBrush = new SolidColorBrush(Colors.LightGray);
     GazeInput.DwellFeedbackCompleteBrush = new SolidColorBrush(Colors.White);
 }
        public async Task Init()
        {
            await App.Dispatcher.ExecuteOnUIThreadAsync(() =>
            {
                var xamlItemsPanelTemplate = @"<Grid xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
                                                 xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
                                                 xmlns:g='using:Microsoft.Toolkit.Uwp.Input.GazeInteraction'>
                        <Button HorizontalAlignment='Center' BorderBrush='#7FFFFFFF'
                                    g:GazeInput.ThresholdDuration='50'
                                    g:GazeInput.FixationDuration='350'
                                    g:GazeInput.DwellDuration='400'
                                    g:GazeInput.RepeatDelayDuration='400'
                                    g:GazeInput.DwellRepeatDuration='400'
                                    g:GazeInput.MaxDwellRepeatCount='0'
                                    Content='Gaze click here'
                                    Width='100'
                                    Height='100'/>
                    </Grid>";
                _grid = XamlReader.Load(xamlItemsPanelTemplate) as Grid;

                GazeInput.SetInteraction(_grid, Interaction.Enabled);
                GazeInput.SetIsCursorVisible(_grid, true);
                GazeInput.SetCursorRadius(_grid, 20);
                GazeInput.SetIsSwitchEnabled(_grid, false);

                _button        = (Button)_grid.Children.First();
                _button.Click += (sender, e) =>
                {
                    _button.Content = "Clicked";
                };

                var gazeButtonControl = GazeInput.GetGazeElement(_button);

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

                TestsPage.Instance.SetMainTestContent(_grid);
            });
        }
Example #3
0
 private void CursorRadius50_Click(object sender, RoutedEventArgs e)
 {
     GazeInput.SetCursorRadius(this, 50);
 }