public void AddTask(ExecInfoModelBase execInfo) { if (_timerCollection == null) { _timerCollection = new List <CustomTimerBase>(); } _timerCollection.Add(TimerLoadingFactory.CreateTimerType(execInfo)); }
private static string GetTimerTypeName(ExecInfoModelBase execType) { string removeSuffix = "InfoModel"; StringBuilder execName = new StringBuilder(execType.GetType().Name); execName.Replace(removeSuffix, string.Empty); return(execName.ToString()); }
public static CustomTimerBase CreateTimerType(ExecInfoModelBase execType) { string prefix = "TasksManager."; string timerSuffix = "Timer"; StringBuilder timerName = new StringBuilder(prefix); timerName.Append(GetTimerTypeName(execType)); timerName.Append(timerSuffix); Type timerType = Type.GetType(timerName.ToString()); object instance = Activator.CreateInstance(timerType, execType); return(instance as CustomTimerBase); }
public CustomTimerBase(ExecInfoModelBase execInfo) { this.ReportTask += TaskMessageQueue.GetInstance().AddToQueue; }