// Step 4 = Retrieve All Courses private int GetCourses(CISLogin MyLogin) { // get the Action URL by retreiveing the login webpage and parsing // the page to find the POST Action= item. CISAction CISAction = new CISAction(); string ActionUrl = CISAction.PostURL(SelectedCollege.RequestURL); try { // Listen for events myCourses.MessageResults += new InformationalMessage(SendMessage); SendMessage(this, new Information("Requesting course(s) from Website.")); try { myCourses.AddFromCIS(MyLogin, ExcelClassSettings, ActionUrl); } catch (Exception ex) { if (myCourses.Count() == 0) { string temp = ex.Message; throw; } // otherwise continue to process what was found } // Are there any courses? if (myCourses.Count() > 0) { CurrentCompletedStep = WizardStep.ClassesRetrieved; SendMessage(this, new Information(myCourses.Count() + " course(s) retreived.")); try { // set Monday Date ExcelRollSettings.FirstDay = Convert.ToDateTime(myCourses[0].StartDate); } catch { } } } catch { throw; } finally { // release events myCourses.MessageResults -= new InformationalMessage(SendMessage); } return(myCourses.Count()); }