using DataEntity.Share;
|
using DriverLib.Engine;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Reflection;
|
using System.Windows;
|
using System.Xml;
|
using XCommon;
|
using XCommon.Log;
|
using XCore;
|
using XHandler.Controls.Run.Com;
|
using XHandler.View;
|
using XHandler.View.MethodProperty;
|
using XImaging.Automation.Service.Interface;
|
using XImagingXhandler.XDAL;
|
using static HxEnum.OperationTypeEnum;
|
using DataRWDAL;
|
using NPOI.SS.Formula.Functions;
|
using System.Windows.Controls;
|
|
namespace XHandler.Controls
|
{
|
public class SetVariableControl
|
{
|
string strCurrentCulture = "";
|
public RunWnd launchView = null;
|
public SetVariableControl(string strCurrentCulture)
|
{
|
this.strCurrentCulture = strCurrentCulture;
|
}
|
|
#region 执行变量设置,返回结果字符串
|
public bool ExecuteSetVariable(XmlNode xmlEnv, XmlNode methodNode)
|
{
|
bool result = true;
|
if (launchView._cancelSource.IsCancellationRequested)
|
{
|
result = false;
|
return result;
|
}
|
#region Start Log
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strStart.ToString());
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】> Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】start:");
|
}
|
#endregion
|
|
#region 数据准备
|
bool enablepopwin = methodNode.SelectSingleNode("enablepopwin").InnerText.ToLower()=="true"?true:false;
|
string variablename = methodNode.SelectSingleNode("variablename").InnerText;
|
string variablevalue = methodNode.SelectSingleNode("variablevalue").InnerText;
|
#endregion
|
|
if (enablepopwin)
|
{
|
if (!launchView.isRemotingOper)
|
{
|
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
|
{
|
SetVariablePopwin setVariablePopwin = new SetVariablePopwin(variablename, variablevalue);
|
setVariablePopwin.variablename = variablename;
|
setVariablePopwin.variablevalue = variablevalue;
|
setVariablePopwin.Width = 1920;
|
setVariablePopwin.Height = 1080;
|
setVariablePopwin.WindowStartupLocation= WindowStartupLocation.CenterScreen;
|
setVariablePopwin.ShowDialog();
|
variablevalue = setVariablePopwin.variablevalue;
|
}));
|
}
|
else
|
{
|
|
}
|
}
|
Variable variable = new Variable();
|
variable.variablename = variablename;
|
variable.variablecurval = variablevalue;
|
variable.variableinitval = variablevalue;
|
launchView.gloadVariable.Push(variable);
|
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString()
|
+ Properties.Resources.strDataOfVariable+":"+Properties.Resources.strVariable+":"+variable.variablename+" , "
|
+Properties.Resources.strValue+":"+variable.variableinitval.ToString());
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: variable list:"+"variable name:"+variable.variablename+","+"variable value:"+variable.variableinitval.ToString());
|
}
|
|
if (strCurrentCulture.Equals("zh-CN"))
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】" + Properties.MachineRunResource.strProgress.ToString() + Properties.MachineRunResource.strEnd.ToString());
|
}
|
else
|
{
|
launchView.AddLogs("【" + DateTime.Now.ToString("HH:mm:ss:fff") + "】>Xhandler: 【" + methodNode.SelectSingleNode("name").InnerText + "】progress: completed.");
|
}
|
|
return result;
|
}
|
#endregion
|
}
|
}
|