private void Window_Loaded(object sender, RoutedEventArgs e) { alarm = new SoundPlayer(Properties.Resources.beep01); //alarm.Play(); loudAlarm = new SoundPlayer(Properties.Resources.loudAlarm); //loudAlarm.Play(); stateTransition = new SoundPlayer(Properties.Resources.flip); //stateTransition.Play(); //stateTransition.PlayLooping(); //initial system values composition = "-"; isCancelled = false; charToPrint = ""; primaryKeyboard = true; blockType = 0; isBlocked = false; //suggestionLabel = new Label[4]; suggestionLabel = new TextBlock[4]; for (int i = 1; i < 5; i++) //References the suggestion labels with an array and clear their "Content" property { suggestionLabel[i - 1] = (TextBlock)(FindName("sug" + i)); suggestionLabel[i - 1].Text = ""; } suggestionStackPanel = new StackPanel[4]; for (int i = 1; i < 5; i++) //References the suggestion labels with an array and clear their "Content" property { suggestionStackPanel[i - 1] = (StackPanel)(FindName("view" + i)); } changeObjectsSize(); //initialize the Suggester Suggester.initializeSuggester(); suggestionsList = new List <string>(); currentWord = ""; //every 2 seconds after the keyboardTimer has started, the changeKeyboard function will be called keyboardTimer.Interval = 2000; keyboardTimer.Elapsed += new ElapsedEventHandler(changeKeyboard); dataTimer.Start(); //Mouse.OverrideCursor = Cursors.None; //remove mouse //EyeTracker data retrieval try { //gp = new GazePoint(); } catch { Console.WriteLine("No camera found! Mouse mode! :)"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { alarm = new SoundPlayer(Properties.Resources.beep01); //alarm.Play(); loudAlarm = new SoundPlayer(Properties.Resources.loudAlarm); //loudAlarm.Play(); stateTransition = new SoundPlayer(Properties.Resources.flip); //stateTransition.Play(); //stateTransition.PlayLooping(); sentencesList = new List <string>(); //list of sentences to be written during the test try { // Open the text file using a stream reader. using (StreamReader sr = new StreamReader("sentencas_de_teste.txt")) { string line; do { line = sr.ReadLine(); sentencesList.Add(line); } while (line != null); //sentencesList has all the test sentences inside of it sentencesList.RemoveAt(sentencesList.Count - 1); sentencesList.Shuffle(); //foreach(string x in sentencesList) //{ // Console.WriteLine(x); //} } } catch { Console.WriteLine("The file could not be read:"); } //initial system values composition = "-"; isCancelled = false; charToPrint = ""; primaryKeyboard = true; blockType = 0; isBlocked = false; //suggestionLabel = new Label[4]; changeObjectsSize(); //initialize the Suggester Suggester.initializeSuggester(); suggestionsList = new List <string>(); currentWord = ""; //every 2 seconds after the keyboardTimer has started, the changeKeyboard function will be called keyboardTimer.Interval = 2000; keyboardTimer.Elapsed += new ElapsedEventHandler(changeKeyboard); dataTimer.Start(); dataTimer2.Start(); startNewSentence(); //first sentence to be written during tests is shown to the user if (IS_USING_CAMERA) { Mouse.OverrideCursor = Cursors.None; //remove mouse //EyeTracker data retrieval try { gp = new GazePoint(); } catch { Console.WriteLine("No camera found! Mouse mode! :)"); } } }