35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
namespace PrintServiceTray;
|
|
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
try
|
|
{
|
|
// Prevent multiple instances
|
|
bool createdNew;
|
|
using var mutex = new Mutex(true, "LAAPC_PrintServiceTray_Mutex", out createdNew);
|
|
|
|
if (!createdNew)
|
|
{
|
|
MessageBox.Show("LAAPC Print Service Tray is already running.", "Already Running",
|
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
|
|
ApplicationConfiguration.Initialize();
|
|
Application.Run(new TrayApplicationContext());
|
|
|
|
GC.KeepAlive(mutex);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show($"Fatal error: {ex.Message}\n\n{ex.StackTrace}", "Error",
|
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
} |