예제 #1
0
        private void bNewProgram_Click(object sender, EventArgs e)
        {
            CreateProgramCtrl ctrl = new CreateProgramCtrl();

            ctrl.ShowDialog();
            if (ctrl.DialogResult == DialogResult.OK)
            {
                string module = CommonHelper.GetEnumDescription(typeof(Module), ctrl.Module);
                if (ProgramFlow.Exist(ctrl.Module, ctrl.ProductName))
                {
                    MessageBox.Show($"{module}:贴附信息[{ctrl.ProgramName}]已存在!!");
                    return;
                }
                else if (ctrl.ProgramName == string.Empty)
                {
                    MessageBox.Show("请正确输入程序名!!!");
                    return;
                }

                this.lModule.Text        = module;
                this.lProgram.Text       = ctrl.ProgramName;
                this.Flow                = new ProgramFlow(ctrl.ProgramName);
                this.Flow.Module         = ctrl.Module;
                this.Module              = ctrl.Module;
                this.programTree.Enabled = true;
                this.RefreshTree();
            }
        }
예제 #2
0
        private void bLoadProgram_Click(object sender, EventArgs e)
        {
            CreateProgramCtrl fm = new CreateProgramCtrl(false);

            if (fm.ShowDialog() == DialogResult.OK)
            {
                string module = CommonHelper.GetEnumDescription(typeof(Module), fm.Module);

                this.Flow = ProgramFlow.Load($"{PathDefine.sPathProgram}{module}//{fm.ProgramName}.json");

                this.lModule.Text  = module;
                this.lProgram.Text = fm.ProgramName;
                if (this.Flow != null)
                {
                    if (this.Flow.NzUsed.Count > 0 && this.Flow.NzOffset.Count > 0)
                    {
                        this.bUsedNz1.Checked = this.Flow.NzUsed[Nozzle.Nz1];
                        this.bUsedNz2.Checked = this.Flow.NzUsed[Nozzle.Nz2];
                        this.bUsedNz3.Checked = this.Flow.NzUsed[Nozzle.Nz3];
                        this.bUsedNz4.Checked = this.Flow.NzUsed[Nozzle.Nz4];
                        this.nz1OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz1].X;
                        this.nz1OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz1].Y;
                        this.nz2OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz2].X;
                        this.nz2OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz2].Y;
                        this.nz3OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz3].X;
                        this.nz3OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz3].Y;
                        this.nz4OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz4].X;
                        this.nz4OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz4].Y;
                    }

                    this.SetTree(null, this.Flow.PCB);
                    this.Module = this.Flow.Module;
                    this.programTree.ExpandAll();
                    this.programTree.Enabled = true;
                }
                else
                {
                    this.programTree.Enabled = false;
                }
            }
        }