0

Here's my problem. I've made a simple stopwatch using WPF with start stop pause functions. Now what I want to do is that no matter how many times someone opens the .exe they will always see the same stopwatch. I've used Mutex to check if the app is already running and I was able to restrict opening a new instance off the app and instead switch to the first instance opened. What I want to achieve is not have only one window open but any windows that open after the first one to be running the same instance.

Please feel free to ask for more details. Thank you in advance.

AkisRep
  • 9
  • 2
  • *"any windows that open after the first one"* How would the user open a second window? Isn't that exactly what you already prevented from happening with the mutex? – Heinzi Mar 22 '21 at 16:15
  • Yeah that's exactly what's going on but it's now how I want it to behave. I have a check in place that depending on if the app has been started with admin rights the start/stop/pause buttons will show, otherwise they'll see only the timer. This timer should display the same information regardless of rights. That's why I need the app to be able to open multiple times but run the same instance. Apologies for the messy explanation – AkisRep Mar 22 '21 at 16:19
  • Ah, so you want *different users* to be able to start the app at the same time and see the same instance? – Heinzi Mar 22 '21 at 16:20
  • Yes that sounds about right – AkisRep Mar 22 '21 at 16:22
  • What kind of multi-user system are we talking about? Terminal server? Multiple users on multiple PCs in the same LAN? – Heinzi Mar 22 '21 at 16:27
  • Multiple users on the same LAN is what I was going for. – AkisRep Mar 22 '21 at 16:29
  • 1
    I see. They can't share the same process. You'll have to store the data (state of the stopwatch, start time, etc.) in some kind of *central storage* which is accessed by all the WPF clients running on the PCs. There are two canonical ways to do that: (a) store the data in a database or (b) implement your application as a web application instead. – Heinzi Mar 22 '21 at 16:33
  • Thank you very much! I think I'll go with the web app route. – AkisRep Mar 22 '21 at 17:31

0 Answers0