Example #1
0
 public SetUpWindow()
 {
     InitializeComponent();
     if (AkConfig.SysParam == null)
     {
         AkConfig.ReadParam();
     }
 }
Example #2
0
        //UDP发送分线提醒方法
        //MainWindow.mainWindow.SendMess();
        /// <summary>
        /// 开始计算
        /// </summary>
        public void Start()
        {
            AkThreshold akThreshold = new AkThreshold();

            ///上一次任务执行的时间
            string lastTaskTime = string.Empty;

            while (true)
            {
                //清除日志
                clearLog();

                //@1.读取系统配置信息
                AkConfig.ReadParam();

                //AkConfig.SysParam = new AkSystemParamModel();
                //AkConfig.SysParam.TaskTime = 300;

                //@2.间隔时间,单位 ms
                int waitetime = AkTask.WatiTime(lastTaskTime);
                Thread.Sleep(waitetime);

                lastTaskTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                LogHelper.Info("开始任务时间 = ", lastTaskTime);

                //@3.线程跑阀值
                akThreshold.Excute(lastTaskTime);

                //@4是否分线提醒
                bool bl = new AkRemind().Remind();

                if (bl)
                {
                    MainWindow.mainWindow.SendMess("分线提醒");
                    LogHelper.Info("分线提醒: ", DateTime.Now.ToLongTimeString());
                }
                else
                {
                    MainWindow.mainWindow.SendMess("不分线提醒");
                    LogHelper.Info("不分线提醒: ", DateTime.Now.ToLongTimeString());
                }
                LogHelper.Info(string.Empty, string.Empty);
            }
        }