Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From my testing it would appear that option 1 outlined in the questions edit has done the trick ... for the most part.</p> <p>As has been stated, and of which I already understood, C# is a managed language; making memory management difficult.<br> However, by adding a <code>new SecureString()</code> object to one of the <code>ContextMenuStrip</code> menu items' <code>Tag</code> attributes, the menu object will persist in RAM.</p> <p>There are, sadly, two primary caveats to this approach:<br> <strong><em>1.</em></strong> If the machines RAM gets hit <strong>HARD</strong>, the <code>SecureString</code> object is either forcibly discarded or decoupled from the encompassing object and the page fault/swap is performed. I am unsure as to whether it re-couples together again post scenario, but it seems to do ok.<br> <strong><em>2.</em></strong> If the machine is put to sleep or hibernate, the whole app gets page swapped and the <code>SecureString</code> is most definitely discarded. To aid in these situations, I have a <code>SessionSwitchEventHandler</code> that detects if the machine has been unlocked and creates a <code>new SecureString()</code> object in a menu items' <code>Tag</code> attribute and re-associates the <code>ContextMenuStrip</code> object to the <code>NotifyIcon.ContextMenuStrip</code></p> <p>Although it's not the best solution, it does work and is better then creating a timer to touch the menu [shudders] or, worse, playing with the <code>Process.MinWorkerSet</code> [takes a shower at the thought]</p> <p>Thanks again to those who took part in the question and helped think further to find a solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload