Example #1
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     if (Index != 7)
     {
         Index++;
         helper.AlignmentInfo(index, index < 0);
         if (Index == -1)
         {
             this.btnNext.Text = Res.LaserAlignment.StrAlignLaser;
         }
         else if (Index == 7)
         {
             this.btnNext.Text = Res.LaserAlignment.StrSave;
         }
         else
         {
             this.btnNext.Text = Res.LaserAlignment.StrNext;
         }
         if (Index > -1 && Index < 7)
         {
             AlignLaser laser = this.pictureBox.Laser as AlignLaser;
             if (laser != null)
             {
                 laser.Index = Index;
             }
             //this.pictureBox.ZoomFit();
         }
     }
     else
     {
         this.Visible = false;
         this.Enabled = false;
         this.pictureBox.ZoomFit();
     }
 }
Example #2
0
        private void LaserAlignment_VisibleChanged(object sender, EventArgs e)
        {
            Index = -2;
            if (this.Visible)
            {
                AlignLaser laser = Program.EntryForm.Laser as AlignLaser;
                if (laser != null)
                {
                    laser.IsAlign = this.Visible;
                }
                ButtonBack(true);
                ButtonNext(true);
                this.btnNext.Text           = Res.LaserAlignment.StrNext;
                Program.EntryForm.LaserType = LaserType.Alignment;
            }
            else
            {
                Program.EntryForm.LaserType = LaserType.SaturnFixed;
                //关闭红光
                //EnableRedLaser(false);
                CheckLaserStatus();

                if (this.RichPictureBox.Zoom != 1)
                {
                    this.RichPictureBox.ZoomFit();
                }
            }
            Program.SysConfig.LaserConfig.IsAlignment = this.Visible;
        }
Example #3
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (Index != -2)
     {
         ButtonNext(true);
         Index--;
         helper.AlignmentInfo(index, index < 0);
         if (Index == -1)
         {
             this.btnNext.Text = Res.LaserAlignment.StrAlignLaser;
         }
         else
         {
             this.btnNext.Text = Res.LaserAlignment.StrNext;
         }
         if (Index > -1 && Index < 7)
         {
             AlignLaser laser = Program.EntryForm.Laser as AlignLaser;
             if (laser != null)
             {
                 laser.Index = Index;
             }
         }
     }
     else
     {
         this.Visible = false;
         this.Enabled = false;
         Program.EntryForm.ShowBaseCtrl(true, CtrlType.LaserCtrl);
     }
 }
Example #4
0
 public LaserFactory(ZWPictureBox picturebox)
 {
     this.picturebox                = picturebox;
     this.fixedLaser                = new FixedLaser(picturebox);
     this.activeLaser               = new ActiveLaser(picturebox);
     this.alignLaser                = new AlignLaser(picturebox);
     alignLaser.ZoomHandler        += picturebox.ZoomHandler;
     alignLaser.ButtonStateHandler += picturebox.ButtonStateHandler;
 }
Example #5
0
 public LaserFactory(RichPictureBox richPictureBox)
 {
     this.richPictureBox            = richPictureBox;
     this.fixedLaser                = new FixedLaser(richPictureBox);
     this.activeLaser               = new ActiveLaser(richPictureBox);
     this.alignLaser                = new AlignLaser(richPictureBox);
     this.alignLaser.ZoomHandler   += richPictureBox.ZoomHandler;
     alignLaser.ButtonStateHandler += Program.EntryForm.ButtonStateHandler;
 }
Example #6
0
 private void LaserAlignment_VisibleChanged(object sender, EventArgs e)
 {
     Index = -2;
     if (this.Visible)
     {
         AlignLaser laser = this.pictureBox.Laser as AlignLaser;
         if (laser != null)
         {
             laser.IsAlign = this.Visible;
         }
         ButtonBack(true);
         ButtonNext(true);
         Program.ExpManager.LaserType = ExpClass.LaserType.Alignment;
     }
     else
     {
         Program.ExpManager.LaserType = ExpClass.LaserType.SaturnFixed;
     }
 }
Example #7
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (Index != -2)
     {
         Index--;
         helper.AlignmentInfo(index, index < 0);
         if (Index > -1 && Index < 7)
         {
             AlignLaser laser = this.pictureBox.Laser as AlignLaser;
             if (laser != null)
             {
                 laser.Index = Index;
             }
         }
     }
     else
     {
         this.Visible = false;
         this.Enabled = false;
         this.pictureBox.ShowBaseCtrl(true, 0);
     }
 }
Example #8
0
 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);
     }
 }