示例#1
0
        /// <summary>
        /// the main task work
        /// </summary>
        /// <param name="taskInfo"></param>
        private void AliveTaskBody(object taskInfo)
        {
            DataTable lastTable = null;
            DataTable nowTable  = null;

            while (!IsKill)
            {
                myManualResetEvent.WaitOne();
                nowTable = executeMySqlDrive.ExecuteQuery(TaskSqlcmd);
                if (nowTable != null)
                {
                    if (nowTable.Rows.Count > 0)
                    {
                        PutOutAliveTaskDataTableInfo(nowTable);
                    }
                    else
                    {
                        if (lastTable == null)
                        {
                            PutOutAliveTaskDataTableInfo(nowTable);
                        }
                        else if (lastTable.Rows.Count > 0)
                        {
                            PutOutAliveTaskDataTableInfo(nowTable);
                        }
                    }
                }
                else
                {
                    executeMySqlDrive.SetErrorMes(" [ExecuteQuery] fail in RunSynchronousAliveTask");
                }
                lastTable = nowTable;
                Thread.Sleep(IntervalTime);
            }
        }
示例#2
0
        /// <summary>
        /// the main task work
        /// </summary>
        /// <param name="taskInfo"></param>
        private void MonitorTaskBody(object taskInfo)
        {
            string lastValue = executeMySqlDrive.ExecuteQuery(TaskSqlcmd, MonitorRowIndex, MonitorColumnIndex);
            string nowValue  = null;

            while (!IsKill)
            {
                myManualResetEvent.WaitOne();
                nowValue = executeMySqlDrive.ExecuteQuery(TaskSqlcmd, MonitorRowIndex, MonitorColumnIndex);
                if (lastValue != nowValue)
                {
                    lastValue = nowValue;
                    PutOutMonitorTaskDataTableInfo(lastValue);
                }
                Thread.Sleep(IntervalTime);
            }
        }