Exemple #1
0
 private void UpdateDGV()
 {
     this.dgvCurve.Rows.Clear();
     foreach (var m in this.Curve.Data.Points)
     {
         int             index = this.dgvCurve.Rows.Add();
         DataGridViewRow row   = this.dgvCurve.Rows[index];
         double          x     = m.X;
         double          y     = m.Y;
         if (this.Curve.ShowAbs)
         {
             x *= double.Parse(SpeedUnitConverter.Convert(this.Curve.Speed)) / 100.0;
             if (id == PWR_CURVE_ID)
             {
                 y *= Constants.MaxPower / 100.0;
             }
             else
             {
                 y *= this.Curve.Freq / 100.0;
             }
         }
         row.Cells[0].Value = x.ToString("0.00") + this.xSuffix;
         row.Cells[1].Value = y.ToString("0.00") + this.ySuffix;
     }
 }
Exemple #2
0
        private void InitializeCurve()
        {
            this.chartControlCurve.Clear();
            this.chartControlCurve.AddCurve(new Curve
            {
                Id       = this.id,
                Points   = CopyUtil.DeepCopyBaseOnJSon(this.Curve.Data.Points),
                DisColor = this.id == PWR_CURVE_ID ? Color.Red: Color.Blue,
                Pattern  = this.Curve.Data.Pattern
            });

            string xLegend = null;
            string yLegend = null;
            double xMax    = 0;
            double yMax    = 0;

            bool showAbs = this.Curve.ShowAbs;

            if (showAbs)
            {
                string str1 = this.Curve.SpeedUnit.GetDescription();
                xLegend      = $"Speed({str1})";
                yLegend      = this.id == PWR_CURVE_ID ? "Power(W)" : "Frequency(Hz)";
                xMax         = double.Parse(SpeedUnitConverter.Convert(this.Curve.Speed));
                yMax         = Constants.MaxPower * this.Curve.PowerPercentage / 100.0;
                this.xSuffix = str1;
                this.ySuffix = this.id == PWR_CURVE_ID ? "W" : "Hz";
            }
            else
            {
                xLegend      = "Speed(%)";
                yLegend      = this.id == PWR_CURVE_ID ? "Power(%)" : "Frequency(%)";
                xMax         = 100;
                yMax         = 100;
                this.xSuffix = "%";
                this.ySuffix = "%";
            }

            this.chartControlCurve.XLengend = xLegend;
            this.chartControlCurve.YLengend = yLegend;
            this.chartControlCurve.XMax     = xMax;
            this.chartControlCurve.YMax     = yMax;

            this.UpdateDGV();
            this.checkAbs.Checked            = showAbs;
            this.cmbPatternPwr.SelectedIndex = (int)this.Curve.Data.Pattern;

            if (this.id == PWR_CURVE_ID)
            {
                this.dgvCurve.Columns[1].HeaderText = "Power";
            }
            else
            {
                this.dgvCurve.Columns[1].HeaderText = "Frequency";
            }
        }
