Exemplo n.º 1
0
        public MainService(App app,
                           ScreenService screen,
                           ConfigService config,
                           CacheService cache)
        {
            this.screen = screen;
            this.config = config;
            this.cache  = cache;

            //初始化用眼计时器
            timer          = new DispatcherTimer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, config.options.general.warntime, 0);
            //初始化离开检测计时器
            leave_timer          = new DispatcherTimer();
            leave_timer.Tick    += new EventHandler(leave_timer_Tick);
            leave_timer.Interval = new TimeSpan(0, 5, 0);
            //初始化回来检测计时器
            back_timer          = new DispatcherTimer();
            back_timer.Tick    += new EventHandler(back_timer_Tick);
            back_timer.Interval = new TimeSpan(0, 1, 0);


            /****调试模式代码****/
#if DEBUG
            //60秒提示休息
            timer.Interval = new TimeSpan(0, 1, 0);
            //20秒表示离开
            leave_timer.Interval = new TimeSpan(0, 0, 20);
            //每10秒检测回来
            back_timer.Interval = new TimeSpan(0, 0, 10);
#endif
            app.Exit += new ExitEventHandler(app_Exit);
        }
Exemplo n.º 2
0
        public MainService(App app,
                           ScreenService screenService,
                           ConfigService configService,
                           CacheService cache)
        {
            this.screenService = screenService;
            this.config        = configService;
            this.cache         = cache;

            //初始化用眼计时器
            timer          = new DispatcherTimer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 20, 0);
#if DEBUG
            timer.Interval = new TimeSpan(0, 0, 20);
#endif

            //初始化离开检测计时器
            leave_timer          = new DispatcherTimer();
            leave_timer.Tick    += new EventHandler(leave_timer_Tick);
            leave_timer.Interval = new TimeSpan(0, 5, 0);

            //初始化回来检测计时器
            back_timer          = new DispatcherTimer();
            back_timer.Tick    += new EventHandler(back_timer_Tick);
            back_timer.Interval = new TimeSpan(0, 1, 0);

            app.Exit += new ExitEventHandler(app_Exit);
        }
Exemplo n.º 3
0
 public MainService(App app,
                    ScreenService screen,
                    ConfigService config,
                    CacheService cache,
                    StatisticService statistic)
 {
     this.screen    = screen;
     this.config    = config;
     this.cache     = cache;
     this.statistic = statistic;
     app.Exit      += new ExitEventHandler(app_Exit);
 }
Exemplo n.º 4
0
 public MainService(App app,
                    ScreenService screen,
                    ConfigService config,
                    CacheService cache,
                    StatisticService statistic)
 {
     this.screen    = screen;
     this.config    = config;
     this.cache     = cache;
     this.statistic = statistic;
     app.Exit      += new ExitEventHandler(app_Exit);
     SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged);
 }