Beispiel #1
0
 /// <summary>
 /// 写入数据库
 /// </summary>
 /// <returns></returns>
 public static void Write()
 {
     foreach (Flow f in FlowMonitor.GetMonitor().GetViewData())
     {
         WriteDataByFlow(f);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 每秒进行的数据处理
        /// </summary>
        public void Refresh()
        {
            // 获取数据
            theDayFlow = FlowMonitor.GetMonitor().GetTheDayFlow();

            // 判断现在是否为新的一天
            if (DateTime.Now.ToLongTimeString() == "00:00:00")
            {
                theDayFlow[0] = theDayFlow[1] = 0;
                remindTime    = new short[] { 0, 0 };
                SetRemindTime(remindTime[0], remindTime[1]);
                SaveRemindDate();
            }

            // 判断是否超过警告线流量
            if (theDayFlow[0] >= warningALL)
            {
                // 提醒超过流量
                ShowRemindWindow();
                // 设置新的警告上限
                RefreshWarningData(++remindTime[0], FlowType.ALL);
                SetRemindTime(remindTime[0], remindTime[1]);
            }
            if (theDayFlow[1] >= warningUP)
            {
                // 提醒超过流量
                ShowRemindWindow();
                RefreshWarningData(++remindTime[1], FlowType.UP);
                SetRemindTime(remindTime[0], remindTime[1]);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 返回后台监控。
 /// </summary>
 /// <returns></returns>
 public static FlowMonitor GetMonitor()
 {
     if (backstageMonitor == null)
     {
         backstageMonitor = new FlowMonitor();
     }
     return(backstageMonitor);
 }