Пример #1
0
 private void SetValueRangeAndBundaryColor(SetValueRange frm, bool isFirstLoad)
 {
     try
     {
         _useCustomValueRange = false;
         if (!isFirstLoad)
         {
             _minValue   = frm.MinValue;
             _maxValue   = frm.MaxValue;
             _colorArray = frm.ColorArray;
             _valueArray = frm.ValueArray;
             SetValueRange(_minValue, _maxValue, isFirstLoad);
         }
         else
         {
             SetValueRange(_minPlotValue, _maxPlotValue, isFirstLoad);
         }
         _useCustomValueRange = true;
         OnCustomizeValueRange(this, null);
         this.Invalidate();
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }
Пример #2
0
 protected void OnValueRangeChanged(SetValueRange frm)
 {
     if (ValueRangeChanged != null)
     {
         ValueRangeChanged(frm);
     }
 }
Пример #3
0
 private void SetValueRange_ValueRangeChanged(SetValueRange frm)
 {
     try
     {
         SetValueRangeAndBundaryColor(frm, false);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }
Пример #4
0
        protected override void OnDoubleClick(EventArgs e)
        {
            try
            {
                SetValueRange frm = new SetValueRange();
                frm.MinValue = _minValue;
                frm.MaxValue = _maxValue;

                frm.Unit       = lblUnit.Text;
                frm.ValueArray = _valueArray;
                frm.ColorArray = _colorArray;
                bool isFirstLoad = false;
                if (double.IsNaN(_minPlotValue))
                {
                    _minPlotValue = _minValue;
                    _maxPlotValue = _maxValue;
                }

                frm.ValueRangeChanged += SetValueRange_ValueRangeChanged;

                DialogResult rtn = frm.ShowDialog();
                if (rtn == DialogResult.OK)
                {
                    isFirstLoad = false;
                    SetValueRangeAndBundaryColor(frm, isFirstLoad);
                }
                else if (rtn == DialogResult.Ignore)
                {
                    isFirstLoad = true;
                    SetValueRangeAndBundaryColor(frm, isFirstLoad);
                }

                frm.Dispose();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
            finally
            {
                base.OnDoubleClick(e);
            }
        }