Exemplo n.º 1
0
        /// <summary>
        /// 向流程中添加工具,需要根据选择的工具名对工具类型等进行判断
        /// </summary>
        /// <param name="tool">工具类型</param>
        /// <param name="isInsert">插入位置,当为-1时,表示在末尾插入,当不为-1时,表示被插入的工具索引</param>
        public void Add_Tool(ToolType tool, int insertPos = -1, int imageKey = 0)
        {
            string    toolName   = GetNewToolName(tool.ToString());
            IToolInfo insertTool = VisionToolFactory.CreateToolVision(tool, toolName);
            TreeNode  insertNode = new TreeNode();

            insertNode = VisionJobParams.myJobTreeView.Nodes.Add("", insertTool.toolName, (int)tool, (int)tool); // 该工具对应的节点

            // 判断节点是否添加默认输入输出图
            // 输入
            for (int i = 0; i < insertTool.toolInput.Count; i++)
            {
                TreeNode childrenInputNode = insertNode.Nodes.Add("<--" + insertTool.toolInput[i].IOName);
                childrenInputNode.Tag       = insertTool.toolInput[i].ioType;
                childrenInputNode.ForeColor = Color.DarkMagenta;
            }
            // 输出
            for (int i = 0; i < insertTool.toolOutput.Count; i++)
            {
                TreeNode childrenOutputNode = insertNode.Nodes.Add("-->" + insertTool.toolOutput[i].IOName);
                childrenOutputNode.Tag       = insertTool.toolOutput[i].ioType;
                childrenOutputNode.ForeColor = Color.Blue;
            }
            insertNode.Expand();
            VisionJobParams.myVisionJob.L_toolList.Add(insertTool);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 向流程中添加工具,需要根据选择的工具名对工具类型等进行判断
        /// </summary>
        /// <param name="tool">工具类型</param>
        /// <param name="isInsert">插入位置,当为-1时,表示在末尾插入,当不为-1时,表示被插入的工具索引</param>
        public void Add_Tool(ToolType tool, bool newAddTool = true, int insertPos = -1, int imageKey = 0)
        {
            string jobName  = FormJobManage.Instance.tabJobUnion.SelectedTab.Text;
            string toolName = GetNewToolName(jobName, tool.ToString());

            IToolInfo insertTool = VisionToolFactory.CreateToolVision(tool, toolName);
            TreeNode  insertNode = new TreeNode();

            insertNode = GetJobTree(jobName).Nodes.Add("", insertTool.toolName, (int)tool, (int)tool); // 该工具对应的节点

            // 判断节点是否添加默认输入输出图
            // 输入
            for (int i = 0; i < insertTool.toolInput.Count; i++)
            {
                TreeNode childrenInputNode = insertNode.Nodes.Add("<--" + insertTool.toolInput[i].IOName);
                childrenInputNode.Tag       = insertTool.toolInput[i].ioType;
                childrenInputNode.ForeColor = Color.DarkMagenta;
            }
            // 输出
            for (int i = 0; i < insertTool.toolOutput.Count; i++)
            {
                TreeNode childrenOutputNode = insertNode.Nodes.Add("-->" + insertTool.toolOutput[i].IOName);
                childrenOutputNode.Tag       = insertTool.toolOutput[i].ioType;
                childrenOutputNode.ForeColor = Color.Blue;
            }
            insertNode.Expand();
            if (newAddTool)
            {
                VisionJobParams.pVisionProject.Project[jobName].L_toolList.Add(insertTool);
            }
        }
Exemplo n.º 3
0
 private void tvw_ToolBox_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.Level == 0)
     {
         this.richTextBoxEx1.Text = e.Node.Text;
     }
     else if (e.Node.Level == 1)
     {
         object selectTag = tvw_ToolBox.SelectedNode.Tag;
         if (selectTag != null)
         {
             IToolInfo insertTool = VisionToolFactory.CreateToolVision((ToolType)Enum.Parse(typeof(ToolType), selectTag.ToString()));
             this.richTextBoxEx1.Text = insertTool.toolDescription;
         }
         else
         {
             this.richTextBoxEx1.Text = "此工具尚未开发";
         }
     }
 }