Exemple #3
0
        private void InitializeBindings()
        {
            var fluent = mvvmContext1.OfType <LayerCraftModel>();

            fluent.SetBinding(this.cmbMaterialTypes, c => c.EditValue, x => x.MaterialType);
            fluent.SetBinding(this.cmbThickness, c => c.EditValue, x => x.Thickness);
            fluent.SetBinding(this.cmbNozzle, c => c.EditValue, x => x.Nozzle);
            fluent.SetBinding(this.ckShortUnLift, c => c.Checked, x => x.IsShortUnLift);
            fluent.SetBinding(this.ckPrePierce, c => c.Checked, x => x.IsPrePierce);
            fluent.SetBinding(this.ckEvaporationFilm, c => c.Checked, x => x.IsEvaporationFilm);
            fluent.SetBinding(this.ckPathRecooling, c => c.Checked, x => x.IsPathRecooling);
            fluent.SetBinding(this.ckMultiTime, c => c.Checked, x => x.IsMultiTime);
            fluent.SetBinding(this.txtMultiTime.PopupEdit, c => c.Text, x => x.MultiTime);
            fluent.SetBinding(this.ckKeepPuffing, c => c.Checked, x => x.IsKeepPuffing);
            fluent.SetBinding(this.ckUnprocessed, c => c.Checked, x => x.IsUnprocessed);
            fluent.SetBinding(this.ckNoFollow, c => c.Checked, x => x.IsNoFollow);
            fluent.SetBinding(this.cmbProcessedTypes, c => c.SelectedIndex, x => x.ProcessedType,
                              m => { return((int)m); },
                              r => { return((ProcessedTypes)r); });
            //切割
            fluent.SetBinding(this.txtCutSpeed.PopupEdit, c => c.Text, x => x.CutSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtLiftHeight.PopupEdit, c => c.Text, x => x.LiftHeight);
            fluent.SetBinding(this.txtNozzleHeight.PopupEdit, c => c.Text, x => x.NozzleHeight);
            fluent.SetBinding(this.cmbGasKind, c => c.Text, x => x.GasKind);
            fluent.SetBinding(this.txtGasPressure.PopupEdit, c => c.Text, x => x.GasPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtPowerPercent.PopupEdit, c => c.Text, x => x.PowerPercent);
            fluent.SetBinding(this.txtPowerValue.PopupEdit, c => c.Text, x => x.PowerValue);
            fluent.SetBinding(this.txtPulseDutyFactorPercent.PopupEdit, c => c.Text, x => x.PulseDutyFactorPercent);
            fluent.SetBinding(this.txtPulseFrequency.PopupEdit, c => c.Text, x => x.PulseFrequency);
            fluent.SetBinding(this.txtBeamSize.PopupEdit, c => c.Text, x => x.BeamSize);
            fluent.SetBinding(this.txtFocusPosition.PopupEdit, c => c.Text, x => x.FocusPosition);
            fluent.SetBinding(this.txtDelayTime.PopupEdit, c => c.Text, x => x.DelayTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtLaserOffDelay.PopupEdit, c => c.Text, x => x.LaserOffDelay, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));

            fluent.SetBinding(this.ckSlowStart, c => c.Checked, x => x.IsSlowStart);
            fluent.SetBinding(this.ckSlowStop, c => c.Checked, x => x.IsSlowStop);
            fluent.SetBinding(this.txtSlowStartDistance.PopupEdit, c => c.Text, x => x.SlowStartDistance);
            fluent.SetBinding(this.txtSlowStopDistance.PopupEdit, c => c.Text, x => x.SlowStopDistance);
            fluent.SetBinding(this.txtSlowStartSpeed.PopupEdit, c => c.Text, x => x.SlowStartSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtSlowStopSpeed.PopupEdit, c => c.Text, x => x.SlowStopSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            //fluent.SetBinding(this.ckDynamicAdjustPower, c => c.Checked, x => x.IsDynamicAdjustPower);
            //fluent.SetBinding(this.ckDynamicAdjustFrequency, c => c.Checked, x => x.IsDynamicAdjustFrequency);
            //fluent.SetBinding(this.ckIsShowAbs, c => c.Checked, x => x.IsShowAbs);
            fluent.SetBinding(this.ckDynamicAdjustPower, c => c.Checked, x => x.PwrCtrlPara.PowerAdjustmentEnabled);
            fluent.SetBinding(this.ckDynamicAdjustFrequency, c => c.Checked, x => x.PwrCtrlPara.FreqAdjustmentEnabled);
            fluent.SetBinding(this.ckIsShowAbs, c => c.Checked, x => x.PwrCtrlPara.ShowAbs);
            fluent.SetBinding(this.txtUserNotes, c => c.Text, x => x.UserNotes);

            //穿孔
            fluent.SetBinding(this.rbtnPierceLevelNone, c => c.Checked, x => x.PierceLevel,
                              m => { return(PierceLevels.None == m); },
                              r => { return(PierceLevels.None); });
            fluent.SetBinding(this.rbtnPierceLevel1, c => c.Checked, x => x.PierceLevel,
                              m => { return(PierceLevels.Level1 == m); },
                              r => { return(PierceLevels.Level1); });
            fluent.SetBinding(this.rbtnPierceLevel2, c => c.Checked, x => x.PierceLevel,
                              m => { return(PierceLevels.Level2 == m); },
                              r => { return(PierceLevels.Level2); });
            fluent.SetBinding(this.rbtnPierceLevel3, c => c.Checked, x => x.PierceLevel,
                              m => { return(PierceLevels.Level3 == m); },
                              r => { return(PierceLevels.Level3); });
            //等级一
            fluent.SetBinding(this.ckStepTime1, c => c.Checked, x => x.PierceLevel1.IsStepTime);
            fluent.SetBinding(this.txtStepTime1.PopupEdit, c => c.Text, x => x.PierceLevel1.StepTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtNozzleHeight1.PopupEdit, c => c.Text, x => x.PierceLevel1.NozzleHeight);
            fluent.SetBinding(this.cmbGasKind1, c => c.Text, x => x.PierceLevel1.GasKind);
            fluent.SetBinding(this.txtGasPressure1.PopupEdit, c => c.Text, x => x.PierceLevel1.GasPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtPowerPercent1.PopupEdit, c => c.Text, x => x.PierceLevel1.PowerPercent);
            fluent.SetBinding(this.txtPowerValue1.PopupEdit, c => c.Text, x => x.PierceLevel1.PowerValue);
            fluent.SetBinding(this.txtPulseDutyFactorPercent1.PopupEdit, c => c.Text, x => x.PierceLevel1.PulseDutyFactorPercent);
            fluent.SetBinding(this.txtPulseFrequency1.PopupEdit, c => c.Text, x => x.PierceLevel1.PulseFrequency);
            fluent.SetBinding(this.txtBeamSize1.PopupEdit, c => c.Text, x => x.PierceLevel1.BeamSize);
            fluent.SetBinding(this.txtFocusPosition1.PopupEdit, c => c.Text, x => x.PierceLevel1.FocusPosition);
            fluent.SetBinding(this.txtDelayTime1.PopupEdit, c => c.Text, x => x.PierceLevel1.DelayTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.ckExtraPuffing1, c => c.Checked, x => x.PierceLevel1.IsExtraPuffing);
            fluent.SetBinding(this.txtExtraPuffing1.PopupEdit, c => c.Text, x => x.PierceLevel1.ExtraPuffing, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            //等级二
            fluent.SetBinding(this.ckStepTime2, c => c.Checked, x => x.PierceLevel2.IsStepTime);
            fluent.SetBinding(this.txtStepTime2.PopupEdit, c => c.Text, x => x.PierceLevel2.StepTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtNozzleHeight2.PopupEdit, c => c.Text, x => x.PierceLevel2.NozzleHeight);
            fluent.SetBinding(this.cmbGasKind2, c => c.Text, x => x.PierceLevel2.GasKind);
            fluent.SetBinding(this.txtGasPressure2.PopupEdit, c => c.Text, x => x.PierceLevel2.GasPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtPowerPercent2.PopupEdit, c => c.Text, x => x.PierceLevel2.PowerPercent);
            fluent.SetBinding(this.txtPowerValue2.PopupEdit, c => c.Text, x => x.PierceLevel2.PowerValue);
            fluent.SetBinding(this.txtPulseDutyFactorPercent2.PopupEdit, c => c.Text, x => x.PierceLevel2.PulseDutyFactorPercent);
            fluent.SetBinding(this.txtPulseFrequency2.PopupEdit, c => c.Text, x => x.PierceLevel2.PulseFrequency);
            fluent.SetBinding(this.txtBeamSize2.PopupEdit, c => c.Text, x => x.PierceLevel2.BeamSize);
            fluent.SetBinding(this.txtFocusPosition2.PopupEdit, c => c.Text, x => x.PierceLevel2.FocusPosition);
            fluent.SetBinding(this.txtDelayTime2.PopupEdit, c => c.Text, x => x.PierceLevel2.DelayTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.ckExtraPuffing2, c => c.Checked, x => x.PierceLevel2.IsExtraPuffing);
            fluent.SetBinding(this.txtExtraPuffing2.PopupEdit, c => c.Text, x => x.PierceLevel2.ExtraPuffing, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            //等级三
            fluent.SetBinding(this.ckStepTime3, c => c.Checked, x => x.PierceLevel3.IsStepTime);
            fluent.SetBinding(this.txtStepTime3.PopupEdit, c => c.Text, x => x.PierceLevel3.StepTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtNozzleHeight3.PopupEdit, c => c.Text, x => x.PierceLevel3.NozzleHeight);
            fluent.SetBinding(this.cmbGasKind3, c => c.Text, x => x.PierceLevel3.GasKind);
            fluent.SetBinding(this.txtGasPressure3.PopupEdit, c => c.Text, x => x.PierceLevel3.GasPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtPowerPercent3.PopupEdit, c => c.Text, x => x.PierceLevel3.PowerPercent);
            fluent.SetBinding(this.txtPowerValue3.PopupEdit, c => c.Text, x => x.PierceLevel3.PowerValue);
            fluent.SetBinding(this.txtPulseDutyFactorPercent3.PopupEdit, c => c.Text, x => x.PierceLevel3.PulseDutyFactorPercent);
            fluent.SetBinding(this.txtPulseFrequency3.PopupEdit, c => c.Text, x => x.PierceLevel3.PulseFrequency);
            fluent.SetBinding(this.txtBeamSize3.PopupEdit, c => c.Text, x => x.PierceLevel3.BeamSize);
            fluent.SetBinding(this.txtFocusPosition3.PopupEdit, c => c.Text, x => x.PierceLevel3.FocusPosition);
            fluent.SetBinding(this.txtDelayTime3.PopupEdit, c => c.Text, x => x.PierceLevel3.DelayTime, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.ckExtraPuffing3, c => c.Checked, x => x.PierceLevel3.IsExtraPuffing);
            fluent.SetBinding(this.txtExtraPuffing3.PopupEdit, c => c.Text, x => x.PierceLevel3.ExtraPuffing, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            //UI上的绑定
            this.txtMultiTime.DataBindings.Add("Enabled", this.ckMultiTime, "Checked");
            this.txtStepTime1.DataBindings.Add("Enabled", this.ckStepTime1, "Checked");
            this.txtExtraPuffing1.DataBindings.Add("Enabled", this.ckExtraPuffing1, "Checked");
            this.txtStepTime2.DataBindings.Add("Enabled", this.ckStepTime2, "Checked");
            this.txtExtraPuffing2.DataBindings.Add("Enabled", this.ckExtraPuffing2, "Checked");
            this.txtStepTime3.DataBindings.Add("Enabled", this.ckStepTime3, "Checked");
            this.txtExtraPuffing3.DataBindings.Add("Enabled", this.ckExtraPuffing3, "Checked");
            //UI上的关联行为
            this.txtPowerPercent.NumberChanged  += (sender, e) => this.txtPowerValue.Number = Constants.MaxPower * this.txtPowerPercent.Number / 100.0;
            this.txtPowerPercent1.NumberChanged += (sender, e) => this.txtPowerValue1.Number = Constants.MaxPower * this.txtPowerPercent1.Number / 100.0;
            this.txtPowerPercent2.NumberChanged += (sender, e) => this.txtPowerValue2.Number = Constants.MaxPower * this.txtPowerPercent2.Number / 100.0;
            this.txtPowerPercent3.NumberChanged += (sender, e) => this.txtPowerValue3.Number = Constants.MaxPower * this.txtPowerPercent3.Number / 100.0;
        }
Exemple #4
0
 private void txtCutSpeed_NumberChanged(object arg1, EventArgs arg2)
 {
     //this.Model.CutSpeed = this.txtCutSpeed.Number;
     this.Model.CutSpeed = SpeedUnitConverter.ConvertBack(this.txtCutSpeed.Number.ToString());
     this.InitializeCurve();
 }
Exemple #5
0
        private void InitializeCurve()
        {
            this.chartControl1.Clear();

            bool enabled1 = this.Model.PwrCtrlPara.PowerAdjustmentEnabled;

            if (enabled1)
            {
                var data = this.Model.PwrCtrlPara.PowerCurve;
                this.chartControl1.AddCurve(new Curve
                {
                    Id       = "PwrCurve",
                    DisColor = Color.Red,
                    Points   = data.Points,
                    Pattern  = data.Pattern
                });
            }

            bool enabled2 = this.Model.PwrCtrlPara.FreqAdjustmentEnabled;

            if (enabled2)
            {
                var data = this.Model.PwrCtrlPara.FreqCurve;
                this.chartControl1.AddCurve(new Curve
                {
                    Id       = "FreqCurve",
                    DisColor = Color.Blue,
                    Points   = data.Points,
                    Pattern  = data.Pattern
                });
            }

            double xMax;
            double yMax;
            string xLegend = null;
            string yLegend = null;
            bool   showAbs = this.Model.PwrCtrlPara.ShowAbs;

            if (showAbs)
            {
                var speedUnit = UnitObserverFacade.Instance.SpeedUnitObserver.UnitType;
                xLegend = $"Speed({speedUnit.GetDescription()})";

                if (enabled2)
                {
                    yLegend = "Frequency(Hz)\r\n";
                }
                if (enabled1)
                {
                    yLegend += "Power(W)";
                }

                xMax = double.Parse(SpeedUnitConverter.Convert(this.Model.CutSpeed));
                yMax = Constants.MaxPower * this.Model.PowerPercent / 100.0;
            }
            else
            {
                xLegend = "Speed(%)";

                if (enabled2)
                {
                    yLegend = "Frequency(%)\r\n";
                }
                if (enabled1)
                {
                    yLegend += "Power(%)";
                }

                xMax = 100;
                yMax = 100;
            }

            this.chartControl1.XLengend = xLegend;
            this.chartControl1.YLengend = yLegend;
            this.chartControl1.XMax     = xMax;
            this.chartControl1.YMax     = yMax;
        }
Exemple #6
0
        private bool OnPagePwrCellChanged(double cellValue, int rowIndex, int columnIndex)
        {
            bool showAbs = this.Curve.ShowAbs;

            if (showAbs)
            {
                if (columnIndex == 0)
                {
                    double speed = SpeedUnitConverter.ConvertBack(cellValue.ToString());
                    cellValue = speed / this.Curve.Speed * 100.0;
                }
                if (columnIndex == 1)
                {
                    double power = double.Parse(cellValue.ToString());
                    cellValue = power / Constants.MaxPower * 100.0;
                }
            }

            var    points   = this.Curve.Data.Points;
            double oldValue = 0;

            if (columnIndex == 0)
            {
                oldValue = points[rowIndex].X;
            }
            else
            {
                oldValue = points[rowIndex].Y;
            }

            bool flag = false;

            if (Math.Abs(cellValue - oldValue) > 0.0001)
            {
                flag = true;
                double low  = 0;
                double high = 0;

                if (rowIndex == 0)
                {
                    if (columnIndex == 0)
                    {
                        low  = 0;
                        high = points[rowIndex + 1].X;
                        if (cellValue > low && cellValue < high)
                        {
                            points[rowIndex] = new PointF((float)cellValue, points[rowIndex].Y);
                        }
                    }
                    else
                    {
                        low  = 0;
                        high = points[rowIndex + 1].Y;
                        if (cellValue > low && cellValue < high)
                        {
                            points[rowIndex] = new PointF(points[rowIndex].X, (float)cellValue);
                        }
                    }
                }
                else if (rowIndex == this.Curve.Data.Points.Count - 1)
                {
                    if (columnIndex == 0)
                    {
                        low  = points[rowIndex - 1].X;
                        high = 100;
                        if (cellValue > low && cellValue < high)
                        {
                            points[rowIndex] = new PointF((float)cellValue, points[rowIndex].Y);
                        }
                    }
                    else
                    {
                        low  = points[rowIndex - 1].Y;
                        high = 100;
                        if (cellValue > low && cellValue < high)
                        {
                            points[rowIndex] = new PointF(points[rowIndex].X, (float)cellValue);
                        }
                    }
                }
                else
                {
                    if (columnIndex == 0)
                    {
                        low  = points[rowIndex - 1].X;
                        high = points[rowIndex + 1].X;
                        if (cellValue > low && cellValue < high)
                        {
                            points[rowIndex] = new PointF((float)cellValue, points[rowIndex].Y);
                        }
                    }
                    else
                    {
                        low  = points[rowIndex - 1].Y;
                        high = points[rowIndex + 1].Y;
                        if (cellValue > low && cellValue < high)
                        {
                            points[rowIndex] = new PointF(points[rowIndex].X, (float)cellValue);
                        }
                    }
                }
            }

            return(flag);
        }
        private void InitializeBindings()
        {
            var fluent = mvvmContext1.OfType <LayerEvaporateModel>();

            //切割
            fluent.SetBinding(this.txtCutSpeed.PopupEdit, c => c.Text, x => x.CutSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtLiftHeight.PopupEdit, c => c.Text, x => x.LiftHeight);
            fluent.SetBinding(this.txtNozzleHeight.PopupEdit, c => c.Text, x => x.NozzleHeight);
            fluent.SetBinding(this.cmbGasKind, c => c.Text, x => x.GasKind);
            fluent.SetBinding(this.txtGasPressure.PopupEdit, c => c.Text, x => x.GasPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtPowerPercent.PopupEdit, c => c.Text, x => x.PowerPercent);
            fluent.SetBinding(this.txtPulseFrequency.PopupEdit, c => c.Text, x => x.PulseFrequency);
            fluent.SetBinding(this.txtPulseDutyFactorPercent.PopupEdit, c => c.Text, x => x.PulseDutyFactorPercent);
            fluent.SetBinding(this.txtBeamSize.PopupEdit, c => c.Text, x => x.BeamSize);
            fluent.SetBinding(this.txtFocusPosition.PopupEdit, c => c.Text, x => x.FocusPosition);
            fluent.SetBinding(this.txtLaserOpenDelay.PopupEdit, c => c.Text, x => x.LaserOpenDelay);
            //fluent.SetBinding(this.ckDynamicAdjustPower, c => c.Checked, x => x.IsDynamicAdjustPower);
            //fluent.SetBinding(this.ckDynamicAdjustFrequency, c => c.Checked, x => x.IsDynamicAdjustFrequency);
            //fluent.SetBinding(this.ckShowAbs, c => c.Checked, x => x.IsShowAbs);
            fluent.SetBinding(this.ckDynamicAdjustPower, c => c.Checked, x => x.PwrCtrlPara.PowerAdjustmentEnabled);
            fluent.SetBinding(this.ckDynamicAdjustFrequency, c => c.Checked, x => x.PwrCtrlPara.FreqAdjustmentEnabled);
            fluent.SetBinding(this.ckShowAbs, c => c.Checked, x => x.PwrCtrlPara.ShowAbs);
            fluent.SetBinding(this.txtUserNotes, c => c.Text, x => x.UserNotes);
        }
        private void InitializeBindings()
        {
            var context = new MVVMContext();

            context.ContainerControl = this;
            context.ViewModelType    = typeof(MachineViewModel);

            var viewModel = context.GetViewModel <MachineViewModel>();
            var fluent    = context.OfType <MachineViewModel>();

            #region Command Bindings
            fluent.BindCommand(this.btnStart, (x, para) => x.RunOperation(para), x => "Start");
            fluent.BindCommand(this.btnPause, x => x.Pause());
            fluent.BindCommand(this.btnStop, x => x.StopOperation());
            fluent.BindCommand(this.btnOutline, (x, para) => x.RunOperation(para), x => "Outline");
            fluent.BindCommand(this.btnSimulate, (x, para) => x.RunOperation(para), x => "Simulate");
            fluent.BindCommand(this.btnFastStart, (x, para) => x.RunOperation(para), x => "Fast");
            fluent.BindCommand(this.btnEmpty, (x, para) => x.RunOperation(para), x => "Empty");
            fluent.BindCommand(this.btnCircle, x => x.ConfigCirclePara());
            fluent.BindCommand(this.btnLocate, x => x.LoacateBreakPoint());
            fluent.BindCommand(this.btnBreakPointStart, (x, para) => x.RunOperation(para), x => "BreakPointStart");
            fluent.BindCommand(this.btnForward, (x, para) => x.RunOperation(para), x => "Forward");
            fluent.BindCommand(this.btnBackward, (x, para) => x.RunOperation(para), x => "Backward");
            fluent.BindCommand(this.btnZero, x => x.MoveToZero());
            #endregion

            #region Property Bindings
            fluent.SetBinding(this.checkReturn, e => e.Checked, x => x.IsReturnAfterMachine);
            fluent.SetBinding(this.cmbReturnPoint, e => e.SelectedIndex, x => x.ReturnPointIndex);
            fluent.SetBinding(this.checkReturnAfterStop, e => e.Checked, x => x.IsReturnZeroWhenStop);
            fluent.SetBinding(this.checkSelected, e => e.Checked, x => x.IsOnlyMachineSelected);
            fluent.SetBinding(this.checkSoftLimit, e => e.Checked, x => x.SoftwareLimitEnalbed);
            fluent.SetBinding(this.checkEdgeDetection, e => e.Checked, x => x.EdgeDetectoinEnabled);
            fluent.SetBinding(this.ucInputStep, e => e.Number, x => x.Step, m => double.Parse(SpeedUnitConverter.Convert(m)), r => SpeedUnitConverter.ConvertBack(r.ToString()));
            fluent.SetBinding(this.ucInputSpeed, e => e.Number, x => x.StepSpeed, m => double.Parse(SpeedUnitConverter.Convert(m)), r => SpeedUnitConverter.ConvertBack(r.ToString()));
            //this.ucInputStep.Number = viewModel.Step;
            //this.ucInputStep.NumberChanged += (sender, e) => viewModel.Step = this.ucInputStep.Number;
            //fluent.SetTrigger(x => x.Step, step => this.ucInputStep.Number = step);
            //this.ucInputSpeed.Number = viewModel.StepSpeed;
            //this.ucInputSpeed.NumberChanged += (sender, e) => viewModel.StepSpeed = this.ucInputSpeed.Number;
            //fluent.SetTrigger(x => x.StepSpeed, speed => this.ucInputSpeed.Number = speed);
            #endregion

            this.cmbReturnPoint.DataBindings.Add("Enabled", this.checkReturn, "Checked");
            viewModel.StatusChanged       += ViewModel_StatusChanged;
            viewModel.DisableLocateStatus += ViewModel_DisableLocateStatus;
            viewModel.Register("UpdateCirclePara", this.UpdateCircleConfig);
        }
Exemple #9
0
        private void InitializeBindings()
        {
            var fluent = mvvmContext1.OfType <LayerConfigModel>();

            #region 运动控制参数
            //fluent.SetBinding(this.rbtnUseCommon, c => c.Checked, x => x.EmptyMoveParamType,
            //        m => { return EmptyMoveParamTypes.UseCommon == m; },
            //        r => { return EmptyMoveParamTypes.UseCommon; });
            //fluent.SetBinding(this.rbtnUseAlone, c => c.Checked, x => x.EmptyMoveParamType,
            //    m => { return EmptyMoveParamTypes.UseAlone == m; },
            //    r => { return EmptyMoveParamTypes.UseAlone; });
            fluent.SetBinding(this.txtEmptyMoveSpeed.PopupEdit, c => c.Text, x => x.EmptyMoveSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtEmptyMoveSpeedX.PopupEdit, c => c.Text, x => x.EmptyMoveSpeedX, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtEmptyMoveSpeedY.PopupEdit, c => c.Text, x => x.EmptyMoveSpeedY, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtEmptyMoveAcceleratedSpeed.PopupEdit, c => c.Text, x => x.EmptyMoveAcceleratedSpeed, m => AccelerationUnitConverter.Convert(m), r => AccelerationUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtEmptyMoveAcceleratedSpeedX.PopupEdit, c => c.Text, x => x.EmptyMoveSpeedX, m => AccelerationUnitConverter.Convert(m), r => AccelerationUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtEmptyMoveAcceleratedSpeedY.PopupEdit, c => c.Text, x => x.EmptyMoveSpeedY, m => AccelerationUnitConverter.Convert(m), r => AccelerationUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtEmptyMoveLowpassHz.PopupEdit, c => c.Text, x => x.EmptyMoveLowpassHz);
            fluent.SetBinding(this.txtEmptyMoveLowpassXHz.PopupEdit, c => c.Text, x => x.EmptyMoveLowpassXHz);
            fluent.SetBinding(this.txtEmptyMoveLowpassYHz.PopupEdit, c => c.Text, x => x.EmptyMoveLowpassYHz);
            fluent.SetBinding(this.txtCheckEdgeSpeed.PopupEdit, c => c.Text, x => x.CheckEdgeSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtProcessAcceleratedSpeed.PopupEdit, c => c.Text, x => x.ProcessAcceleratedSpeed, m => AccelerationUnitConverter.Convert(m), r => AccelerationUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtProcessLowpassHz.PopupEdit, c => c.Text, x => x.ProcessLowpassHz);
            fluent.SetBinding(this.spCurveControlPrecision, c => c.Value, x => x.CurveControlPrecision);
            fluent.SetBinding(this.spCornerControlPrecision, c => c.Value, x => x.CornerControlPrecision);
            #endregion
            #region 默认参数
            fluent.SetBinding(this.txtDotBurstPulseFrequency.PopupEdit, c => c.Text, x => x.DotBurstPulseFrequency);
            fluent.SetBinding(this.txtDotBurstPeakPower.PopupEdit, c => c.Text, x => x.DotBurstPeakPower);
            fluent.SetBinding(this.txtDefalutAirPressure.PopupEdit, c => c.Text, x => x.DefalutAirPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtOpenAirDelay.PopupEdit, c => c.Text, x => x.OpenAirDelay, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtFirstOpenAirDelay.PopupEdit, c => c.Text, x => x.FirstOpenAirDelay, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtExchangeAirDelay.PopupEdit, c => c.Text, x => x.ExchangeAirDelay, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtCoolingDotDelay.PopupEdit, c => c.Text, x => x.CoolingDotDelay, m => TimeUnitConverter.Convert(m), r => TimeUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtPauseBackspaceDistance.PopupEdit, c => c.Text, x => x.PauseBackspaceDistance);
            #endregion
            #region 单位选择
            fluent.SetBinding(this.cmbUnitTimeTypes, c => c.SelectedIndex, x => x.UnitTimeType,
                              m => { return((int)m); },
                              r => { return((UnitTimeTypes)r); });
            fluent.SetBinding(this.cmbUnitSpeedTypes, c => c.SelectedIndex, x => x.UnitSpeedType,
                              m => { return((int)m); },
                              r => { return((UnitSpeedTypes)r); });
            fluent.SetBinding(this.cmbUnitAcceleratedType, c => c.SelectedIndex, x => x.UnitAcceleratedType,
                              m => { return((int)m); },
                              r => { return((UnitAcceleratedTypes)r); });
            fluent.SetBinding(this.cmbUnitPressureTypes, c => c.SelectedIndex, x => x.UnitPressureType,
                              m => { return((int)m); },
                              r => { return((UnitPressureTypes)r); });
            #endregion
            #region 跟随控制
            fluent.SetBinding(this.txtFollowMaxHeight.PopupEdit, c => c.Text, x => x.FollowMaxHeight);
            fluent.SetBinding(this.ckFrogStyleLift, c => c.Checked, x => x.IsFrogStyleLift);
            fluent.SetBinding(this.ckEnableFollowEmptyMove, c => c.Checked, x => x.IsEnableFollowEmptyMove);
            fluent.SetBinding(this.ckDisableFollowProcessed, c => c.Checked, x => x.IsDisableFollowProcessed);
            fluent.SetBinding(this.ckOnlyPositionZCoordinate, c => c.Checked, x => x.IsOnlyPositionZCoordinate);
            fluent.SetBinding(this.txtPositionZCoordinate.PopupEdit, c => c.Text, x => x.PositionZCoordinate);
            fluent.SetBinding(this.txtUnLiftMaxEmptyMoveLength.PopupEdit, c => c.Text, x => x.UnLiftMaxEmptyMoveLength);
            fluent.SetBinding(this.ckShortDistanceOptimization, c => c.Checked, x => x.IsShortDistanceOptimization);
            fluent.SetBinding(this.ckIsFollowWithFocus, c => c.Checked, x => x.IsFollowWithFocus);
            #endregion
            #region 高级
            fluent.SetBinding(this.ckEnableNurmbsIntepolation, c => c.Checked, x => x.IsEnableNurmbsIntepolation);
            fluent.SetBinding(this.ckAllAlarmsManuallyClear, c => c.Checked, x => x.IsAllAlarmsManuallyClear);
            fluent.SetBinding(this.ckGroupPrePiercing, c => c.Checked, x => x.IsGroupPrePiercing);
            fluent.SetBinding(this.ckMicroJointFlyingCut, c => c.Checked, x => x.IsMicroJointFlyingCut);
            fluent.SetBinding(this.ckEnableMachineProtection, c => c.Checked, x => x.IsEnableMachineProtection);
            fluent.SetBinding(this.txtCompensatePrecision, c => c.Value, x => x.CompensatePrecision);
            fluent.SetBinding(this.txtFlyingCutOverDistance, c => c.Value, x => x.FlyingCutOverDistance);
            #endregion
        }
        private void InitializeBindings()
        {
            var fluent = mvvmContext1.OfType <LayerCoolingModel>();

            fluent.SetBinding(this.txtCoolingSpeed.PopupEdit, c => c.Text, x => x.CoolingSpeed, m => SpeedUnitConverter.Convert(m), r => SpeedUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtLiftHeight.PopupEdit, c => c.Text, x => x.LiftHeight);
            fluent.SetBinding(this.txtNozzleHeight.PopupEdit, c => c.Text, x => x.NozzleHeight);
            fluent.SetBinding(this.cmbGasKind, c => c.Text, x => x.GasKind);
            fluent.SetBinding(this.txtGasPressure.PopupEdit, c => c.Text, x => x.GasPressure, m => PressureUnitConverter.Convert(m), r => PressureUnitConverter.ConvertBack(r));
            fluent.SetBinding(this.txtUserNotes, c => c.Text, x => x.UserNotes);
        }