private void Gauge_PointerPositionChange(object sender, GaugeEventArgs e) { var index = e.PointerPosition.PointerIndex; double value; if (index == 0) { firstMarkerValue = (float)e.PointerPosition.PointerValue; value = Math.Abs(firstMarkerValue - secondMarkerValue); } else { secondMarkerValue = (float)e.PointerPosition.PointerValue; value = Math.Abs(secondMarkerValue - markerPointer1.Value); } range.StartValue = firstMarkerValue; range.EndValue = secondMarkerValue; CalculateTimeDifference(value); }
private void _LTC2943Service_OnGaugeChanged(GaugeEventArgs args) { if (args.LedOn) { imgLed.Invoke(new Action(() => imgLed.Image = Properties.Resources.led_red_control_hi)); } else { imgLed.Invoke(new Action(() => imgLed.Image = Properties.Resources.led_off_control_hi)); } pbCharge.Invoke(new Action(() => pbCharge.Value = (int)args.ChargePercentage)); lblPercentage.Invoke(new Action(() => lblPercentage.Text = String.Format("{0} %", args.ChargePercentage))); lblRemTime.Invoke(new Action(() => lblRemTime.Text = args.RemainingTime.ToString(@"hh\:mm"))); pbCurrent.Invoke(new Action(() => pbCurrent.Value = (int)Math.Abs(args.Current.Milliamperes))); pbVoltage.Invoke(new Action(() => pbVoltage.Value = (int)args.Voltage.VoltsDc)); //pbTemperature.Invoke(new Action(() => pbTemperature.Value = (int)Math.Abs(args.Temperature.DegreesCelsius))); double A = args.Current.Amperes; lblAmpere.Invoke(new Action(() => lblAmpere.Text = String.Format("{0:0.00} A", A))); double V = args.Voltage.VoltsDc; lblVolt.Invoke(new Action(() => lblVolt.Text = String.Format("{0:0.00} V", V))); double T = args.Temperature.DegreesCelsius; lblTemp.Invoke(new Action(() => lblTemp.Text = String.Format("{0:0.0}° C", T))); checkBox1.Invoke(new Action(() => checkBox1.Checked = (args.Status & 1) == 1)); checkBox2.Invoke(new Action(() => checkBox2.Checked = (args.Status & 2) == 2)); checkBox3.Invoke(new Action(() => checkBox3.Checked = (args.Status & 4) == 4)); checkBox4.Invoke(new Action(() => checkBox4.Checked = (args.Status & 8) == 8)); checkBox5.Invoke(new Action(() => checkBox5.Checked = (args.Status & 16) == 16)); checkBox6.Invoke(new Action(() => checkBox6.Checked = (args.Status & 32) == 32)); checkBox7.Invoke(new Action(() => checkBox7.Checked = (args.Status & 64) == 64)); checkBox8.Invoke(new Action(() => checkBox8.Checked = (args.Status & 128) == 128)); }