Beispiel #1
0
 private void vfoFrequencyEdit_FrequencyChanging(object sender, FrequencyChangingEventArgs e)
 {
     if ((SourceIsWaveFile || SourceIsSoundCard))
     {
         if (!_initializing)
         {
             if (e.Frequency > _centerFrequency + _vfo.SampleRate * 0.5f + _frequencyShift)
             {
                 e.Frequency = (long) (_centerFrequency + _vfo.SampleRate * 0.5f + _frequencyShift);
             }
             else if (e.Frequency < _centerFrequency - _vfo.SampleRate * 0.5f + _frequencyShift)
             {
                 e.Frequency = (long) (_centerFrequency - _vfo.SampleRate * 0.5f + _frequencyShift);
             }
             if (SourceIsSoundCard)
             {
                 waterfall.CenterFrequency = _frequencyShift;
                 spectrumAnalyzer.CenterFrequency = _frequencyShift;
             }
         }
         return;
     }
     var delta = e.Frequency - vfoFrequencyEdit.Frequency;
     var lowerMargin = (e.Frequency - _vfo.Bandwidth * 0.5f) - (_centerFrequency - 0.5f * _vfo.SampleRate + _frequencyShift);
     var upperMargin = (_centerFrequency + 0.5f * _vfo.SampleRate + _frequencyShift) - (e.Frequency + _vfo.Bandwidth * 0.5f);
     if ((Math.Abs(delta) > _centerScrollLimit && _changingFrequencyByScroll) || (Math.Abs(delta) > _centerScrollLimit && !_changingFrequencyByDirectSelection) || (delta < 0 && lowerMargin < 0) || (delta > 0 && upperMargin < 0))
     {
         if (!_changingFrequency && !_initializing)
         {
             _changingFrequency = true;
             SetCenterFrequency(_centerFrequency + delta);
             _changingFrequency = false;
         }
     }
 }
Beispiel #2
0
 private void vfoFrequencyEdit_FrequencyChanging(object sender, FrequencyChangingEventArgs e)
 {
     if (this._initializing)
     return;
       if (!this.SourceIsTunable)
       {
     if ((double) e.Frequency > (double) this._centerFrequency + this._vfo.SampleRate * 0.5 + (double) this._frequencyShift)
       e.Frequency = (long) ((double) this._centerFrequency + this._vfo.SampleRate * 0.5 + (double) this._frequencyShift);
     else if ((double) e.Frequency < (double) this._centerFrequency - this._vfo.SampleRate * 0.5 + (double) this._frequencyShift)
       e.Frequency = (long) ((double) this._centerFrequency - this._vfo.SampleRate * 0.5 + (double) this._frequencyShift);
     if (!this.SourceIsSoundCard)
       return;
     this.waterfall.CenterFrequency = this._frequencyShift;
     this.spectrumAnalyzer.CenterFrequency = this._frequencyShift;
       }
       else
       {
     long frequency = e.Frequency;
     long num1 = frequency - this.vfoFrequencyEdit.Frequency;
     double num2 = (double) frequency - (double) this._vfo.Bandwidth * 0.5 - ((double) this._centerFrequency - 0.5 * this._vfo.SampleRate + (double) this._frequencyShift);
     double num3 = (double) this._centerFrequency + 0.5 * this._vfo.SampleRate + (double) this._frequencyShift - ((double) frequency + (double) this._vfo.Bandwidth * 0.5);
     if ((this._tuningStyle != MainForm.TuningStyle.Center && this._tuningStyle != MainForm.TuningStyle.Sticky || !this._changingFrequencyByScroll) && (this._tuningStyle != MainForm.TuningStyle.Center && this._tuningStyle != MainForm.TuningStyle.Sticky || this._changingFrequencyByDirectSelection) && ((num1 >= 0L || num2 >= 0.0) && (num1 <= 0L || num3 >= 0.0)) || this._changingFrequency)
       return;
     this._changingFrequency = true;
     this.SetCenterFrequency(this._centerFrequency + num1);
     this._changingFrequency = false;
       }
 }