Exemple #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Wait 5 seconds if contended – in case another instance
            // of the program is in the process of shutting down.
            if (!mutex.WaitOne(TimeSpan.FromSeconds(5), false))
            {
                return;
            }

            try
            {
                //open the database...
                keyDatabase = new KeyDatabase();

                //show the tray icon...
                trayIcon = new TrayIcon();
                trayIcon.Show();

                Application.Run();
            }
            finally
            {
                mutex.ReleaseMutex();
            }
        }
Exemple #2
0
 public BusHandler(IBus bus, TrayIcon trayIcon)
 {
     _bus      = bus;
     _trayIcon = trayIcon;
     _bus.Subscribe(this);
 }