Пример #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string patternName = tbPatternName.Text.Trim();

            if (!tbOriginX.IsValid || !tbOriginY.IsValid)
            {
                //MessageBox.Show("Please input valid origin values.");
                MessageBox.Show("请输入正确的原点坐标.");
                return;
            }

            if (pattern is Workpiece)
            {
                Workpiece w = pattern as Workpiece;
                w.OriginPos.X = tbOriginX.Value;
                w.OriginPos.Y = tbOriginY.Value;
                FluidProgram.Current.GetWorkPieceCmdLine().Origin.X = tbOriginX.Value;
                FluidProgram.Current.GetWorkPieceCmdLine().Origin.Y = tbOriginY.Value;
                CompareObj.CompareField(w.OriginPos, workPieceOrgBackUp, null, this.GetType().Name, true);
            }
            else
            {
                //机械坐标->系统坐标
                PointD p = this.workpiece.SystemRel(tbOriginX.Value, tbOriginY.Value);
                pattern.Origin.X = p.X;
                pattern.Origin.Y = p.Y;
                CompareObj.CompareField(p, patternOrgBackUp, null, this.GetType().Name, true);
            }

            MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_PATTREN_ORIGIN, null, null);

            DialogResult = DialogResult.OK;
            Close();
        }
Пример #2
0
 private void SettingSensorsForm_OnSaveClicked()
 {
     MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this, null);
     SensorMgr.Instance.Save();
     this.Close();
     CompareObj.CompareProperty(this.currEasySerialPort, this.currEasySerialPortBackUp, null, this.GetType().Name, true);
 }
Пример #3
0
 private void CbxChn2_SelectedIndexChanged(object sender, EventArgs e)
 {
     SensorMgr.Instance.Proportioners.Channel2 = (int)cbxChn2.SelectedItem;
     MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this, null);
     SensorMgr.Instance.Save();
     CompareObj.CompareProperty(SensorMgr.Instance.Proportioners, this.settingBackUp, true);
 }
Пример #4
0
        private CompareObj median3(CompareObj[] input, int left, int right)
        {
            CompareObj tmp;
            int center = (left + right) / 2;

            // left <= center <= right
            if (input[left].Compare(input[center])>0)
            {
                //swap without tmp
                tmp = input[left];
                input[left] = input[center];
                input[center] = tmp;
            }
            if (input[left].Compare(input[right])>0)
            {
                tmp = input[left];
                input[left] = input[right];
                input[right] = tmp;
            }
            if (input[center].Compare(input[right])>0)
            {
                tmp = input[center];
                input[center] = input[right];
                input[right] = tmp;
            }

            // hide pivot
            tmp = input[center];
            input[center] = input[right - 1];
            input[right - 1] = tmp;

            return input[right - 1];
        }
Пример #5
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (comboBoxSysPositions.SelectedItem == null)
            {
                //MessageBox.Show("System position is not selected.");
                MetroSetMessageBox.Show(this, "请选择坐标点位.");
                return;
            }
            UserPosition up = comboBoxSysPositions.SelectedItem as UserPosition;

            moveToLocationCmdLine.PositionName = up.Name;
            moveToLocationCmdLine.MoveType     = up.MoveType;
            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, moveToLocationCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, moveToLocationCmdLine);
            }
            if (!this.isCreating)
            {
                if (this.moveToLocationCmdLine != null && this.moveToLocationCmdLineBackUp != null)
                {
                    CompareObj.CompareField(this.moveToLocationCmdLine, this.moveToLocationCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Пример #6
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!tbStart.IsValid || !tbEnd.IsValid)
     {
         //MessageBox.Show("Please input valid values.");
         MetroSetMessageBox.Show(this, "请输入正确的值");
         return;
     }
     if (tbStart.Value > tbEnd.Value)
     {
         //MessageBox.Show("Start value can not be bigger than end value.");
         MetroSetMessageBox.Show(this, "起始点不可以大于结束点.");
         return;
     }
     loopPassCmdLine.Start = tbStart.Value;
     loopPassCmdLine.End   = tbEnd.Value;
     if (isCreating)
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, loopPassCmdLine, new NextLoopCmdLine());
     }
     else
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, loopPassCmdLine);
     }
     if (!this.isCreating)
     {
         if (this.loopPassCmdLine != null && this.loopPassCmdLineBackUp != null)
         {
             CompareObj.CompareField(this.loopPassCmdLine, this.loopPassCmdLineBackUp, null, this.GetType().Name, true);
         }
     }
 }
