Пример #1
0
        private static void LoadVariable(TodoEngine engine, XmlNode node, List <TodoPreset> varnames)
        {
            TodoPreset preset = new TodoPreset();

            foreach (XmlNode child in node.ChildNodes)
            {
                if (child.Name == "Name")
                {
                    preset.Name = child.InnerText;
                }
                if (child.Name == "Category")
                {
                    preset.Category = child.InnerText;
                }
                if (child.Name == "Value")
                {
                    preset.Value = double.Parse(child.InnerText);
                }
            }

            TodoVariable var = engine.GetVariableByName(preset.Name);

            if (var != null)
            {
                var.SetValue(null, preset.Value);
                varnames.Add(preset);
            }
        }
Пример #2
0
        public TodoHdeEnumVariable(INode2 node, TodoEngine engine, string varname)
        {
            this.node = node;
            //this.var = var;

            this.valuepin = this.node.FindPin("Input Enum");

            enumname = this.valuepin.SubType.Split(",".ToCharArray())[1].Trim();

            int ecnt = EnumManager.GetEnumEntryCount(enumname);

            for (int i = 0; i < ecnt; i++)
            {
                string eval = EnumManager.GetEnumEntryString(enumname, i);
                string vn   = varname + "-" + eval;

                TodoVariable var = engine.GetVariableByName(vn);
                if (var == null)
                {
                    var          = new TodoVariable(vn);
                    var.Category = "Global";
                    engine.RegisterVariable(var, false);
                }

                var.ValueChanged += var_ValueChanged;
                vars.Add(var);
            }
            //this.valuepin.
            //this.valuepin.Type

            //var.ValueChanged += var_ValueChanged;
            //var.VariableUpdated += var_VariableUpdated;
        }
Пример #3
0
        public TodoHdeVariable(INode2 node, TodoEngine engine, string varname)
        {
            this.node = node;

            this.valuepin = this.node.FindPin("Y Input Value");
            if (this.valuepin.SliceCount == 1)
            {
                TodoVariable var = engine.GetVariableByName(varname);
                if (var == null)
                {
                    var          = new TodoVariable(varname);
                    var.Category = "Global";
                    engine.RegisterVariable(var, false);
                }

                var.ValueChanged    += var_ValueChanged;
                var.VariableUpdated += var_VariableUpdated;

                this.vars.Add(var);
            }
            else if (this.valuepin.SliceCount > 1)
            {
                for (int i = 0; i < this.valuepin.SliceCount; i++)
                {
                    string vn = varname + "-" + i.ToString();

                    TodoVariable var = engine.GetVariableByName(vn);
                    if (var == null)
                    {
                        var          = new TodoVariable(vn);
                        var.Category = "Global";
                        engine.RegisterVariable(var, false);
                    }

                    var.ValueChanged    += var_ValueChanged;
                    var.VariableUpdated += var_VariableUpdated;

                    this.vars.Add(var);
                }
            }

            this.minpin = this.node.FindPin("Minimum");
            this.maxpin = this.node.FindPin("Maximum");

            this.minpin.Changed += minpin_Changed;
            this.maxpin.Changed += maxpin_Changed;
        }