Esempio n. 1
0
        public ExtendedWebBrowser New(bool navigateHome, TaskBrowser.IEItem ieItem = new TaskBrowser.IEItem())
        {
            TabPage            page    = new TabPage();
            ExtendedWebBrowser browser = new ExtendedWebBrowser();

            if (ieItem != null)
            {
                ieItem.AddBrowser(browser);
            }
            page.Text                     = "新建窗口";
            page.Tag                      = browser;
            browser.Tag                   = page;
            browser.Dock                  = DockStyle.Fill;
            browser.DownloadComplete     += new EventHandler(this._browser_DownloadComplete);
            browser.StartNavigate        += new EventHandler <BrowserExtendedNavigatingEventArgs>(this._browser_StartNavigate);
            browser.StartNewWindow       += new EventHandler <BrowserExtendedNavigatingEventArgs>(this._browser_StartNewWindow);
            browser.DocumentCompleted    += new WebBrowserDocumentCompletedEventHandler(this._browser_DocumentCompleted);
            browser.StatusTextChanged    += new EventHandler(this._browser_StatusTextChanged);
            browser.DocumentTitleChanged += new EventHandler(this.WebBrowser_DocumentTitleChanged);
            browser.Quit                 += new EventHandler(this.WebBrowser_Quit);
            page.Controls.Add(browser);
            if (navigateHome)
            {
                browser.GoHome();
            }
            this.tabControl.TabPages.Add(page);
            this.tabControl.SelectedTab = page;
            return(browser);
        }
Esempio n. 2
0
 public void StartTaskThread(MyTask task)
 {
     this.StopTaskThread();
     this._taskThreadRun = true;
     if (this._ieItem == null)
     {
         this._ieItem = new TaskBrowser.IEItem(this, task, this._waitFindTime, this._waitDocCompleteTime);
         this.New(true, this._ieItem);
     }
 }
Esempio n. 3
0
 public void TaskThreadFunc(object sender, EventArgs ea)
 {
     if (this._completedIeItem != null)
     {
         this.SendCompleteTask(this._completedIeItem.Task._id, this._completedIeItem.IsCompleted, this._completedIeItem.TaskInfoIndex, this._completedIeItem.ErrorString);
         this._completedIeItem = null;
         this._ieItem          = null;
         Application.Exit();
     }
     if ((this._ieItem != null) && this._ieItem.Update(this))
     {
         this.CompleteIeItem(this._ieItem);
     }
 }
Esempio n. 4
0
        private void _browser_StartNavigate(object sender, BrowserExtendedNavigatingEventArgs ev)
        {
            ExtendedWebBrowser webBrowser = sender as ExtendedWebBrowser;

            if (!string.IsNullOrEmpty(webBrowser.Referer))
            {
                LoadTempHtml.SetIEConnectionMode(true);
            }
            TaskBrowser.IEItem iEItem = this.GetIEItem(webBrowser);
            if (iEItem != null)
            {
                iEItem.SetDocCompleted(false);
            }
        }
Esempio n. 5
0
 private void _browser_StartNewWindow(object sender, BrowserExtendedNavigatingEventArgs ev)
 {
     try
     {
         if ((ev.NavigationContext & UrlContext.HtmlDialog) != UrlContext.HtmlDialog)
         {
             TaskBrowser.IEItem iEItem  = this.GetIEItem(sender as ExtendedWebBrowser);
             ExtendedWebBrowser browser = this.New(false, null);
             if (iEItem != null)
             {
                 iEItem.AddBrowser(browser);
             }
             iEItem = null;
             ev.AutomationObject = browser.Application;
         }
     }
     catch (Exception)
     {
     }
 }
Esempio n. 6
0
 private void _browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs ev)
 {
     try
     {
         ExtendedWebBrowser webBrowser = sender as ExtendedWebBrowser;
         if (webBrowser != null)
         {
             if (ev.Url.Equals(webBrowser.Url))
             {
                 TaskBrowser.IEItem iEItem = this.GetIEItem(webBrowser);
                 if (iEItem != null)
                 {
                     iEItem.SetDocCompleted(true);
                 }
             }
             this.UpdateAddressBox();
         }
     }
     catch
     {
     }
 }
Esempio n. 7
0
 public void TaskThreadFunc(object sender, EventArgs ea)
 {
     if (this._completedIeItem != null)
     {
         this.SendCompleteTask(this._completedIeItem.Task._id, this._completedIeItem.IsCompleted, this._completedIeItem.TaskInfoIndex, this._completedIeItem.ErrorString);
         this._completedIeItem = null;
         this._ieItem = null;
         Application.Exit();
     }
     if ((this._ieItem != null) && this._ieItem.Update(this))
     {
         this.CompleteIeItem(this._ieItem);
     }
 }
Esempio n. 8
0
 public void StartTaskThread(MyTask task)
 {
     this.StopTaskThread();
     this._taskThreadRun = true;
     if (this._ieItem == null)
     {
         this._ieItem = new TaskBrowser.IEItem(this, task, this._waitFindTime, this._waitDocCompleteTime);
         this.New(true, this._ieItem);
     }
 }
Esempio n. 9
0
 public void CompleteIeItem(TaskBrowser.IEItem ieItem)
 {
     this._completedIeItem = ieItem;
 }
Esempio n. 10
0
 public void CompleteIeItem(TaskBrowser.IEItem ieItem)
 {
     this._completedIeItem = ieItem;
 }