1

I have custom winform front end that takes parameter settings from a user and builds a url for an ssrs report and displays the report in a WebBrowser control. This works nicely except I need to calculate the time it takes for the report to show on the screen.

I have tried (WebBrowser HTML Document):

DocumentCompleted event - problem: this is getting called when the loading dialog is still visible.

ProgressChanged event - problem: I tried to get the ready state of the document but it still shows as completed when the Loading dialog is showing.

It seems that the loading of the report must be an ajax call from the ssrs server so I am now looking what I can do to determine when that happens.

So, what I need to do is capture when the report is actually displayed in the web browser control (not when the loading dialog is displayed). Any suggestions on how to accomplish this?

EDIT: This is something I tried which seems to work the first time, but still isn't right. The problem is the ProgressChanged event that I am triggering off of, I am just using this is a catch all for any page event. I am thinking that I would like to key of the Async event on the page so I am executing on the correct event.

Sample:

Private Sub ReportDocumentLoaded() Handles wbReportViewer.ProgressChanged
    Dim doc As HtmlDocument = wbReportViewer.Document
    If Not doc Is Nothing Then
        Dim el As HtmlElement = doc.GetElementById("ReportViewerControl_AsyncWait_Wait")
        If Not el Is Nothing Then
            Dim rptStyles = el.Style.Split(";")
            For Each s As String In rptStyles
                If s.ToUpper.Contains("VISIBILITY") Then
                    If s.ToUpper.Contains("HIDDEN") Then
                        MsgBox("Report is displayed" & s)
                    End If
                End If
            Next
        End If
    End If
End Sub 

I am thinking, for my situation, I will have to attach to the page event by injecting in some JavaScript.

http://msdn.microsoft.com/en-us/library/bb386417(v=vs.100).aspx

4

1 に答える 1