Exemplo n.º 1
0
 /// <summary>
 /// Add a new AliveMonitor (it will be a new Thread)
 /// </summary>
 /// <param name="yourName">your monitor name</param>
 /// <param name="yourInfo">your monitor info</param>
 /// <returns></returns>
 private bool AddAliveMonitorInfo(string yourName, SqlMonitor yourInfo)
 {
     if (aliveMonitorList.ContainsKey(yourName))
     {
         SetErrorMes("existed task name");
         return(false);
     }
     else
     {
         aliveMonitorList.Add(yourName, yourInfo);
         return(true);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create New MonitorTask [it will not start ]
        /// </summary>
        /// <param name="yourTaskName">Task Name</param>
        /// <param name="sqlcmd"></param>
        /// <param name="intervalTime">ms</param>
        /// <param name="yourAction"></param>
        /// <returns></returns>
        public bool CreateNewMonitorTask(string yourTaskName, String sqlcmd, int monitorRowIndex, int monitorColumnIndex, int intervalTime, delegateGetMonitorTaskDataTableInfoEventHandler yourAction)
        {
            SqlMonitor tempTaskInfo = new SqlMonitor(yourTaskName, sqlcmd, monitorRowIndex, monitorColumnIndex, intervalTime, this);

            tempTaskInfo.OnGetMonitorTaskDataTableInfo += yourAction;
            if (AddAliveMonitorInfo(yourTaskName, tempTaskInfo))
            {
                tempTaskInfo.CreateAliveTaskThread();
                return(true);
            }
            else
            {
                tempTaskInfo.Dispose();
                tempTaskInfo = null;
                return(false);
            }
        }