Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think it could be easier if you set a Mutex when launching second app.<br> In main app you could do this: if Mutex doesn't exist you run second app (which creates Mutex when run and release it when closing), otherwise you skip...</p> <p><strong>EDITED</strong>: You can't edit second app to insert the creation of a mutex, ok.<br> But you can do this in <strong>main app</strong>:</p> <ul> <li>Create a background worker <code>BackgroudWorker wrk</code></li> <li>Set a private bool to true: <code>bool running = false</code></li> <li>Execute wrk when you want the new app run: <code>if (running) return; running = true;</code></li> <li>wrk creates a Process and waits for its end</li> <li>when wrk ends <code>running = false</code></li> </ul> <p>Just an idea...</p> <p><strong>EDITED AGAIN:</strong><br> If you close first app and reopen it, user is able to run second app again.<br> So you could do this:</p> <ul> <li>Create a background worker <code>BackgroudWorker wrk</code></li> <li>Write a tmp file (on NTFS it can be empty)</li> <li>Execute wrk when you want the new app run:<br> if your tmp file exists then exit;</li> <li>wrk creates a Process and waits for its end</li> <li>when wrk ends deletes tmp file</li> </ul> <p>With this method, even if user quits your first app, tmp file remains on hdd; so when user runs first app again, second app will not be executed.<br> Remeber that if user is <strong>smart</strong> enough to undestand this, he could manully delete file and the trick is done.<br> Finally: are you sure user cannot run directly second app?</p>
 

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