Пример #7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!tbX.IsValid || !tbY.IsValid)
            {
                //MessageBox.Show("Please input valid values.");
                MessageBox.Show("请输入正确的值.");
                return;
            }
            PointD laserMap = this.pattern.SystemRel(tbX.Value, tbY.Value);

            measureHeightCmdLine.Position.X   = laserMap.X;
            measureHeightCmdLine.Position.Y   = laserMap.Y;
            measureHeightCmdLine.StandardHt   = this.heightControl1.BoardHeight;
            measureHeightCmdLine.ToleranceMax = this.heightControl1.MaxTolerance;
            measureHeightCmdLine.ToleranceMin = this.heightControl1.MinTolerance;
            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, measureHeightCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, measureHeightCmdLine);
            }
            Properties.Settings.Default.laserX = measureHeightCmdLine.Position.X;
            Properties.Settings.Default.laserY = measureHeightCmdLine.Position.Y;
            if (!this.isCreating)
            {
                Close();
                if (this.measureHeightCmdLine != null && this.measureHeightCmdLineBackUp != null)
                {
                    CompareObj.CompareProperty(this.measureHeightCmdLine, this.measureHeightCmdLineBackUp, null, this.GetType().Name, true);
                    CompareObj.CompareField(this.measureHeightCmdLine, this.measureHeightCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Пример #8
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!tbZ.IsValid)
     {
         //MessageBox.Show("Please input a double number for z.");
         MetroSetMessageBox.Show(this, "请输入小数.");
         return;
     }
     moveAbsZCmdLine.Z = tbZ.Value;
     if (isCreating)
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, moveAbsZCmdLine);
     }
     else
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, moveAbsZCmdLine);
     }
     if (!this.isCreating)
     {
         if (this.moveAbsZCmdLine != null && this.moveAbsZCmdLineBackUp != null)
         {
             CompareObj.CompareField(this.moveAbsZCmdLine, this.moveAbsZCmdLineBackUp, null, this.GetType().Name, true);
         }
     }
 }
Пример #9
0
 public void qSort(CompareObj <T> fun)
 {
     if (this.Count > 0)
     {
         qSort(0, this.Count - 1, fun);
     }
 }
Пример #10
0
        private void BtnTeachLoc_Click(object sender, EventArgs e)
        {
            if (this.selectedLoc == null)
            {
                return;
            }
            if (this.selectedLoc.IsSystemLoc)
            {
                return;
            }
            if (this.rdoTeachXY.Checked)
            {
                this.selectedLoc.X = Machine.Instance.Robot.PosX;
                this.selectedLoc.Y = Machine.Instance.Robot.PosY;
            }
            if (this.rdoTeachZ.Checked)
            {
                this.selectedLoc.Z = Machine.Instance.Robot.PosZ;
            }

            LocationMgr.Instance.Save();

            this.UpdateSelectedLocText();
            if (this.selectedLoc != null && this.selectedLocBackUp != null)
            {
                CompareObj.CompareProperty(this.selectedLoc, this.selectedLocBackUp, null, this.GetType().Name);
            }
        }
