private void btnNext_Click(object sender, EventArgs e) { if (Index != 7) { Index++; helper.AlignmentInfo(index, index < 0); if (Index == -1) { //开启红光引导光 //先检查红光是否开启,若已经开启,则不用再开启 if (Program.SysConfig.LiveMode) { CheckandEnableLaserStatus(); } this.btnNext.Text = Res.LaserAlignment.StrAlignLaser; } else if (Index == 7) { this.btnNext.Text = Res.LaserAlignment.StrSave; if (Program.SysConfig.LiveMode) { //计算平均转换矩阵 Coordinate.GetCoordinate().CalculateOtherMatix(); Coordinate.GetCoordinate().GetFinalMatrix(); var v = Program.SysConfig.LaserConfig.FinalMatrix; Console.WriteLine(" final matrix: " + v.ToString()); Console.WriteLine(" final matrix Rank: " + v.Rank()); string matrixJsonString = JsonFile.GetJsonTextFromConfig <Matrix <double> >(v); JsonFile.WriteMatrixConfigToLocal(matrixJsonString); //关闭红光引导光 EnableRedLaser(false); } } else { this.btnNext.Text = Res.LaserAlignment.StrNext; } if (Index > -1 && Index < 7) { if (Index >= 3 && Index <= 6) { if (Program.SysConfig.LiveMode) { if (Index == 3) { Coordinate.GetCoordinate().CalculateFirstMatrix(); var v = Coordinate.GetCoordinate().FistMatrix; Console.WriteLine(" first matrix: " + v.ToString()); Console.WriteLine(" first matrix Rank: " + v.Rank()); } Coordinate.GetCoordinate().CreatePresetMotorPoint(Index, this.RichPictureBox); } } if (Program.SysConfig.LiveMode) { SendAlignmentMotorPoint(); } AlignLaser laser = Program.EntryForm.Laser as AlignLaser; if (laser != null) { laser.Index = Index; } //this.pictureBox.ZoomFit(); } } else { this.Visible = false; this.Enabled = false; this.btnNext.Text = Res.LaserAlignment.StrNext; this.RichPictureBox.ZoomFit(); if (Index == -2) { this.richPictureBox.RestrictArea.TransformMotorOriginalPoints(); } ToastNotification.Instance().ShowToast(Properties.Resources.StrCalibrationSuccess, global::CII.LAR.Properties.Resources.warn); Program.EntryForm.HolesNumberSlider(Program.EntryForm.LaserType == LaserType.SaturnActive); } }