private void UpdateFrequency(long f, FrequencyChangeSource source)
        {
            var min = (long)(_displayCenterFrequency - _spectrumWidth / _scale / 2);

            if (f < min)
            {
                f = min;
            }
            var max = (long)(_displayCenterFrequency + _spectrumWidth / _scale / 2);

            if (f > max)
            {
                f = max;
            }

            if (_useSnap)
            {
                f = (f + Math.Sign(f) * _stepSize / 2) / _stepSize * _stepSize;
            }

            if (f != _frequency)
            {
                var args = new FrequencyEventArgs(f, source);
                OnFrequencyChanged(args);
                if (!args.Cancel)
                {
                    _frequency     = args.Frequency;
                    _performNeeded = true;
                }
            }
        }
        private void UpdateCenterFrequency(long f, FrequencyChangeSource source)
        {
            if (f < 0)
            {
                f = 0;
            }

            if (_useSnap)
            {
                f = (f + Math.Sign(f) * _stepSize / 2) / _stepSize * _stepSize;
            }

            if (f != _centerFrequency)
            {
                var args = new FrequencyEventArgs(f, source);
                OnCenterFrequencyChanged(args);
                if (!args.Cancel)
                {
                    var delta = args.Frequency - _centerFrequency;
                    _displayCenterFrequency += delta;

                    _centerFrequency      = args.Frequency;
                    _drawBackgroundNeeded = true;
                }
            }
        }
 protected virtual void OnCenterFrequencyChanged(FrequencyEventArgs e)
 {
     if (CenterFrequencyChanged != null)
     {
         CenterFrequencyChanged(this, e);
     }
 }