Пример #1
0
 private void OnTimeTick(object sender, TimerWrapperEventArgs e)
 {
     if (TimeTick != null)
     {
         TimeTick(sender, e);
     }
 }
Пример #2
0
 private void pageTimer_TimeOut(object sender, TimerWrapperEventArgs e)
 {
     mWebBrowser.BeginInvoke((MethodInvoker) delegate()
     {
         HtmlElement tmp = mWebBrowser.Document.GetElementById(TimerConfig.Id);
         if (tmp != null && currentActivity.MyIntent.ShowTimerCount)
         {
             tmp.InnerText = "";
         }
         Application.DoEvents();
         TimeOut();
     });
 }
Пример #3
0
 private void pageTimer_TimeTick(object sender, TimerWrapperEventArgs e)
 {
     mWebBrowser.BeginInvoke((MethodInvoker) delegate()
     {
         HtmlElement tmp = mWebBrowser.Document.GetElementById(TimerConfig.Id);
         int remain      = e.OutCount - e.CurrentCount;
         if (tmp != null && currentActivity.MyIntent.ShowTimerCount && (SystemStatus & AppStatus.OnAd) != AppStatus.OnAd)
         {
             tmp.InnerText = remain.ToString();
         }
         Application.DoEvents();
         TimeTick(e.CurrentCount);
     });
 }
Пример #4
0
        private void monitorTimer_TimeTick(object sender, TimerWrapperEventArgs e)
        {
            int nCurrentCount = mMonitorTimer.CurrentCount;

            mMonitorTimer.Stop();
            try
            {
                #region 清空管理界面计数器
                if (nCurrentCount % mClearClickNumInterval == 0)
                {
                    clearClickNum();
                }
                #endregion

                long calcInterval = GlobalAppData.GetInstance().MonitorTimeInterval;
                if (nCurrentCount % calcInterval == 0)
                {
                    if (SystemStatus == AppStatus.Idle ||
                        SystemStatus == AppStatus.OnAd ||
                        SystemStatus == AppStatus.OnStopServer)
                    {
                        #region 自动开关机时间检测
                        if (GlobalAppData.GetInstance().CloseAcmSwitch)
                        {
                            Log.Info("自动开关机时间检测...");
                            DateTime shutTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + GlobalAppData.GetInstance().CloseAcmTime);
                            DateTime shutTimeEnd = shutTime.AddMinutes(2); //2分钟内关机
                            if (DateTime.Now >= shutTime && DateTime.Now <= shutTimeEnd)
                            {
                                switch (GlobalAppData.GetInstance().CloseAcmType)
                                {
                                case GlobalAppData.ECloseAcmType.Close:
                                    WindowsController.ExitWindows(RestartOptions.PowerOff, true);
                                    System.Threading.Thread.Sleep(5000);
                                    break;

                                case GlobalAppData.ECloseAcmType.Restart:
                                    WindowsController.ExitWindows(RestartOptions.Reboot, true);
                                    System.Threading.Thread.Sleep(5000);
                                    break;
                                }
                                return;
                            }
                        }
                        #endregion

                        #region 发送tms状态监控报文
                        if (GlobalAppData.GetInstance().TMSSwitch)
                        {
                            #region 设备自检,判断当前设备是否正常,暂停服务或者恢复服务
                            Log.Info("设备自检开始...");

                            bool isHdError = HardwareManager.CheckAll();
                            if (!isHdError && SystemStatus != AppStatus.OnStopServer)
                            {
                                bool isNetError = !HardwareManager.CheckOne("GPRS");
                                HideAd();
                                string errMsg = isNetError ? "网络故障" : "设备故障";
                                Intent stop   = new Intent(mApplicationInfo.StopServerActivity);
                                stop.PutExtra("Message", errMsg);
                                SendMessage(ActivityManagerHandler.LAUNCH_ACTIVITY, stop);
                            }
                            #endregion

                            Log.Info("发送TMS终端监控报文...");
                        }
                        #endregion
                    }

                    nCurrentCount = 0;
                }
            }
            catch (System.Exception ex)
            {
                Log.Error(this, ex);
            }
            finally
            {
                mMonitorTimer.CurrentCount = nCurrentCount;
                mMonitorTimer.Start();
            }
        }