/// <summary> /// 关闭工站/设备,释放各种资源 /// </summary> public void Close() { string errInfo = ""; ///关闭工站 IJFMainStation mainStation = StationMgr.MainStation; if (null != mainStation) { mainStation.Stop(out errInfo); } string[] stationNames = StationMgr.AllStationNames(); if (null != stationNames && stationNames.Length > 0) { foreach (string stationName in stationNames) { IJFStation station = StationMgr.GetStation(stationName); station.Stop(); } } ///关闭所有设备 string[] deviceIDs = InitorManager.GetIDs(typeof(IJFDevice)); if (null != deviceIDs && deviceIDs.Length > 0) { foreach (string devID in deviceIDs) { IJFDevice dev = InitorManager.GetInitor(devID) as IJFDevice; dev.CloseDevice(); } } ///释放其他对象 ///添加代码 ... }