问题
I want to show a waiting dialog, in the meantime all the calculations concerning with PowerPoint objects still are running in the background. My purpose is during the time dealing with PowerPoint objects, I try to prevent the user from interfering with the UI.
It seems that there is no way to deal with PowerPoint objects in the background. Is there any workaround for my case?
Thanks
Note: I am using VS Ultimate 2013, C#, PowerPoint 2013, vsto
回答1:
Office applications use the single threaded apartment model. That's why you need to use the main thread for working with Office/PowerPoint objects. However, you can extract the required information into .Net collections and process the data on another thread.
But if you need to work with PowerPoint objects, a possible solution is to display a non-dialog form with a progress bar which display the state of your actions. Thus, end users will not be able to access the UI of PowerPoint. Don't forget to specify the parent window handle (PowerPoint window handle) for the Show method (see the IWin32Window interface).
来源:https://stackoverflow.com/questions/27291339/how-to-show-a-waiting-dialog-in-the-meantime-still-keep-dealing-with-powerpoin