コード例 #1
0
        public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)
        {
            var cursorClip    = System.Windows.Forms.Cursor.Clip;
            int lastUserInput = SetScreenBrightService.GetLastInputTime();

            if (lastUserInput > maxUserAfkTime / 1000)
            {
                BrightnessService.SetBrightness(5, 50);
                ServiceLogger.WriteEntry(String.Format("User is afk for {0} ms", lastUserInput), EventLogEntryType.Information, logEventId++);
            }
        }
コード例 #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
#if DEBUG
            SetScreenBrightService service = new SetScreenBrightService(new string[] { });
            service.onDebug();
            Console.WriteLine("Service is running in debugg mode");
            while (true)
            {
            }
#else
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new SetScreenBright(args)
            };
            ServiceBase.Run(ServicesToRun);
#endif
        }