Esempio n. 1
0
        private void SliderValueChangedHandler(object sender, EventArgs e)
        {
            try
            {
                if (this.sliderCtrl.Slider.Value <= 10 && this.sliderCtrl.Slider.Value > 1)
                {
                    var v = this.sliderCtrl.Slider.Value / 10f;
                }

                PulseValue = this.sliderCtrl.Slider.Value / 10f;
                Program.SysConfig.LaserConfig.PulseWidth = PulseValue;
                double y = CalXY((float)PulseValue);
                this.sliderCtrl.PulseHole.Text = string.Format("{0:N}us {1:N}um", PulseValue, y);

                CheckPulse(PulseValue);

                if (graphicsProperties != null && Program.SysConfig.LaserConfig != null)
                {
                    Program.SysConfig.LaserConfig.UpdatePulseWidth((float)y);
                }
                this.sliderCtrl.Update = false;
                if (UpdateSliderValueHandler != null)
                {
                    UpdateSliderValueHandler?.Invoke((float)(PulseValue));
                }
                this.textBox.Select();
                this.textBox.Focus();
                this.sliderCtrl.Update = true;
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 2
0
        private void RecalculateSliderValue()
        {
            try
            {
                var value = Double.Parse(this.comboBoxEx1.SelectedItem.ToString());
                PulseValue = value;
                this.sliderCtrl.Slider.Value             = (int)(PulseValue * 10);
                Program.SysConfig.LaserConfig.PulseWidth = PulseValue;
                //double y = CalSlopeFunction(PulseValue);
                double y = CalXY((float)PulseValue);
                this.sliderCtrl.PulseHole.Text = string.Format("{0:N}us {1:N}um", PulseValue, y);

                CheckPulse(PulseValue);

                if (graphicsProperties != null && Program.SysConfig.LaserConfig != null)
                {
                    Program.SysConfig.LaserConfig.UpdatePulseWidth((float)y);
                }
                this.sliderCtrl.Update = false;
                if (UpdateSliderValueHandler != null)
                {
                    UpdateSliderValueHandler?.Invoke((float)(PulseValue));
                }


                this.sliderCtrl.Update = true;
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 3
0
        private void PulseSliderValueChangedHandler(object sender, EventArgs e)
        {
            var value = this.sliderPulse.Slider.Value;
            var x     = value / 10f;

            this.sliderPulse.PulseHole.Text = string.Format("{0:N} us", x);
            //this.sliderPulse.SetValue(x);
            CalXY(x);
            if (this.graphicsProperties != null)
            {
                Program.SysConfig.LaserConfig.UpdatePulseWidth(CurrentPoint.Y);
            }
            this.sliderPulse.Update = false;
            UpdateSliderValueHandler?.Invoke(x);
            this.sliderPulse.Update = true;
            SaveDeleteButtonVisiable(CheckPoint(x));
        }
Esempio n. 4
0
        private void SliderValueChangedHandler(object sender, EventArgs e)
        {
            var    value = this.sliderCtrl.Slider.Value;
            double y     = CalSlopeFunction(value);

            this.sliderCtrl.PulseHole.Text = string.Format("{0:N}ms {1:N}um", value / 1000d, y);

            CheckPulse((int)y);

            if (graphicsProperties != null && SysConfig.GetSysConfig().LaserConfig != null)
            {
                SysConfig.GetSysConfig().LaserConfig.UpdatePulseWidth((float)y);
            }
            this.sliderCtrl.Update = false;
            UpdateSliderValueHandler?.Invoke(value / 1000f);
            this.sliderCtrl.Update = true;
        }
Esempio n. 5
0
 private void chart1_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left && findPoint)
     {
         var dataPoints = this.chart1.Series[0].Points;
         if (dataPoints != null && dataPoints.Count > 0)
         {
             for (int i = 0; i < dataPoints.Count; i++)
             {
                 if (Math.Abs(valueToFindX - dataPoints[i].XValue) < 0.01)
                 {
                     dataPoints[i].MarkerStyle = MarkerStyle.Circle;
                     dataPoints[i].MarkerColor = Color.Red;
                     dataPoints[i].MarkerSize  = 10;
                     CurrentPoint = new HolePulsePoint((float)dataPoints[i].XValue, (float)dataPoints[i].YValues[0]);
                     int index = Program.SysConfig.LaserConfig.HolePulsePoints.FindIndex(p => p.X == CurrentPoint.X);
                     if (index != 0 && index != Program.SysConfig.LaserConfig.HolePulsePoints.Count - 1)
                     {
                         SaveDeleteButtonVisiable(true);
                     }
                     this.sliderPulse.Update = false;
                     this.sliderPulse.SetValue(CurrentPoint.X);
                     if (this.graphicsProperties != null)
                     {
                         Program.SysConfig.LaserConfig.UpdatePulseWidth(CurrentPoint.Y);
                     }
                     UpdateSliderValueHandler?.Invoke(CurrentPoint.X);
                     this.sliderPulse.Update = true;
                 }
                 else
                 {
                     dataPoints[i].MarkerSize  = 10;
                     dataPoints[i].MarkerColor = Color.DarkGreen;
                 }
             }
             this.chart1.Invalidate();
         }
     }
 }
Esempio n. 6
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int index = Program.SysConfig.LaserConfig.HolePulsePoints.FindIndex(p => p.X == CurrentPoint.X);

            if (index == 0 || index == Program.SysConfig.LaserConfig.HolePulsePoints.Count - 1)
            {
                return;
            }
            RemovePoint(CurrentPoint);
            SaveDeleteButtonVisiable(false);
            this.sliderPulse.SetValue(CurrentPoint.X);
            this.sliderPulse.PulseHole.Text = string.Format("{0:N} us", CurrentPoint.X);
            //this.sliderPulse.SetValue(x);
            CalXY(CurrentPoint.X);
            if (this.graphicsProperties != null)
            {
                Program.SysConfig.LaserConfig.UpdatePulseWidth(CurrentPoint.Y);
            }
            this.sliderPulse.Update = false;
            UpdateSliderValueHandler?.Invoke(CurrentPoint.X);
            this.sliderPulse.Update = true;
        }