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 WaitForBll
{
string strCurrentCulture = "";
public WaitForBll()
{
strCurrentCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
}
///
/// 生成计时器方法的xml节点属性对象
///
/// 计时器方法的xml节点
/// 计时器方法的xml节点属性对象
public MethodWaitFor GenerateMethodTimer(XmlNode xmlNode)
{
MethodWaitFor methodWaitFor = new MethodWaitFor();
methodWaitFor.isrun = xmlNode.SelectSingleNode("isrun").InnerText;
methodWaitFor.status = xmlNode.SelectSingleNode("status").InnerText;
methodWaitFor.name = xmlNode.SelectSingleNode("name").InnerText;
methodWaitFor.strIndex = xmlNode.SelectSingleNode("strIndex").InnerText;
methodWaitFor.label = xmlNode.SelectSingleNode("label").InnerText;
methodWaitFor.duringTimeText = xmlNode.SelectSingleNode("duringTimeText").InnerText;
methodWaitFor.duringTimeTextStrIndex = xmlNode.SelectSingleNode("duringTimeTextStrIndex").InnerText;
methodWaitFor.enableEndWaitfor = (xmlNode.SelectSingleNode("enableEndWaitfor").InnerText.ToLower()=="true")?true:false;
return methodWaitFor;
}
#region 检查所有属性设置是否满足要求
///
/// 检查所有属性设置是否满足要求
///
/// 暂停属性对象
/// 检查所有属性设置是否满足要求
public MethodPropertyInfo CheckProperty(MethodWaitFor methodWaitFor)
{
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 ExecutePause(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
}
}