public static void CreateTool(int settingKey, ToolReflection toolReflection)
        {
            object[] parameters = new object[1];
            parameters[0] = settingKey;
            ToolBase tool = CreateInstance <ToolBase>(toolReflection, parameters);

            if (tool == null)
            {
                throw new Exception("工具创建失败");  //整个程序中断,也用不着return.
            }

            int index = 0;
            int name  = 1;
            //GetToolList(settingKey);  //当ToolsDic.ContainsKey(settingKey)为false时,下面的GetToolList(settingKey)已经生成,本处没有任何意义。
            string nameTmp = "";/* = string.Format("C{0}{1:00}", settingKey, name)*/

            //index = GetToolList(settingKey).FindIndex(x => x.Name == nameTmp);
            while (index != -1)
            {
                nameTmp = string.Format("C{0}{1:00}", settingKey, name);
                index   = GetToolList(settingKey).FindIndex(x => x.Name == nameTmp); //如果这时GetToolList(settingKey)元素为空,则index = -1;
                name++;
            }
            tool.SetToolName(nameTmp);      //把工具名字赋给相应工具。
            if (tool != null)
            {
                GetToolList(settingKey).Add(tool);
            }
        }
        public static ToolBase GetTool(string toolName)
        {
            try
            {
                int             settingKey = int.Parse(toolName.Substring(1, 1));//C101,先找出在哪个工具组。
                List <ToolBase> toolList   = GetToolList(settingKey);

                ToolBase tool = toolList.Find(x => x.Name == toolName.ToUpper());
                return(tool);
            }
            catch (Exception)
            {
                return(null);
            }
        }
 //工具名称显示
 public void Init(string name, ToolBase tool)
 {
     lblCommToolsName.Text = name + ":";
     this.tool             = tool;
     txtCommMin.Text       = tool.Min.ToString();
     txtCommMax.Text       = tool.Max.ToString();
     //工具名称
     txtCommNote.Text = tool.Note;
     //是否输出结果
     chkIsOutputResults.Checked = tool.IsOutputResults;
     //图像工具不显示图像源
     if (tool is CreateImage.CreateImageTool)
     {
         cmbImageSoure.Visible       = false;
         labelCommImageSoure.Visible = false;
         txtCommNote.Enabled         = false;
     }
     else
     {
         //显示图像源
         List <ToolBase> tools = ToolsFactory.GetToolList(tool.SettingIndex);
         cmbImageSoure.Items.Clear();
         foreach (ToolBase item in tools)
         {
             if (item == this.tool)
             {
                 break;
             }
             if (item is ICreateImage)
             {
                 cmbImageSoure.Items.Add(item.Name);
             }
         }
         cmbImageSoure.Text = tool.ImageSoureToolName;
     }
     if (tool.IsSubTool)
     {
         groupBoxCommSetting.Visible = false;
     }
     txtCommNote.ReadOnly = true;
 }
 public SettingThread(ToolBase tool)
 {
     this.tool = tool;
 }
 public Mat2DManger(ToolBase tool)
 {
     this.tool         = tool;
     this.settingIndex = tool.SettingIndex;
     this.toolName     = tool.Name;
 }