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?
Thanks.
Update:
AddIn Startup Code:
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 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
Document Completed Code:
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