Пример #11
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            string tag = this.GetType().Name;

            if (this.valve.ValveSeries == ValveSeries.喷射阀)
            {
                JtValve jtValve = (JtValve)this.valve;
                ValvePrmMgr.Instance.FindBy(this.valve.ValveType).JtValvePrm = jtValve.Prm;
                CompareObj.CompareProperty(jtValve.Prm, this.jtValvePrmBackUp, null, tag);
            }
            else if (this.valve.ValveSeries == ValveSeries.螺杆阀)
            {
                SvValve svValve = (SvValve)this.valve;
                ValvePrmMgr.Instance.FindBy(this.valve.ValveType).SvValvePrm = svValve.Prm;
                CompareObj.CompareProperty(svValve.Prm, this.svValvePrmBackUp, null, tag);
            }
            else if (this.valve.ValveSeries == ValveSeries.齿轮泵阀)
            {
                GearValve gearValve = (GearValve)this.valve;
                ValvePrmMgr.Instance.FindBy(this.valve.ValveType).GearValvePrm = gearValve.Prm;
                CompareObj.CompareProperty(gearValve.Prm, this.gearValvePrmBackUp, null, tag);
            }

            Machine.Instance.SaveValveSettings();
            this.Close();
        }
Пример #12
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!tbX.IsValid || !tbY.IsValid)
     {
         //MessageBox.Show("Please input valid value.");
         MessageBox.Show("请输入正确的值.");
         return;
     }
     moveAbsXyCmdLine.MoveType   = this.getMoveType();
     moveAbsXyCmdLine.Position.X = tbX.Value;
     moveAbsXyCmdLine.Position.Y = tbY.Value;
     if (isCreating)
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, moveAbsXyCmdLine);
     }
     else
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, moveAbsXyCmdLine);
     }
     Properties.Settings.Default.absX = moveAbsXyCmdLine.Position.X;
     Properties.Settings.Default.absY = moveAbsXyCmdLine.Position.Y;
     if (!this.isCreating)
     {
         Close();
         if (this.moveAbsXyCmdLine != null && this.moveAbsXyCmdLineBackUp != null)
         {
             CompareObj.CompareField(this.moveAbsXyCmdLine, this.moveAbsXyCmdLineBackUp, null, this.GetType().Name, true);
         }
     }
 }
Пример #13
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!tbWaitInMills.IsValid || !tbSpeed.IsValid)
            {
                //MessageBox.Show("Please input valid value");
                MetroSetMessageBox.Show(this, "请输入合理的值");
                return;
            }

            changeSpeedCmdLine.Speed       = tbSpeed.Value;
            changeSpeedCmdLine.WaitInMills = tbWaitInMills.Value;

            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, changeSpeedCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, changeSpeedCmdLine);
            }

            if (!this.isCreating)
            {
                if (this.changeSpeedCmdLine != null && this.changeSpeedCmdLineBackUp != null)
                {
                    CompareObj.CompareProperty(this.changeSpeedCmdLine, this.changeSpeedCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Пример #14
0
 public void DoDone()
 {
     this.modelFindPrm.AcceptScore  = (double)this.nudAcceptThreshold.Value;
     this.modelFindPrm.SettlingTime = (int)this.nudSettlingTime.Value;
     this.modelFindPrm.Tolerance    = (double)this.nudTolerance.Value;
     this.modelFindPrm.ExecutePrm   = (ExecutePrm)this.light.ExecutePrm.Clone();
     if (this.pattern is Workpiece && this.ckbFrmFile.Checked)
     {
         MessageBox.Show("workPiece的mark点不能来自文件,只能示教");
         return;
     }
     this.modelFindPrm.IsFromFile = this.ckbFrmFile.Checked;
     if (this.isManual)
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         this.modelFindPrm.CopyTempDataTo(TempVisionData.Ins.TempModelFindPrm);
         TempVisionData.Ins.Save();
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     CompareObj.CompareProperty(this.modelFindPrm, this.modelFindPrmBackUp, true);
 }
Пример #15
0
 private void SettingRobotForm_OnSaveClicked()
 {
     Machine.Instance.Robot.TrcPrm.VelMax = Machine.Instance.Robot.DefaultPrm.MaxVelXY;
     Machine.Instance.Robot.TrcPrm.AccMax = Machine.Instance.Robot.DefaultPrm.MaxAccXY;
     Machine.Instance.Robot.SaveDefaultPrm();
     CompareObj.CompareProperty(Machine.Instance.Robot.DefaultPrm, this.DefaultPrmBackUp, null, this.GetType().Name);
 }
Пример #16
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     Machine.Instance.Robot.TrcPrm.VelMax = Machine.Instance.Robot.DefaultPrm.MaxVelXY;
     Machine.Instance.Robot.TrcPrm.AccMax = Machine.Instance.Robot.DefaultPrm.MaxAccXY;
     Machine.Instance.Robot.SaveDefaultPrm();
     CompareObj.CompareProperty(Machine.Instance.Robot.DefaultPrm, this.DefaultPrmBackUp, null, this.GetType().Name);
 }
Пример #17
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (!tbWaitInMills.IsValid)
            {
                //MessageBox.Show("Please input valid value.");
                MessageBox.Show("请输入正确的值");
                return;
            }
            timerCmdLine.WaitInMills = tbWaitInMills.Value;
            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, timerCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, timerCmdLine);
            }

            Properties.Settings.Default.NormalTimer = timerCmdLine.WaitInMills;
            if (!this.isCreating)
            {
                Close();
                if (this.timerCmdLine != null && this.timerCmdLineBackUp != null)
                {
                    CompareObj.CompareField(this.timerCmdLine, this.timerCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Пример #18
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     Machine.Instance.SetupValve();
     MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this);
     Machine.Instance.Setting.Save();
     CompareObj.CompareProperty(Machine.Instance.Setting, this.SettingBackUp, null, this.GetType().Name);
 }
Пример #19
0
        private CompareObj[] InsertSort(CompareObj[] objs)
        {
            CompareObj tmp;
            for (int i = 1; i < objs.Length; i++)
            {
                tmp = objs[i];

                // find index
                int j = i - 1;
                for (; j >= 0; j--)
                {
                    if (tmp.Compare(objs[j])<0)
                    {
                        break;
                    }
                    else
                    {
                        objs[j + 1] = objs[j];
                    }

                }
                objs[j + 1] = tmp;
            }

            return objs;
        }
Пример #20
0
 private void SettingWeightForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.valveWeightPrm != null && this.valveWeightPrmBackUp != null)
     {
         //参数修改记录
         CompareObj.CompareProperty(this.valveWeightPrm, this.valveWeightPrmBackUp);
     }
 }
