protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var navParams = e.Parameter as KeyboardPageNavigationParams;

            _navParams = navParams;
            SetPageMode(PageMode.Run);
        }
        private void OnSpeechClick(object sender, RoutedEventArgs e)
        {
            var navParams = new KeyboardPageNavigationParams
            {
                RootNode          = MasterViewModel.RootNode,
                CurrentNode       = MasterViewModel.CurrentNode,
                ChildNode         = null,
                NeedsSaving       = false,
                SpeechMode        = true,
                GazePlusClickMode = MasterViewModel.Settings.GazePlusClickMode
            };

            Frame.Navigate(typeof(KeyboardPage), navParams);
        }
        private void AddEntry(bool isCategory)
        {
            var navParams = new KeyboardPageNavigationParams
            {
                RootNode          = MasterViewModel.RootNode,
                CurrentNode       = MasterViewModel.CurrentNode,
                ChildNode         = null,
                NeedsSaving       = false,
                IsCategory        = isCategory,
                GazePlusClickMode = MasterViewModel.Settings.GazePlusClickMode
            };

            Frame.Navigate(typeof(KeyboardPage), navParams);
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     _navParams = (KeyboardPageNavigationParams)e.Parameter;
     GazeKeyboard.GazePlusClickMode = _navParams.GazePlusClickMode;
     if (_navParams.SpeechMode)
     {
         GazeKeyboard.EnterButton.Content = "\uE768";
         GazeKeyboard.TextControl.Focus(FocusState.Programmatic);
         return;
     }
     GazeKeyboard.EnterButton.Content = "\uE73E";
     if (_navParams.ChildNode != null)
     {
         GazeKeyboard.TextControl.Text = _navParams.ChildNode.Caption;
         GazeKeyboard.TextControl.SelectAll();
     }
 }
        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);
            }
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     _navParams = (KeyboardPageNavigationParams)e.Parameter;
 }
        private async void OnGridButtonClick(object sender, RoutedEventArgs e)
        {
            var button     = sender as Button;
            var phraseNode = button.DataContext as PhraseNode;
            var caption    = phraseNode != null ? phraseNode.Caption : button.Content.ToString();

            if (caption == "\uE72B")
            {
                MasterViewModel.GoToNode(MasterViewModel.CurrentNode);
                ShowHideTileNavigation();
                return;
            }
            else if (caption == "\uE72A")
            {
                MasterViewModel.GoToNode(MasterViewModel.CurrentNode);
                ShowHideTileNavigation();
                return;
            }

            switch (_pageMode)
            {
            case PageMode.Delete:
                if ((phraseNode.IsCategory) && (phraseNode.Children.Count > 0))
                {
                    // TODO: Add status info somewhere.
                    return;
                }
                SetButtonDwellResponse(false);
                MasterViewModel.CurrentNode.Children.Remove(phraseNode);
                SetPageMode(PageMode.Run);
                MasterViewModel.GoToNode(MasterViewModel.CurrentNode);
                ShowHideTileNavigation();
                break;

            case PageMode.Edit:
                var navParams = new KeyboardPageNavigationParams
                {
                    RootNode          = MasterViewModel.RootNode,
                    CurrentNode       = MasterViewModel.CurrentNode,
                    ChildNode         = phraseNode,
                    NeedsSaving       = false,
                    GazePlusClickMode = MasterViewModel.Settings.GazePlusClickMode
                };
                Frame.Navigate(typeof(KeyboardPage), navParams);
                break;

            default:
                if (phraseNode.IsCategory)
                {
                    MasterViewModel.GoToNode(phraseNode);
                    ShowHideTileNavigation();
                }
                else
                {
                    var stream = await _speechSynthesizer.SynthesizeTextToStreamAsync(caption);

                    _mediaElement.SetSource(stream, stream.ContentType);
                    _mediaElement.AutoPlay = true;
                    _mediaElement.Play();
                }
                break;
            }
        }