Пример #1
0
        public static void Main(string[] args)
        {
            var mutex = new Mutex(true, UNIQUE + Environment.UserName, out var firstInstance);

            if (!firstInstance)
            {
                LittleBigMouseClient.Client.CommandLine(args);
                mutex.Close();
                return;
            }

            if (Environment.UserInteractive)
            {
                var daemon = new LittleBigMouseDaemon(args)
                {
                    ShutdownMode = ShutdownMode.OnExplicitShutdown
                };
                daemon.Run();
            }
            else
            {
                var evt           = new EventHandlerServiceWpf();
                var servicesToRun = new ServiceBase[]
                {
                    new LittleBigMouseService(new MonitorsService())
                };
                ServiceBase.Run(servicesToRun);
            }

            mutex.Close();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            bool  firstInstance;
            Mutex mutex = new Mutex(true, Unique + Environment.UserName, out firstInstance);

            if (!firstInstance)
            {
                LittleBigMouseClient.Client.CommandLine(args);
                mutex.Close();
                return;
            }

            if (Environment.UserInteractive)
            {
                LittleBigMouseDaemon daemon = new LittleBigMouseDaemon(args);
                daemon.Run();
            }
            else
            {
                var servicesToRun = new ServiceBase[]
                {
                    new LittleBigMouseService()
                };
                ServiceBase.Run(servicesToRun);
            }

            mutex.Close();
        }