public void ExamWorkstations() { while (true) { Thread.Sleep(2000); foreach (WorkStation station in _currentSessionWorkstations) { var wIp = station.IP; using (ClientServiceClient client = new ClientServiceClient()) { var selectedUser = client.GetUserForWorkstation(_currentExamSessionID, station.WorkStationId); var errorsforuser = client.GetOffenceScreenId(selectedUser); foreach (Student s in _currentSessionStudents) { if (s.Ip == wIp) { s.WrongPageCount = errorsforuser.Length.ToString(); } } } _currentdataGridStudents.Dispatcher.Invoke(() => _currentdataGridStudents.ItemsSource = null); _currentdataGridStudents.Dispatcher.Invoke(() => _currentdataGridStudents.ItemsSource = _currentSessionStudents); } } }
private void comboboxScreenNumber_SelectionChanged(object sender, SelectionChangedEventArgs e) { _currentWorkstationOffense = new List <int>(); if (comboboxScreenNumber.SelectedItem == null) { return; } var selectedip = comboboxScreenNumber.SelectedItem.ToString().Substring(0, comboboxScreenNumber.SelectedItem.ToString().IndexOf("-")); var selectedWorkstation = _currentSessionWorkstations.Find(x => x.IP == selectedip); int selectedUser; using (ClientServiceClient client = new ClientServiceClient()) { selectedUser = client.GetUserForWorkstation(examSessionId, selectedWorkstation.WorkStationId); var errorsforuser = client.GetOffenceScreenId(selectedUser); comboboxOfenceID.Items.Clear(); for (int i = 0; i < errorsforuser.Length; i++) { _currentWorkstationOffense.Add(errorsforuser[i]); comboboxOfenceID.Items.Add(client.GetOffenceScreenInfo(Convert.ToInt32(errorsforuser[i]))); } } }