So, I have a [.NET] program that implements a NotifyIcon that persists in the Notification Tray in Windows for the entire time that the program runs. When I first execute the program, and for a small time afterwards, the NotifyIcon and associated ContextMenuStrip work an absolute charm.
However, after some time of the machine being in a lower power state or just idle for a few hours, when trying to access the Context Menu, it can take up to 2 seconds for the object to draw.
Is there some persistence need to define to get the menu to respond faster? Have I enabled an incorrect event that is firing a cleanup of resources?
Edit
It would seem that I have 3 options to see if I can get this to work:
1. Insert a SecureString
object into the ContextMenuStrip
object; this assumes that by having the SecureString
inside the ContextMenuStrip
, the whole object will be treated the same and will not be page swapped
2. Create a Timer
that touches the ContextMenuStrip
on interval in some manner to keep it in memory
3. Alter Process.MinWorkingSet
when the app has completed initial launch to try (read: hope) that the ContextMenuStrip
object is kept alive and not something else
I really am not a fan of items 2 or 3; 3 especially. I am going to try item 1 and see if it works.
Thanks for the responses so far!