public BaseManager GetManager(ManagerType type) { BaseManager mgr = managerDic.TryGet(type); if (mgr == null) { throw new System.Exception("没有找到对应管理器:" + type.ToString()); } return(mgr); }
public MyThreadManager(ManagerType managerType, IEnumerable <MyThread> threads = null) { _logger.Trace($"Creating new ThreadManager(ManagerType = {managerType.ToString()}"); this.ManagerType = managerType; if (threads != null) { this.Threads = new List <MyThread>(threads); } else { this.Threads = new List <MyThread>(); } }
/// <summary> /// Creates ensemble manager of corresponding type and /// initializes from current research. /// </summary> protected void CreateEnsembleManager() { ManagerTypeInfo[] info = (ManagerTypeInfo[])managerType.GetType().GetField(managerType.ToString()).GetCustomAttributes(typeof(ManagerTypeInfo), false); Type t = Type.GetType(info[0].Implementation); currentManager = (AbstractEnsembleManager)t.GetConstructor(Type.EmptyTypes).Invoke(new Object[0]); currentManager.ModelType = modelType; currentManager.TracingDirectory = TracingPath == "" ? "" : TracingPath; currentManager.TracingPath = (TracingPath == "" ? "" : TracingPath + "\\" + ResearchName); currentManager.CheckConnected = CheckConnected; currentManager.VisualMode = VisualMode; currentManager.RealizationCount = realizationCount; currentManager.ResearchName = ResearchName; currentManager.ResearchType = GetResearchType(); currentManager.GenerationType = GenerationType; currentManager.TracingType = TracingType; currentManager.AnalyzeOptions = AnalyzeOption; currentManager.NetworkStatusUpdateHandlerMethod = AbstractResearch_OnUpdateNetworkStatus; FillParameters(currentManager); }