本文整理汇总了C#中Variable.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# Variable.Connect方法的具体用法?C# Variable.Connect怎么用?C# Variable.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable.Connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateReceiveVariables
private void CreateReceiveVariables(IEnumerable<RecipeVariable> receiveCollection)
{
try
{
Variable variable = new Variable(m_Cpu, "btnSendProductionData");
variable.ValueChanged += new VariableEventHandler(SendProductionData_ValueChanged);
variable.Error += new PviEventHandler(v_Error);
variable.Active = true;
variable.Connect();
variable.Value.Assign(0);
variable.WriteValue();
m_RecipeVariables.Clear();
foreach (RecipeVariable rv in receiveCollection)
{
variable = new Variable(m_Cpu, rv.Name);
variable.Active = true;
variable.Connect();
m_RecipeVariables.Add(rv);
}
}
catch (System.Exception ex)
{
Log.LogError("", ex);
}
}
示例2: CreateSendVariables
private void CreateSendVariables(IEnumerable<RecipeVariable> variableCollection)
{
try
{
foreach (RecipeVariable rv in variableCollection)
{
Variable variable = new Variable(m_Cpu, rv.Name);
variable.ValueChanged += new VariableEventHandler(variable_ValueChanged);
variable.Active = true;
variable.Connect();
variable.Disconnected += new PviEventHandler(variable_Disconnected);
variable.Error += new PviEventHandler(v_Error);
Debug.Print(rv.Name);
}
}
catch (System.Exception ex)
{
}
}
示例3: SetCpu
public void SetCpu(Cpu cpu)
{
try
{
this.m_Cpu = cpu;
InitVariable("updateProductionFile", new VariableEventHandler(filesRequested));
InitVariable("updateMasterFile", new VariableEventHandler(filesRequested));
for (int i = 0; i < 150; i++)
{
InitVariable(String.Format("productionFileDirectory[{0}]", i));
InitVariable(String.Format("masterFileDirectory[{0}]", i));
}
Variable v = new Variable(m_Cpu, "communicationsActive");
v.Error += new PviEventHandler(v_Error);
v.Connected += new PviEventHandler(v_Connected);
v.WriteValueAutomatic = false;
v.Active = true;
v.Connect();
Variable fileName = new Variable(m_Cpu, "fileName");
fileName.Error += new PviEventHandler(v_Error);
fileName.Active = true;
fileName.Connect();
fileName.ValueChanged += new VariableEventHandler(fileName_ValueChanged);
Variable getProduction = new Variable(m_Cpu, "btnGetProductionData");
getProduction.Error += new PviEventHandler(v_Error);
getProduction.Active = true;
getProduction.Connect();
getProduction.ValueChanged += new VariableEventHandler(getProduction_ValueChanged);
Variable rpFileName = new Variable(m_Cpu, "runningPart.fileName");
rpFileName.Error += new PviEventHandler(v_Error);
rpFileName.Active = true;
rpFileName.Connect();
OpenTemplate(TemplatePath);
m_VariableCollections = RecipeData.CreateVariableList(m_Templates.TemplateList);
CreateReceiveVariables(m_VariableCollections.ReceiveCollection);
CreateSendVariables(m_VariableCollections.SendCollection);
}
catch (System.Exception ex)
{
Log.LogError("", ex);
}
}