Exemple #1
0
 private void FrmVisionProjectPara_Load(object sender, EventArgs e)
 {
     this.ProjectModelCbxCol.Items.Clear();
     foreach (ProjectModelEnum item in Enum.GetValues(typeof(ProjectModelEnum)))
     {
         this.ProjectModelCbxCol.Items.Add(item);
     }
     this.ProjectModelCbxCol.ValueType = typeof(ProjectModelEnum);
     //this.ProjectModelCbxCol.DataPropertyName = "EventSeverity";
     this.ProjectVisionEnumCbx.Items.Clear();
     foreach (ProjectVisionEnum temp in Enum.GetValues(typeof(ProjectVisionEnum)))
     {
         this.ProjectVisionEnumCbx.Items.Add(temp);
     }
     this.ProjectVisionEnumCbx.ValueType = typeof(ProjectVisionEnum);
     //this.ProjectVisionEnumCbx.DataPropertyName = "EventSeverity";
     this.CaliMatCbx.Items.Clear();
     foreach (var temp in Enum.GetValues(typeof(CoordiCamHandEyeMatEnum)))
     {
         this.CaliMatCbx.Items.Add(temp);
     }
     this.CaliMatCbx.ValueType = typeof(CoordiCamHandEyeMatEnum);
     //this.CaliMatCbx.DataPropertyName = "EventSeverity";
     this.LoclalModelCbxCol.Items.Clear();
     foreach (LocalModelEnum item in Enum.GetValues(typeof(LocalModelEnum)))
     {
         this.LoclalModelCbxCol.Items.Add(item);
     }
     this.LoclalModelCbxCol.ValueType = typeof(LocalModelEnum);
     //this.LocalNoTbXCol.ValueType = typeof(LocalModelEnum);
     //this.LocalNoTbXCol.DataPropertyName = "EventSeverity";
     UpDataProjectDgv();
     TeachProjectPara = ProjectParaManager.Instance.ProjectParaList[TeachProjectItem];
     TeachProjectMsg  = ProjectParaManager.Instance.ProjectMsgList[TeachProjectItem];
     UpDataVisionLocalParaDgv();
 }
Exemple #2
0
        private void ProjectDgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= ProjectParaManager.Instance.ProjectMsgList.Count())
            {
                return;
            }
            if (ProjectParaManager.Instance.ProjectMsgList == null)
            {
                return;
            }
            if (ProjectParaManager.Instance.ProjectMsgList.Count() == 0)
            {
                return;
            }

            if (e.ColumnIndex == 2)//视觉项目类型
            {
                ProjectParaManager.Instance.ProjectMsgList[e.RowIndex].ProjectModel = (ProjectModelEnum)ProjectDgv.Rows[e.RowIndex].Cells[2].Value;
            }
            if (e.ColumnIndex == 3) //参数清除
            {
                DialogResult Rlt = MessageBox.Show("是否清除参数", "工程参数清除", MessageBoxButtons.YesNo);
                if (Rlt == DialogResult.No)
                {
                    return;
                }
                ProjectModelEnum obj0 = (ProjectModelEnum)ProjectDgv.Rows[e.RowIndex].Cells[e.ColumnIndex - 1].Value;
                if (Rlt == DialogResult.Yes)
                {
                    if (e.RowIndex < ProjectParaManager.Instance.ProjectMsgList.Count())
                    {
                        ProjectParaManager.Instance.ProjectParaList[e.RowIndex] = new ProjectPara(obj0);
                    }
                    else
                    {
                        ProjectParaManager.Instance.ProjectParaList.Add(new ProjectPara(obj0));
                    }
                }
            }
            if (e.ColumnIndex == 4)//工程参数示教
            {
                if (ProjectParaManager.Instance.ProjectParaList.Count == 0)
                {
                    return;
                }
                if (ProjectParaManager.Instance.ProjectParaList.Count > e.RowIndex)
                {
                    TeachProjectPara = ProjectParaManager.Instance.ProjectParaList[e.RowIndex];
                    UpDataVisionLocalParaDgv();
                }
            }
            if (e.ColumnIndex == 5)//参数保存
            {
                DialogResult Rlt = MessageBox.Show("是否保存参数", "工程参数保存", MessageBoxButtons.YesNo);
                if (Rlt == DialogResult.No)
                {
                    return;
                }
                ProjectParaManager.Instance.ProjectMsgList[e.RowIndex].ProjectDescribe = ProjectDgv.Rows[e.RowIndex].Cells[1].Value.ToString();
                ProjectParaManager.Instance.Save();
            }
            if (e.ColumnIndex == 6)//参数删除
            {
                ProjectParaManager.Instance.ProjectParaList.RemoveAt(e.RowIndex);
                ProjectParaManager.Instance.ProjectMsgList.RemoveAt(e.RowIndex);
                UpDataProjectDgv();
            }
            TeachProjectItem = e.RowIndex;
            if (e.RowIndex < ProjectParaManager.Instance.ProjectParaList.Count)
            {
                TeachProjectMsg  = ProjectParaManager.Instance.ProjectMsgList[e.RowIndex];
                TeachProjectPara = ProjectParaManager.Instance.ProjectParaList[e.RowIndex];
                UpDataVisionLocalParaDgv();
            }
        }