var assembly = Assembly.GetExecutingAssembly();
string version = assembly.GetName().Version.ToString();
Dienstag, 11. Dezember 2018
how to get the current assembly version
how to avoid multiple executions of a program
Define any unique ID / UID like 'a2c204cc-50a1-4fde-b47f-5b712821edf3' . If this UID isn't free, abort the application. Otherwise block it with the current process.
prepare application
startup application
final exit of the application:
prepare application
public static System.Threading.Mutex mutex;
public static bool createdNewMutex;
startup application
mutex = new System.Threading.Mutex(true, "a2c204cc-50a1-4fde-b47f-5b712821edf3", out createdNewMutex);
if (!createdNewMutex) base.Shutdown(0);
final exit of the application:
if (App.createdNewMutex) App.mutex.ReleaseMutex();
Abonnieren
Posts (Atom)