/// <summary> /// Add a new AliveTask (it will be a new Thread) /// </summary> /// <param name="yourName">your task name</param> /// <param name="yourInfo">your task info</param> /// <returns></returns> private bool AddAliveTaskInfo(string yourName, AliveTaskInfo yourInfo) { if (aliveTaskList.ContainsKey(yourName)) { SetErrorMes("existed task name"); return(false); } else { aliveTaskList.Add(yourName, yourInfo); return(true); } }
/// <summary> /// Create New AliveTask [it will not start ] /// </summary> /// <param name="yourTaskName"></param> /// <param name="sqlcmd"></param> /// <param name="intervalTime"></param> /// <param name="yourAction"></param> /// <returns></returns> public bool CreateNewAliveTask(string yourTaskName, String sqlcmd, int intervalTime, delegateGetAliveTaskDataTableInfoEventHandler yourAction) { AliveTaskInfo tempTaskInfo = new AliveTaskInfo(yourTaskName, sqlcmd, intervalTime, this); tempTaskInfo.OnGetAliveTaskDataTableInfo += yourAction; if (AddAliveTaskInfo(yourTaskName, tempTaskInfo)) { tempTaskInfo.CreateAliveTaskThread(); return(true); } else { tempTaskInfo.Dispose(); tempTaskInfo = null; return(false); } }