private void OnExitSettings(object sender, RoutedEventArgs e)
 {
     MasterViewModel.Settings.Save();
     grdvwPhrases.FontSize   = MasterViewModel.Settings.FontSize;
     SettingsGrid.Visibility = Visibility.Collapsed;
     AdjustTileSize();
     SetToolsToolbarVisible(false);
     if (MasterViewModel.Settings.GazePlusClickMode)
     {
         GazeInput.SetIsSwitchEnabled(this, true);
     }
     else
     {
         GazeInput.SetIsSwitchEnabled(this, false);
     }
 }
        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);
            });
        }
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            GazeInput.DwellFeedbackCompleteBrush = new SolidColorBrush(Colors.DimGray);
            GazeInput.DwellFeedbackEnterBrush    = new SolidColorBrush(Colors.DimGray);

            GazeInput.SetIsCursorVisible(this, false);

            if (_navParams != null)
            {
                if (_navParams.NeedsSaving)
                {
                    SaveConfigFile(PhraseConfigFile);
                }
                MasterViewModel.GoToNode(_navParams.CurrentNode);
                ShowHideTileNavigation();
                _navParams = null;
            }
            else
            {
                LoadConfigFile(PhraseConfigFile);

                _tileViewer              = UIHelper.FindChildControl <ScrollViewer>(grdvwPhrases, "ScrollViewer") as ScrollViewer;
                _tileViewer.ViewChanged += Viewer_ViewChanged;

                DataContext          = MasterViewModel;
                groupTilesCVS.Source = MasterViewModel.Tiles;
            }
            if (MasterViewModel.Settings.GazePlusClickMode)
            {
                GazeInput.SetIsSwitchEnabled(this, true);
            }
            else
            {
                GazeInput.SetIsSwitchEnabled(this, false);
            }
        }