/* * Open the spell checker when the user click the button */ private void SpellButton_Click(object sender, RoutedEventArgs e) { try { if (this.spellWindow != null) { this.spellWindow.Close(); this.spellWindow = null; } this.spellWindow = new SpellCheckWindow(this); this.spellWindow.Visibility = Visibility.Visible; this.spellWindow.Corrections(); } catch (NullReferenceException) { return; } }
/** * This function detect when a key is press down */ private void MainWindow_OnPreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.RightAlt)//Panning { if (((App)Application.Current).Host.Context.ConnectionState == Tobii.Interaction.Client.ConnectionState.Connected) { ((App)Application.Current).Host.Commands.Input.SendPanningBegin(); } } if (e.Key == Key.RightShift)//Eye menu or spell check { if (((App)Application.Current).Host.Context.ConnectionState == Tobii.Interaction.Client.ConnectionState.Connected) { ((App)Application.Current).Host.Commands.Input.SendActivationModeOn(); if (((App)Application.Current).Host.Context.ConnectionState == Tobii.Interaction.Client.ConnectionState.Connected) //Check if eye tracker is enable { if (TextEdit.GetHasTentativeActivationFocus() == true) //If user look at text box, open spell check { try { if (this.spellWindow != null) { this.spellWindow.Close(); this.spellWindow = null; } this.spellWindow = new SpellCheckWindow(this); this.spellWindow.Visibility = Visibility.Visible; this.spellWindow.Corrections(); } catch (NullReferenceException) { return; } } else//Otherwise open the eye menu { this.eyeWindow.Visibility = Visibility.Visible; this.eyeWindow.Focus(); this.eyeWindow.setActif(); } } } } }