//是否所有aiTask都结束了,如果都结束,则将allAIFinishFlags重置,并产生AllAITaskFinished事件 private void aiTaskFinishedhandler(EventArg e) { lock (aiTaskFinishedLockObject) { string aiThing = e.Source; if (allAIFinishFlags.ContainsKey(aiThing)) { allAIFinishFlags[aiThing] = true; //判断是否所有aiTask都结束 foreach (var flag in allAIFinishFlags) { if (flag.Value == false && (bool)MyHub.TryGetResourceSampleWithUri(flag.Key + @"/ison").ObjectVal) { return; } } var keys = allAIFinishFlags.Keys.ToArray(); //如果都结束,则将allAIFinishFlags重置 for (int i = 0; i < keys.Count(); i++) { allAIFinishFlags[keys[i]] = false; } //产生AllAITaskFinished事件 MyHub.EventHub.Publish(Path, "AllAITaskFinished", "AllAITaskFinished"); logger.Info("All AI task finished event fired!"); System.Diagnostics.Debug.WriteLine("AllAITaskFinished, time: " + DateTime.Now.ToLocalTime().ToString("HH:mm:ss.fff")); } } }
/// <summary> /// Only useful when this MDSThing is Slave /// </summary> public override void Start() { if (myConfig.MasterOrSlave == 2) { System.Diagnostics.Debug.WriteLine("Acitved by Master, start uploading...", DateTime.Now.ToLocalTime().ToString("HH:mm:ss.fff")); logger.Info("MdsSlave开始上传"); StartUploadAllAuto(); } }