Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new Log4netTraceListener());
            LogConfig.ConfigureLogger(Assembly.GetExecutingAssembly().Location);

            using (var appCore = new FirmataWebApi.Core.FirmataWebApiCore())
            {
                appCore.Start();

                var signals = new UnixSignal[] {
                    new UnixSignal(Signum.SIGINT),
                    new UnixSignal(Signum.SIGTERM),
                };

                for (var exit = false; !exit;)
                {
                    var id = UnixSignal.WaitAny(signals);

                    if ((id >= 0) && (id < signals.Length))
                    {
                        if (signals[id].IsSet)
                        {
                            exit = true;
                        }
                    }
                }

                appCore.Stop();
                System.Environment.Exit(0);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new Log4netTraceListener());
            LogConfig.ConfigureLogger(Assembly.GetExecutingAssembly().Location);

            if (ServiceShell.ProcessInstallOptions(args))
            {
                return;
            }

            if (Environment.UserInteractive)
            {
                Console.SetWindowSize(Math.Min(120, Console.LargestWindowWidth), Math.Min(20, Console.LargestWindowHeight));
            }

            using (var appCore = new FirmataWebApi.Core.FirmataWebApiCore())
            {
                Service.StartService <Service>(
                    appCore.Start,
                    appCore.Stop,
                    Environment.UserInteractive);
            }
        }