private void LoadDataFromEjs() { try { ejpWindows.LoadingMessageWindow lmw = new ejpClient.ejpWindows.LoadingMessageWindow(); EjsBridge.ejsService.ejsCourse[] courses = null; BackgroundWorker bgw = new BackgroundWorker(); bgw.DoWork += delegate(object s3, DoWorkEventArgs doWorkArgs) { courses = EjsBridge.ejsBridgeManager.GetRegisteredCoursesForUser( App._currentEjpStudent.SessionToken, true); this._assignments = EjsBridge.ejsBridgeManager.GetAllPublishedAssignments( App._currentEjpStudent.SessionToken, false); }; bgw.RunWorkerCompleted += delegate(object s4, RunWorkerCompletedEventArgs workerCompletedArgs) { lmw.Close(); bgw.Dispose(); }; bgw.RunWorkerAsync(); lmw.ShowDialog(); ObservableAssignmentList aList = this.Resources["AssignmentList"] as ObservableAssignmentList; aList.Clear(); ObservableCourseList cList = this.Resources["CourseList"] as ObservableCourseList; cList.Clear(); foreach (ejsCourse course in courses) { cList.Add(course); } } catch (Exception ex) { SiliconStudio.DebugManagers.DebugReporter.Report( SiliconStudio.DebugManagers.MessageType.Error, "eJournalPlus Client - EJS Publish Assignment Window", "Loading data from EJS Failed" + "\nError: " + ex.Message); MessageBox.Show(ex.Message); } }
private void LoadDataFromEjs() { try { ejpWindows.LoadingMessageWindow lmw = new ejpClient.ejpWindows.LoadingMessageWindow(); EjsBridge.ejsService.ejsCourse[] courses = null; BackgroundWorker bgw = new BackgroundWorker(); bgw.DoWork += delegate(object s3, DoWorkEventArgs doWorkArgs) { courses = EjsBridge.ejsBridgeManager.GetRegisteredCoursesForUser( App._currentEjpStudent.SessionToken, true); this._assignments = EjsBridge.ejsBridgeManager.GetAllPublishedAssignments( App._currentEjpStudent.SessionToken, false); }; bgw.RunWorkerCompleted += delegate(object s4, RunWorkerCompletedEventArgs workerCompletedArgs) { lmw.Close(); bgw.Dispose(); }; bgw.RunWorkerAsync(); lmw.ShowDialog(); ObservableAssignmentList aList = this.Resources["AssignmentList"] as ObservableAssignmentList; aList.Clear(); ObservableCourseList cList = this.Resources["CourseList"] as ObservableCourseList; cList.Clear(); foreach (ejsCourse course in courses) { cList.Add(course); } } catch (Exception) { } }
private void LoadDataFromEjs() { try { ejpWindows.LoadingMessageWindow lmw = new ejpClient.ejpWindows.LoadingMessageWindow(); EjsBridge.ejsService.ejsCourse[] courses = null; BackgroundWorker bgw = new BackgroundWorker(); bgw.DoWork += delegate(object s3, DoWorkEventArgs doWorkArgs) { courses = EjsBridge.ejsBridgeManager.GetRegisteredCoursesForUser( App._currentEjpStudent.SessionToken, true); }; bgw.RunWorkerCompleted += delegate(object s4, RunWorkerCompletedEventArgs workerCompletedArgs) { lmw.Close(); bgw.Dispose(); }; bgw.RunWorkerAsync(); lmw.ShowDialog(); ObservableCourseList cList = this.Resources["CourseList"] as ObservableCourseList; foreach (ejsCourse course in courses) { cList.Add(course); } if (this._cb_Courses.Items.Count > 0) { this._cb_Courses.SelectedIndex = 0; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }