54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
namespace IOB_MAN
|
|
{
|
|
internal static class Program
|
|
{
|
|
|
|
#region Private Fields
|
|
|
|
#if DEBUG
|
|
private static string appGuid = "1f4132ac-43fd-4547-8101-301f027d54e3";
|
|
#else
|
|
private static string appGuid = "b2e4c0c2-306a-4aa5-bf31-c8684d2229bb";
|
|
#endif
|
|
|
|
|
|
#endregion Private Fields
|
|
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
|
|
using (Mutex mutex = new Mutex(false, "Global\\" + appGuid))
|
|
{
|
|
// Se non otteniamo il possesso entro 500ms...
|
|
if (!mutex.WaitOne(500, false))
|
|
{
|
|
// Inizializziamo il framework per mostrare la form custom
|
|
ApplicationConfiguration.Initialize();
|
|
|
|
// Mostriamo la nostra form invece della MessageBox standard
|
|
var popup = new AutoClosingMessageBox(
|
|
"Un'altra copia del programma è già in esecuzione!",
|
|
"EgalWare IOB-MAN",
|
|
10 // Secondi di countdown
|
|
);
|
|
|
|
Application.Run(popup);
|
|
return; // Usciamo dall'applicazione
|
|
}
|
|
|
|
// --- Avvio normale dell'applicazione ---
|
|
ApplicationConfiguration.Initialize();
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
|
|
|
Application.Run(new BlazorForm());
|
|
}
|
|
|
|
}
|
|
}
|
|
} |