Пример #21
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     Close();
     if (this.nozzleCheckCmdLine != null && this.nozzleCheckCmdLineBackUp != null)
     {
         CompareObj.CompareMember(this.nozzleCheckCmdLine, this.nozzleCheckCmdLineBackUp, null, this.GetType().Name, true);
     }
 }
Пример #22
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     ValvePrmMgr.Instance.InsertIndex((int)valve1.ValveType, valve1.Prm);
     ValvePrmMgr.Instance.InsertIndex((int)valve2.ValveType, valve2.Prm);
     Machine.Instance.Valve1 = this.valve1;
     Machine.Instance.Valve2 = this.valve2;
     CompareObj.CompareProperty(Machine.Instance.Setting, this.settingBackUp, null, this.GetType().Name);
 }
Пример #23
0
 public void Save()
 {
     if (this.axis == null)
     {
         return;
     }
     AxisPrmMgr.Instance.Save();
     CompareObj.CompareProperty(this.axis.Prm, this.PrmBackUp, null, this.GetType().Name);
 }
Пример #24
0
        private void CbxControlType2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Proportioner.ControlType controlType = (Proportioner.ControlType)cbxControlType2.SelectedItem;
            Machine.Instance.Proportioner2.SetProportionor(2, controlType, SensorMgr.Instance.Proportioners);
            MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this, null);
            SensorMgr.Instance.Save();

            CompareObj.CompareProperty(SensorMgr.Instance.Proportioners, this.settingBackUp, true);
        }
