Exemplo n.º 1
0
 /// <summary>
 /// 删除一个代码块
 /// </summary>
 /// <param name="stackItemBox"></param>
 public void Del(ItemBox stackItemBox)
 {
     if (Children.Contains(stackItemBox))
     {
         Children.Remove(stackItemBox);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 在加载后设置属性的值
 /// </summary>
 /// <param name="itemBox"></param>
 private void setWhereLoadProperty(ItemBox itemBox)
 {
     foreach (ParatItem item in itemBox.GetInputParatItems())
     {
         if (item.LinkipropertyId.Equals("") == false)
         {
             item.LinkIProperty = FindIPropertyById(item.LinkipropertyId);
         }
     }
     foreach (ParatItem item in itemBox.GetOutputParatItems())
     {
         if (item.LinkipropertyId.Equals("") == false)
         {
             item.LinkIProperty = FindIPropertyById(item.LinkipropertyId);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 在加载后调整itemboxs的关系
        /// </summary>
        /// <param name="itemBox"></param>
        private void setWhereLoadItemboxs(ItemBox itemBox)
        {
            setWhereLoadProperty(itemBox);

            if (itemBox.Children.Count > 0)
            {
                foreach (var item in itemBox.Children)
                {
                    if (item.ParentId != itemBox.Id)
                    {
                        throw new Exception("节点错误");
                    }
                    item.ParentNode = itemBox;
                    setWhereLoadItemboxs(item);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 克隆一份
        /// </summary>
        /// <returns></returns>
        public virtual IItemBox Clone()
        {
            //ItemBox ib = new ItemBox();
            ItemBox ib = (ItemBox)Activator.CreateInstance(GetType());

            ib.name    = name;
            ib.tipText = tipText;
            ib.BoxType = BoxType;
            foreach (var item in inputDatas)
            {
                ib.AddInput(item.Clone());
            }
            foreach (var item in outputDatas)
            {
                ib.AddOutput(item.Clone());
            }
            return(ib);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 添加一个子元素
 /// </summary>
 /// <param name="stackItemBox"></param>
 public void Add(ItemBox stackItemBox, int index)
 {
     Children.Insert(index, stackItemBox);
     stackItemBox.ParentNode = this;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 添加一个子元素
 /// </summary>
 /// <param name="stackItemBox"></param>
 public void Add(ItemBox stackItemBox)
 {
     Children.Add(stackItemBox);
     stackItemBox.ParentNode = this;
 }
Exemplo n.º 7
0
        /// <summary>
        /// 添加系统的代码块
        /// </summary>
        public static TreeData AddSystemBox()
        {
            TreeData system    = new TreeData("系统");
            ItemBox  ifitembox = new ItemBox()
            {
                BoxType = ItemBoxEnum.IF,
                Name    = "分支",
                TipText = "分支",
            };

            ifitembox.AddInput(new ParatItem()
            {
                Name = "判断的值", PIEnum = ParaItemEnum.BOOL, TipText = "决定分支的走向"
            });
            //ifitembox.Add(new StackItemBox() { Name = "True", BoxType = ItemBoxEnum.ELSE });
            //ifitembox.Add(new StackItemBox() { Name = "False", BoxType = ItemBoxEnum.ELSE });

            ItemBox whileidx = new ItemBox()
            {
                BoxType = ItemBoxEnum.WHILE,
                Name    = "循环(由起始和结束值决定次数)",
                TipText = "循环",
            };

            whileidx.AddInput(new ParatItem()
            {
                Name    = "起始值",
                PIEnum  = ParaItemEnum.INT,
                TipText = "起始值",
                Value   = 0,
            });
            whileidx.AddInput(new ParatItem()
            {
                Name    = "终止值",
                PIEnum  = ParaItemEnum.INT,
                TipText = "终止值",
                Value   = 10,
            });

            whileidx.AddOutput(new ParatItem()
            {
                Name    = "迭代值",
                PIEnum  = ParaItemEnum.INT,
                TipText = "迭代值"
            });

            ItemBox whilebool = new ItemBox()
            {
                BoxType = ItemBoxEnum.WHILE,
                Name    = "循环(由bool参数决定次数)",
                TipText = "循环",
            };

            whilebool.AddInput(new ParatItem()
            {
                Name = "判断的值", PIEnum = ParaItemEnum.BOOL, TipText = "如果是true则继续循环,否则调出循环", Value = true,
            });

            ItemBox whiletime = new ItemBox()
            {
                BoxType = ItemBoxEnum.WHILE,
                Name    = "循环(由时间参数决定次数)",
                TipText = "循环",
            };

            whiletime.AddInput(new ParatItem()
            {
                Name = "结束时间", PIEnum = ParaItemEnum.DATETIME, TipText = "如果当前事件超过设定的时间则跳出循环", Value = DateTime.Now,
            });


            ifitembox.LogoPath = ScriptHelp.BrachImage;
            whileidx.LogoPath  = ScriptHelp.WhileImage;
            whilebool.LogoPath = ScriptHelp.WhileImage;
            whiletime.LogoPath = ScriptHelp.WhileImage;
            system.Children.Add(new TreeData(ifitembox));
            system.Children.Add(new TreeData(whileidx));
            system.Children.Add(new TreeData(whilebool));
            system.Children.Add(new TreeData(whiletime));
            return(system);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 添加代码块
 /// </summary>
 /// <param name="itembox"></param>
 public virtual void Add(ItemBox itembox)
 {
     this.Itemboxs.Add(itembox);
 }