none
Suggestions on employing BackgroundWorker or similar strategy to speed up processing? RRS feed

  • Question

  • I am using Word's WindowSelectionChange event to tell me when the user has modified the content of a specific area of the active document. At this point, the code in my VSTO global add-in performs a series of steps such as checking various ranges and updating content in the document's header. The problem I am seeing is that an hourglass is shown during this processing, and Word 2013 has a definite performance lag when compared against Word 2010. 

    Other than the usual things (i.e., optimizing use of Word objects, using Range instead of Selection object whenever possible, suppressing ScreenUpdating, discreet use of DoEvents, etc.), I am looking for ideas on how I can make this lag less obvious. I have heard of the BackGroundWorker class but I do not know much about it... Or, would that possibly lead to problems if called from within a Word add-in's WindowSelectionChange event (any maybe it is not even possible)?

    Any tips or suggestions will be greatly appreciated.

    Monday, May 12, 2014 7:34 PM

Answers

  • Hi,

    >> At this point, the code in my VSTO global add-in performs a series of steps such as checking various ranges and updating content in the document's header.<<

    In this case, we could use multi-threading to improve user experience (it is not really speed-up since Office Object Model is Single Thread Apartment (STA) Model).

    For questions about BackGroundWorker Class, I suggest you reposting it to .NET Forum (like  Visual C# forum).

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, May 13, 2014 8:42 AM
    Moderator