private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (isSessionLoading == true) return; /********************************************************** * * 브라우저 오른쪽으로 이동 * **********************************************************/ Point point = new Point(browser.Right, 0); browser.Document.Window.ScrollTo(point); if (isLoading == false && studyGrid.Visible != true) browser.Visible = true; /********************************************************** * * PMS 막힘 확인 확인 * **********************************************************/ if (e.Url.ToString().IndexOf("http://10.99.1.4/IIWeb/default.htm") != -1 && pmsError == false) { pmsError = true; MessageBox.Show("PMS를 설치 혹은 우회 하셔야 합니다 :(", "Robot의 경고"); System.Diagnostics.Process.Start("http://10.99.1.4/IIWeb/default.htm"); System.Diagnostics.Process[] mProcess = System.Diagnostics.Process.GetProcessesByName(Application.ProductName); foreach (System.Diagnostics.Process p in mProcess) p.Kill(); Application.Exit(); } /********************************************************** * * 블랙보드 * **********************************************************/ if (browser.Document.Title.IndexOf("Service Temporarily Unavailable") != -1) { /************************************ * 블랙보드 연결 실패 ************************************/ loadingLabel.Text = "블랙보드 연결 실패"; loadingProgressBar.Value += 5; bb = null; isBBComplete = false; browser.Navigate(libraryStartUrl); } if (e.Url.ToString() == bbEndUrl) { if (isBBComplete == false) { /************************************ * 블랙보드 연결 완료 ************************************/ loadingLabel.Text = "블랙보드 연결 완료"; loadingProgressBar.Value += 5; bb = new BB(browser); isBBComplete = true; } else { browser.Navigate(bbAnnounceUrl); } } else if (e.Url.ToString() == bbAnnounceUrl) { /************************************ * 수강 정보 수집 단계 ************************************/ loadingLabel.Text = "수강 정보 수집중"; loadingProgressBar.Value += 3; bb.setBoard(); bb.getCourceMenu(); DevComponents.DotNetBar.ButtonItem[] bblist = new DevComponents.DotNetBar.ButtonItem[bb.board.Count()]; System.Windows.Forms.ToolStripMenuItem[] trayItem = new System.Windows.Forms.ToolStripMenuItem[bb.board.Count()]; for (int i = 0; i < bb.board.Length; i++) { if (bb.board[i] == null) break; bblist[i] = new DevComponents.DotNetBar.ButtonItem(); bblist[i].ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; bblist[i].CanCustomize = false; bblist[i].Name = "buttonItem" + Convert.ToInt32(i); bblist[i].Text = bb.board[i].name; bblist[i].Click += new System.EventHandler(sideBBClick); bblist[i].Click += new System.EventHandler(visibleBB); sideBB.SubItems.Add(bblist[i]); trayItem[i] = new System.Windows.Forms.ToolStripMenuItem(); trayItem[i].Name = "BBToolStripMenuItem" + i.ToString(); trayItem[i].Size = new System.Drawing.Size(152, 22); trayItem[i].Text = bb.board[i].name; trayItem[i].Click += new System.EventHandler(trayBBClick); trayItem[i].Click += new System.EventHandler(visibleBB); 블랙보드ToolStripMenuItem.DropDownItems.Add(trayItem[i]); } /************************************ * 수강 정보 수집 완료 ************************************/ loadingLabel.Text = "수강 정보 수집 완료"; loadingProgressBar.Value += 5; browser.Navigate(libraryStartUrl); } /********************************************************** * * 도서관 * **********************************************************/ if (e.Url.ToString().IndexOf(libraryEndUrl) != -1) { if (isLibraryComplete == false) { /************************************ * 도서관 연결 완료 ************************************/ loadingLabel.Text = "도서관 연결 완료"; loadingProgressBar.Value += 3; library = new Library(browser.Document.Cookie); isLibraryComplete = true; browser.Navigate(dormStartUrl); } else { browser.Navigate(dormStartUrl); } } /********************************************************** * * 기숙사 * **********************************************************/ if (e.Url.ToString().IndexOf(dormEndUrl) != -1) { if (isLibraryComplete == false) { /************************************ * 기숙사 연결 완료 ************************************/ loadingLabel.Text = "기숙사 연결 완료"; loadingProgressBar.Value += 3; library = new Library(browser.Document.Cookie); isLibraryComplete = true; browser.Navigate(mailStartUrl); } else { browser.Navigate(mailStartUrl); } } /********************************************************** * * 전자우편 - firstLoading 끝남 * **********************************************************/ if (e.Url.ToString().IndexOf(mailEndUrl) != -1) { if (isEmailComplete == false) { mailCookie = browser.Document.Cookie; isLoading = false; visiblePortal(); // notifyTimer.Start(); sayTimer.Start(); sessionTimer.Start(); mailForm = new MailForm(mailCookie); loadingLabel.Visible = false; loadingProgressBar.Visible = false; mailBox.Click += new System.EventHandler(mailBox_Click); facebookBox.Click += new System.EventHandler(facebookBox_Click); settingBox.Click += new System.EventHandler(settingBox_Click); weatherBox.Click += new System.EventHandler(weatherBox_Click); weatherClick.Click += new System.EventHandler(weatherBox_Click); notifyBox.Click += new System.EventHandler(notifyBox_Click); reloadBox.Click += new System.EventHandler(reloadBox_Click); mailBox.Click -= new System.EventHandler(loadingPictureBox_Click); facebookBox.Click -= new System.EventHandler(loadingPictureBox_Click); settingBox.Click -= new System.EventHandler(loadingPictureBox_Click); weatherBox.Click -= new System.EventHandler(loadingPictureBox_Click); notifyBox.Click -= new System.EventHandler(loadingPictureBox_Click); reloadBox.Click -= new System.EventHandler(loadingPictureBox_Click); visiblePortal(); trayIcon.ContextMenuStrip = trayMenuStrip; isEmailComplete = true; } } }
private void 종료ToolStripMenuItem_Click(object sender, EventArgs e) { notifyTimer.Stop(); sessionTimer.Stop(); sayTimer.Stop(); mailForm = null; settingForm = null; alarmForm = null; isExiting = true; System.Diagnostics.Process[] mProcess = System.Diagnostics.Process.GetProcessesByName(Application.ProductName); foreach (System.Diagnostics.Process p in mProcess) p.Kill(); Application.Exit(); }