using DriverLib.Engine; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; using XCoreBLL.Resource; using XImagingXhandler.XDAL; namespace XCoreBLL { public class TimerBll { string strCurrentCulture = ""; public TimerBll() { strCurrentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name; } /// /// 生成计时器方法的xml节点属性对象 /// /// 计时器方法的xml节点 /// 计时器方法的xml节点属性对象 public MethodTimer GenerateMethodTimer(XmlNode xmlNode) { MethodTimer methodTimer = new MethodTimer(); try { methodTimer.isrun = xmlNode.SelectSingleNode("isrun").InnerText; methodTimer.status = xmlNode.SelectSingleNode("status").InnerText; methodTimer.name = xmlNode.SelectSingleNode("name").InnerText; methodTimer.strIndex = xmlNode.SelectSingleNode("strIndex").InnerText; methodTimer.label = xmlNode.SelectSingleNode("label").InnerText; methodTimer.duringTime = xmlNode.SelectSingleNode("duringTime").InnerText; methodTimer.duringTimeInfo = xmlNode.SelectSingleNode("duringTimeInfo").InnerText; } catch(Exception ex) { } return methodTimer; } #region 检查所有属性设置是否满足要求 /// /// 检查所有属性设置是否满足要求 /// /// 暂停属性对象 /// 检查所有属性设置是否满足要求 public MethodPropertyInfo CheckProperty(MethodTimer methodTimer) { MethodPropertyInfo methodPropertyInfo = new MethodPropertyInfo(); if (strCurrentCulture == "zh-CN") { methodPropertyInfo.property_tips_info = PauseMoveResourceCHS.tipsInfo.ToString(); //if (methodPauseMove.armText == null || methodPauseMove.armText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceCHS.armText.ToString(); //} //if (methodPauseMove.labwareText == null || methodPauseMove.labwareText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceCHS.labwareText.ToString(); //} //if (methodPauseMove.labwaretipText == null || methodPauseMove.labwaretipText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceCHS.labwaretipText.ToString(); //} //if (methodPauseMove.pauseTime == null || methodPauseMove.pauseTime == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceCHS.pauseTime.ToString(); //} //if (methodPauseMove.positionText == null || methodPauseMove.positionText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceCHS.positionText.ToString(); //} } else if (strCurrentCulture == "en-US") { methodPropertyInfo.property_tips_info = PauseMoveResourceENU.tipsInfo.ToString(); //if (methodPauseMove.armText == null || methodPauseMove.armText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceENU.armText.ToString(); //} //if (methodPauseMove.labwareText == null || methodPauseMove.labwareText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceENU.labwareText.ToString(); //} //if (methodPauseMove.labwaretipText == null || methodPauseMove.labwaretipText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceENU.labwaretipText.ToString(); //} //if (methodPauseMove.pauseTime == null || methodPauseMove.pauseTime == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceENU.pauseTime.ToString(); //} //if (methodPauseMove.positionText == null || methodPauseMove.positionText == "") //{ // methodPropertyInfo.property_name_info = PauseMoveResourceENU.positionText.ToString(); //} } return methodPropertyInfo; } #endregion //#region 执行暂停,返回结果字符串 ///// ///// 执行暂停,返回结果字符串 ///// ///// 1:暂停;2:继续 ///// ///// 结果实体对象 //public HxResult ExecuteTimer(int flag, bool isSimulator = false) //{ // HxResult ret = new HxResult(); // if (!isSimulator) // { // if (flag == 1) // { // ret = MethodAction.Instance.Interrupt(flag, true); // } // else if (flag == 2) // { // ret = MethodAction.Instance.Interrupt(flag, false); // } // } // else // { // ret.Result = ResultType.Success; // } // return ret; //} //#endregion } }