Web浏览器控件加载Outlook不可用VB.Net [英] Web browser control loading Outlook unusable VB.Net

查看:156
本文介绍了Web浏览器控件加载Outlook不可用VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网络浏览器控件,添加到用户控件中,并且在选择电子邮件时自动导航到特定的URL(让我们说 https://www.google.com )。导航正在进行时,当点击电子邮件时,会减慢Outlook的实际性能,Outlook会等待页面加载。有没有办法,我可以在后台执行这个导航,而不影响Outlook的各种电子邮件的性能?

I have a web browser control that is added to a user control and is automatically made to navigate to a specific URL when an email is selected (lets say https://www.google.com). Whilst the navigation is going on, when clicking through emails, it slows down the actual performance of Outlook and outlook waits for the page to load. Is there a way I could carry out this navigation in the background without actually affecting the performance of Outlook when clicking through various emails?

谢谢。

更新:

AddIn启动代码

 Private Sub ThisAddIn_Startup() Handles Me.Startup

        myUserControl1 = New OutlookTaskPane
        myUserControl1.TabStop = True
        Dim width As Integer = myUserControl1.Width
        myCustomTaskPane = Me.CustomTaskPanes.Add(myUserControl1, "Title")
        myCustomTaskPane.Width = width
        myCustomTaskPane.Visible = True
        myCustomTaskPane.DockPositionRestrict = Microsoft.Office.Core.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange

        currentExplorer = Me.Application.Explorers.Application.ActiveExplorer
        AddHandler currentExplorer.SelectionChange, AddressOf myOutlookExplorer_SelectionChange
    End Sub

SelectionChange代码(电子邮件选择更改) strong>

SelectionChange Code (On Email selection change):

Private Sub myOutlookExplorer_SelectionChange() Handles currentExplorer.SelectionChange
        Dim RandNum As Integer = myUserControl1.GetRandomNumber(1, 100)
        ' Grid Loading Link
        myUserControl1.WebBrowser1.Navigate("https://www.google.com" & "?" & RandNum, Nothing, Nothing, "User-Agent:  Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko")
    End Sub

文档完成代码

Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        ' If the document is not completely ready, then don't perform the events below
        If Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
            Return
        End If
.... // lots of field setting/DOM manipulation after the DOM is loaded
End Sub


推荐答案

我想你使用 System.Windows.Forms.WebBrowser

有一个 Stop()方法可以尝试加载l请求新的 Navigate(String)

There is a Stop() method you could try to call before you request a new Navigate(String).

这篇关于Web浏览器控件加载Outlook不可用VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