예제 #1
0
        private void GetMergedReviewDocumentCompleted(object sender, GetMergedReviewDocumentCompletedEventArgs e)
        {
            object[]           args         = e.UserState as object[];
            OsbleServiceClient client       = args[0] as OsbleServiceClient;
            EventHandler       onCompletion = args[1] as EventHandler;

            if (null != e.Error || e.Cancelled || null == e.Result)
            {
                // Failure to get the merged reviews for a critical review discussion assignment
                // probably just means that OSBLE hasn't built one yet because the due date isn't
                // up for the critical review. My opinion is that we shouldn't have a bunch of logic
                // in ChemProV to try to determine whether or not this is the case, so if it fails
                // we'll just call it finished.
                onCompletion(this, new RelevantAssignmentEventArgs(m_files));
                return;
            }

            // Add the files from the zip
            AddFromZip(e.Result);

            // Finish up
            client.CloseAsync();
            m_gettingFiles = false;
            onCompletion(this, new RelevantAssignmentEventArgs(m_files));
        }
예제 #2
0
        private void OSBLESubmitReviewCompleted(object sender, SubmitReviewCompletedEventArgs e)
        {
            object[]           args           = e.UserState as object[];
            OsbleServiceClient osc            = args[0] as OsbleServiceClient;
            EventHandler       onSaveComplete = args[1] as EventHandler;

            // We're done with the OSBLE client and can close it
            osc.CloseAsync();

            onSaveComplete(this, new SaveEventArgs(null == e.Error && e.Result));
        }
예제 #3
0
        private void GetReviewItemsCompleted(object sender, GetReviewItemsCompletedEventArgs e)
        {
            object[]           args         = e.UserState as object[];
            OsbleServiceClient client       = args[0] as OsbleServiceClient;
            EventHandler       onCompletion = args[1] as EventHandler;

            if (null == e.Error && !e.Cancelled)
            {
                AddFromZip(e.Result);
            }

            client.CloseAsync();
            m_gettingFiles = false;
            onCompletion(this, new RelevantAssignmentEventArgs(m_files));
        }
예제 #4
0
        private void OsbleClient_GetCoursesCompleted(object sender, GetCoursesCompletedEventArgs e)
        {
            OsbleServiceClient osbleClient = e.UserState as OsbleServiceClient;

            try
            {
                m_courses = e.Result;
            }
            catch (Exception)
            {
                OnError(this, new OSBLEStateEventArgs(false,
                                                      "Could not get list of courses for this user. You may need to contact your professor " +
                                                      "or systems administrator to remedy this."));
                osbleClient.CloseAsync();
                return;
            }

            // If we don't have any courses then let the user know
            if (0 == m_courses.Count)
            {
                OnError(this, new OSBLEStateEventArgs(false,
                                                      "No courses were found for this user. You may need to contact your professor " +
                                                      "or systems administrator to remedy this."));
                return;
            }

            // Loading the course list does not load their child lists of assignments.
            // We need to do that now.
            osbleClient.GetCourseAssignmentsCompleted += OsbleClient_GetCourseAssignmentsCompleted;
            m_coursesRemaining = 0;
            foreach (Course course in m_courses)
            {
                try
                {
                    osbleClient.GetCourseAssignmentsAsync(course.ID, m_authToken, course);
                    Interlocked.Increment(ref m_coursesRemaining);
                }
                catch (Exception) { }
            }
        }