当前位置: 首页>>代码示例>>C#>>正文


C# Variable.Connect方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:PosauneMaster,项目名称:RecipeMaster_v3,代码行数:28,代码来源:Machine.cs

示例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)
            {

            }
        }
开发者ID:PosauneMaster,项目名称:RecipeMaster_v3,代码行数:21,代码来源:Machine.cs

示例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);
            }
        }
开发者ID:PosauneMaster,项目名称:RecipeMaster_v3,代码行数:51,代码来源:Machine.cs


注:本文中的Variable.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。