Exemplo n.º 1
0
        public ProjectPara(ProjectModelEnum ProjectModel)
        {
            ProjectVisionNames = new List <ProjectVisionEnum>();
            VisionParas        = new List <VisionPara>();
            ProjectName        = ProjectEnum.PinLocal0;
            ProjectVisionNames.Add(ProjectVisionEnum.ProjectVision0);
            VisionParas.Add(new VisionPara());
            switch (ProjectModel)
            {
            case ProjectModelEnum.SingleCamLocal:
                ProjectName = ProjectEnum.PinLocal0;
                break;

            case ProjectModelEnum.TwoCamLocal:
                ProjectVisionNames.Add(ProjectVisionEnum.ProjectVision0);
                VisionParas.Add(new VisionPara());
                ProjectName = ProjectEnum.FofOffSet;
                break;
            }
        }
Exemplo n.º 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();
            }
        }