Пример #25
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (rbModelFind.Checked)
            {
                badMarkCmdLine.FindType = BadMarkCmdLine.BadMarkType.ModelFind;
                if (this.editModelFindForm != null)
                {
                    if (this.editModelFindForm.DialogResult == DialogResult.OK)
                    {
                        badMarkCmdLine.Position.X = badMarkCmdLine.ModelFindPrm.PosInPattern.X;
                        badMarkCmdLine.Position.Y = badMarkCmdLine.ModelFindPrm.PosInPattern.Y;
                    }
                }
                else if (isCreating)
                {
                    MessageBox.Show(messageTip[0]);
                    return;
                }
            }
            else
            {
                badMarkCmdLine.FindType = BadMarkCmdLine.BadMarkType.GrayScale;
                if (this.editGrayCheckForm != null)
                {
                    if (this.editGrayCheckForm.DialogResult == DialogResult.OK)
                    {
                        badMarkCmdLine.Position.X = badMarkCmdLine.GrayCheckPrm.PosInPattern.X;
                        badMarkCmdLine.Position.Y = badMarkCmdLine.GrayCheckPrm.PosInPattern.Y;
                    }
                }
                else if (isCreating)
                {
                    MessageBox.Show(messageTip[1]);
                    return;
                }
            }

            if (rbNgSkip.Checked)
            {
                badMarkCmdLine.IsOkSkip = false;
            }
            else
            {
                badMarkCmdLine.IsOkSkip = true;
            }

            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, badMarkCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, badMarkCmdLine);
            }
            Close();
            CompareObj.CompareMember(this.badMarkCmdLine, this.badMarkCmdLineBackUp, null, this.GetType().Name, true);
        }
Пример #26
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this);
     CameraPrmMgr.Instance.Save();
     if (Machine.Instance.Camera.Prm != null && this.prmBackUp != null)
     {
         CompareObj.CompareProperty(Machine.Instance.Camera.Prm, this.prmBackUp, null, this.GetType().Name);
     }
 }
Пример #27
0
 public void DoDone()
 {
     this.grayCheckPrm.SettlingTime    = (int)this.nudSettlingTime.Value;
     this.grayCheckPrm.AcceptTolerance = (int)this.nudGrayTolerance.Value;
     this.grayCheckPrm.IsCreated       = true;
     CompareObj.CompareProperty(this.grayCheckPrm, this.grayCheckPrmBackUP, true);
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Пример #28
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     Machine.Instance.Setting.MachineSelect = (MachineSelection)this.comboBox1.SelectedItem;
     Machine.Instance.SetupIO();
     MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this, null);
     Machine.Instance.Setting.Save();
     this.Close();
     CompareObj.CompareProperty(Machine.Instance.Setting, this.SettingBackUp, null, this.GetType().Name);
 }
Пример #29
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (lineCoordinateCache.Count <= 0)
            {
                //MessageBox.Show("Line points is empty.");
                MessageBox.Show("线轨迹点个数不可以为0.");
                return;
            }
            lineCmdLine.LineCoordinateList.Clear();
            lineCmdLine.LineCoordinateList.AddRange(lineCoordinateCache);
            lineCmdLine.IsWeightControl = cbWeightControl.Checked;

            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, lineCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, lineCmdLine);
            }

            int count = lineCmdLine.LineCoordinateList.Count;

            if (count > 0)
            {
                LineCoordinate lineCoordinate = lineCmdLine.LineCoordinateList[count - 1];
                Properties.Settings.Default.LineStartX = lineCoordinate.Start.X;
                Properties.Settings.Default.LineStartY = lineCoordinate.Start.Y;
                Properties.Settings.Default.LineEndX   = lineCoordinate.End.X;
                Properties.Settings.Default.LineEndY   = lineCoordinate.End.Y;
                Properties.Settings.Default.LineStyle  = (int)lineCmdLine.LineStyle;
                Properties.Settings.Default.LineIsWt   = lineCmdLine.IsWeightControl;
                Properties.Settings.Default.LineWt     = lineCmdLine.WholeWeight;
            }
            if (Machine.Instance.Valve1.RunMode == ValveRunMode.AdjustLine)
            {
                Line.WaitMsg.Set();
            }
            if (!this.isCreating)
            {
                Close();
                if (this.lineCmdLine != null && this.lineCmdLineBackUp != null)
                {
                    CompareObj.CompareField(this.lineCmdLine, this.lineCmdLineBackUp, null, this.GetType().Name, true);
                    CompareObj.CompareProperty(this.lineCmdLine, this.lineCmdLineBackUp, null, this.GetType().Name, true);
                    if (this.lineCmdLine.LineCoordinateList.Count == this.lineCmdLineBackUp.LineCoordinateList.Count)
                    {
                        for (int i = 0; i < this.lineCmdLine.LineCoordinateList.Count; i++)
                        {
                            string pathRoot = this.GetType().Name + "\\lineCmdLine\\" + "LineCoordinateList: " + i.ToString();
                            CompareObj.CompareField(this.lineCmdLine.LineCoordinateList[i], this.lineCmdLineBackUp.LineCoordinateList[i], null, pathRoot, true);
                        }
                    }
                }
            }
        }
