private void updateV() { if (ValuesCompare.NotEqualDelta1.compare(mValue, mDoubleValue.ValueDouble)) { mValue = mDoubleValue.ValueDouble; if (Double.IsNaN(mValue) == false && Double.IsInfinity(mValue) == false) { double lValue = mValueScale.unscale(mDoubleValue.ValueDouble); if (lValue > sliderControl.Maximum) { lValue = sliderControl.Maximum; } else if (lValue < sliderControl.Minimum) { lValue = sliderControl.Minimum; } mNoUpdate = true; try { sliderControl.Value = Convert.ToInt32(lValue); } finally { mNoUpdate = false; } } } checkFault(); }
public void getItemValues(out int[] aItemHandles, out object[] aItemValues) { bool lValueChanged = mValueChanged; mValueChanged = false; List <int> lHandles = new List <int>(); List <object> lValues = new List <object>(); if (mFault) { lHandles.Add(mValueItemHandle); lValues.Add(mFaultValue); } else { if (mValueChangedByUI || lValueChanged == false) { mValueChangedByUI = false; lHandles.Add(mValueItemHandle); lValues.Add(mValueScale.unscale(mValue)); } } for (int i = 0; i < mThdItemHandles.Length; i++) { lHandles.Add(mThdItemHandles[i]); lValues.Add(mThdItemValues[i]); } aItemHandles = lHandles.ToArray(); aItemValues = lValues.ToArray(); }
public object unconvertValue(object aValue) { double lValue; try { lValue = Convert.ToDouble(aValue); } catch (Exception lExc) { throw new InvalidOperationException("Value conversion error. " + lExc.Message, lExc); } return(mValueScale.unscale(lValue)); }
private void updateV() { if (ValuesCompare.NotEqualDelta1.compare(mValue, mDoubleValue.ValueDouble)) { mValue = mDoubleValue.ValueDouble; if (Double.IsNaN(mValue) == false && Double.IsInfinity(mValue) == false) { double lValue = mValueScale.unscale(mDoubleValue.ValueDouble); if (lValue > mValueScale.InMax) { lValue = mValueScale.InMax; } else if (lValue < mValueScale.InMin) { lValue = mValueScale.InMin; } mProgressBar.Value = Convert.ToInt32(lValue); } } }
public void onItemValueChange(int aItemHandle, object aItemValue) { if (aItemHandle == mInValueItemHandle) { double lNewInValue; double lNewOutValue; try { lNewInValue = Convert.ToDouble(aItemValue); if (lNewInValue > mValueScale.InMax || lNewInValue < mValueScale.InMin) { throw new ArgumentException("Value is out of range. "); } lNewOutValue = mValueScale.scale(lNewInValue); } catch (Exception lExc) { throw new ArgumentException("Input value conversion error. ", lExc); } mInValue = lNewInValue; if (ValuesCompare.NotEqualDelta1.compare(lNewOutValue, mOutValue)) { mOutValue = lNewOutValue; mOutValueChanged = true; mValueChanged = true; raiseValuesChanged(); } return; } if (aItemHandle == mOutValueItemHandle) { double lNewInValue; double lNewOutValue; try { lNewOutValue = Convert.ToDouble(aItemValue); if (lNewOutValue > mValueScale.OutMax || lNewOutValue < mValueScale.OutMin) { throw new ArgumentException("Value is out of range. "); } lNewInValue = mValueScale.unscale(lNewOutValue); } catch (Exception lExc) { throw new ArgumentException("Output value conversion error. ", lExc); } mOutValue = lNewOutValue; if (ValuesCompare.NotEqualDelta1.compare(lNewInValue, mInValue)) { mInValue = lNewInValue; mInValueChanged = true; mValueChanged = true; raiseValuesChanged(); } return; } }
public void getItemValues(out int[] aItemHandles, out object[] aItemValues) { bool lValueChanged = mValueChanged; mValueChanged = false; List <int> lHandles = new List <int>(); List <object> lValues = new List <object>(); if (mMovingItemHandle != -1) { lHandles.Add(mMovingItemHandle); lValues.Add(mMoving); } if (mAlarmItemHandle != -1) { if (!lValueChanged || mAlarmChanged) { mAlarmChanged = false; lHandles.Add(mAlarmItemHandle); lValues.Add(mAlarm); } } if (mReverseItemHandle != -1) { if (!lValueChanged || mReverseChanged) { mReverseChanged = false; lHandles.Add(mReverseItemHandle); lValues.Add(mReverse); } } if (mAccelerationItemHandle != -1) { lHandles.Add(mAccelerationItemHandle); lValues.Add(mAcceleration); } if (mBrakingItemHandle != -1) { lHandles.Add(mBrakingItemHandle); lValues.Add(mBraking); } if (mSpeedItemHandle != -1) { lHandles.Add(mSpeedItemHandle); lValues.Add(mSpeedScale.unscale(mSpeed)); } if (mForwardItemHandle != -1) { lHandles.Add(mForwardItemHandle); lValues.Add(mForward); } if (mBackwardItemHandle != -1) { lHandles.Add(mBackwardItemHandle); lValues.Add(mBackward); } aItemHandles = lHandles.ToArray(); aItemValues = lValues.ToArray(); }