public ReadingTest(TestWindow testWindow) { InitializeComponent(); readingTest = this; this.testWindow = testWindow; worker.DoWork += worker_DoWork; worker.RunWorkerCompleted += worker_RunWorkerCompleted; //Thread t = new Thread(ThreadProc); //t.SetApartmentState(ApartmentState.STA); //t.Start(); //GazePoint gazePoint = new GazePoint(); // Connect client //GazeManager.Instance.Activate(GazeManager.ApiVersion.VERSION_1_0, GazeManager.ClientMode.Push); // Register this class for events //GazeManager.Instance.AddGazeListener(this); //Thread.Sleep(3000); // simulate app lifespan (e.g. OnClose/Exit event) //myCanvas_Draw(100, 200); // Disconnect client //GazeManager.Instance.Deactivate(); this.Loaded += new RoutedEventHandler(ReadingTest_Loaded); //GrantAccess(@"d:\"); }
public EyeTribeListener(ReadingTest rTest1) { GazeManager.Instance.Activate(GazeManager.ApiVersion.VERSION_1_0, GazeManager.ClientMode.Push); GazeManager.Instance.AddGazeListener(this); rTest = rTest1; }
private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { //update ui once worker complete his work loadingImage.Visibility = Visibility.Hidden; loginButton.IsEnabled = true; if (isLoged) { if (response.Contains("1111")) { //JObject root = JObject.Parse(response); //JObject studentObj = (JObject)root.GetValue("body"); //string isValidR = studentObj.GetValue("isValidR").ToString(); //if (isValidR.Contains("true")) //{ ReadingTest rtest = new ReadingTest(this.testWindow); this.NavigationService.Navigate(rtest); //} //else //{ // MessageBox.Show("Invalid Licence Number.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); //} } } else { if (response.Contains("3333")) { isLoged = true; loginButton.Content = "Next"; licenceTextBox.IsEnabled = false; IdComboBox.Visibility = Visibility.Visible; studentLabel.Visibility = Visibility.Visible; JObject root = JObject.Parse(response); JArray bodyArray = (JArray)root["body"]; JObject studentObj; studentList = new List <Student>(); IdComboBox.Items.Add(new Student().StudentName = "Select Student"); for (int i = 0; i < bodyArray.Count; i++) //loop through rows { Student s = new Student(); studentObj = (JObject)bodyArray[i]; string id = studentObj.GetValue("id").ToString(); string name = studentObj.GetValue("name").ToString(); s.StudentId = id; s.StudentName = name; studentList.Add(s); IdComboBox.Items.Add(s); Console.WriteLine("Name: {0}, Id: {1}", name, id); } IdComboBox.SelectedIndex = 0; } else if (response.Contains("1111")) { ReadingTest rtest = new ReadingTest(this.testWindow); this.NavigationService.Navigate(rtest); } } }