Пример #30
0
        private void CbxVendor_SelectedIndexChanged(object sender, EventArgs e)
        {
            Laser.Vendor vendor = (Laser.Vendor) this.cbxVendor.SelectedItem;
            Machine.Instance.Laser.SetLaserable(vendor);
            this.txtReadCmd.Text = Machine.Instance.Laser.Laserable.CmdReadValue;

            MsgCenter.Broadcast(MachineMsg.SETUP_INFO, this, null);
            SensorMgr.Instance.Save();
            CompareObj.CompareProperty(SensorMgr.Instance.Laser, this.settingBackUp, null, this.GetType().Name, true);
        }
Пример #31
0
 private void EditDotParamsForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (FluidProgram.Current != null && this.dotParamList != null && this.dotParamListBackUp != null)
     {
         for (int i = 0; i < this.dotParamList.Count; i++)
         {
             CompareObj.CompareField(this.dotParamList[i], this.dotParamListBackUp[i], null, this.GetType().Name);
         }
     }
 }
Пример #32
0
        /////////////
        // HELPERS //
        /////////////


        private void do_obj(object v, CompareObj <object> cmp)
        {
            // test an object both by itself and as an array.

            cmp.compare(v, server.f1(v));

            object[] a = { v };
            CompareObj <object[]> acmp = new AObjectCompare(cmp);

            acmp.compare(a, server.f5(a));
        }
Пример #33
0
        public string LargestNumber(int[] nums)
        {
            CompareObj[] objs = new CompareObj[nums.Length];
            for(int i=0; i< nums.Length;i++){
                objs[i] = new CompareObj(nums[i]);
            }

            objs = QuickSort(objs);
            StringBuilder sb = new StringBuilder();

            foreach (CompareObj co in objs)
            {
                sb.Append(co.chars);
            }
            string result = sb.ToString();
            return result.StartsWith("0")?"0":result;
        }
Пример #34
0
 public int Compare(CompareObj obj)
 {
     long i1 = ConcatInt2(this.chars, obj.chars);
     long i2 = ConcatInt2(obj.chars, this.chars);
     if (i1 > i2)
         return 1;
     else if (i1 < i2)
         return -1;
     else
         return 0;
 }
Пример #35
0
        private CompareObj[] q_sort(CompareObj[] input, int left, int right)
        {
            CompareObj tmp;
            if( left + CUTOFF <= right){
                CompareObj pivot = median3(input, left, right);

                int i = left;
                int j = right - 1;
                for(;;){
                    while(input[++i].Compare(pivot)<0);
                    while(input[--j].Compare(pivot)>0);
                    if(i<j){
                        //swap
                        tmp = input[i];
                        input[i]=input[j];
                        input[j] = tmp;
                    }else{
                        break;
                    }
                }

                // restore pivot
                //swap
                tmp = input[i];
                input[i]=input[right-1];
                input[right-1] = tmp;

                //recursion
                q_sort(input,left,i-1);
                q_sort(input,i+1,right);
            }
            return input;
        }
Пример #36
0
 private CompareObj[] QuickSort(CompareObj[] objs)
 {
     CompareObj[] result = q_sort(objs, 0, objs.Length - 1);
     result = InsertSort(result);
     return result;
 }