none
Is there a way to detect Application Idle in VSTO? RRS feed

  • Question

  • Hi,

    Is there a way to detect if the application is idle?   I couldn't find any app idle events.  I'm writing an Outlook add-in using VSTO.    Thanks,

    Alex

    Tuesday, August 28, 2012 5:49 PM

Answers

  • If you can use Redemption you can run instances of RDOSession in background threads. You need to create that local session in the background thread and pass it the NameSpace.MAPIOBJECT object property so it's using the same MAPI session as Outlook is using. Then as long as you don't use the OOM in the background thread at all everything works just fine.
     
    I use that all the time, for example in one addin where I download over 1500 contacts in the background without impacting Outlook UI responsiveness.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "alexkfh" <=?utf-8?B?YWxleGtmaA==?=> wrote in message news:abc5a512-4ec1-4491-bdb6-43d17df54ad7...

    What we are doing with VSTO makes Outlook sluggish for our customers.  Unfortunately since OOM cannot be used on a background thread we're stuck with processing everything on the foreground.  If we were to do the processing while the application was idle then the noticable sluggishness could be reduced. 

      

    Ken Slovak MVP - Outlook
    • Marked as answer by alexkfh Wednesday, August 29, 2012 6:11 PM
    Wednesday, August 29, 2012 6:09 PM

All replies

  • usually in .net languages it is encouraged to use background threads to do work that is not related to any UI or user interaction.
    Tuesday, August 28, 2012 6:02 PM
  • too bad...  

    Thanks.

    Tuesday, August 28, 2012 8:19 PM
  • Hi Alex,

    What's mean of Idle. Is it a IDE of Python?

    T.X.


    志异征诛,三让两家王朝
    功同开辟,一桮万古江南


    Wednesday, August 29, 2012 6:11 AM
  • no, there is a windows message - idle, which means that there was no user interaction with window/ program for a while. Something like poor man's solution to doing work without interrupting user.
    Wednesday, August 29, 2012 9:08 AM
  • What we are doing with VSTO makes Outlook sluggish for our customers.  Unfortunately since OOM cannot be used on a background thread we're stuck with processing everything on the foreground.  If we were to do the processing while the application was idle then the noticable sluggishness could be reduced. 

      
    Wednesday, August 29, 2012 5:05 PM
  • If you can use Redemption you can run instances of RDOSession in background threads. You need to create that local session in the background thread and pass it the NameSpace.MAPIOBJECT object property so it's using the same MAPI session as Outlook is using. Then as long as you don't use the OOM in the background thread at all everything works just fine.
     
    I use that all the time, for example in one addin where I download over 1500 contacts in the background without impacting Outlook UI responsiveness.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "alexkfh" <=?utf-8?B?YWxleGtmaA==?=> wrote in message news:abc5a512-4ec1-4491-bdb6-43d17df54ad7...

    What we are doing with VSTO makes Outlook sluggish for our customers.  Unfortunately since OOM cannot be used on a background thread we're stuck with processing everything on the foreground.  If we were to do the processing while the application was idle then the noticable sluggishness could be reduced. 

      

    Ken Slovak MVP - Outlook
    • Marked as answer by alexkfh Wednesday, August 29, 2012 6:11 PM
    Wednesday, August 29, 2012 6:09 PM
  • Thanks Ken.

    Ken and Redemption to the rescue once again.  :) 

    Wednesday, August 29, 2012 6:12 PM
  • And you have to thank Dmitry for Redemption :)

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "alexkfh" <=?utf-8?B?YWxleGtmaA==?=> wrote in message news:b4d0ab45-f373-45e7-ad1b-b3f1114288ab...

    Thanks Ken.

    Ken and Redemption to the rescue once again.  :) 


    Ken Slovak MVP - Outlook
    Wednesday, August 29, 2012 6:50 PM