示例#1
0
        public void RefreshChannelItems()
        {
            List <ChannelConfig> channels = SoftPanelGlobalInfo.GetInstance().Channels.FindAll(item => item.Enabled);

            if (channels.Count == metroComboBox_signal1.Items.Count && channels.All(item => metroComboBox_signal1.Items.Contains(item.ChannelName)))
            {
                return;
            }
            string signal1 = metroComboBox_signal1.Text;
            string signal2 = metroComboBox_signal2.Text;

            metroComboBox_signal1.Items.Clear();
            metroComboBox_signal2.Items.Clear();
            foreach (ChannelConfig channel in channels)
            {
                metroComboBox_signal1.Items.Add(channel.ChannelName);
                metroComboBox_signal2.Items.Add(channel.ChannelName);
            }
            if (channels.Count > 0 && (!metroComboBox_signal1.Items.Contains(signal1) || string.IsNullOrEmpty(signal1)))
            {
                metroComboBox_signal1.SelectedIndex = 0;
            }

            if (channels.Count > 0 && (string.IsNullOrEmpty(signal2) || !metroComboBox_signal2.Items.Contains(signal2)))
            {
                metroComboBox_signal2.SelectedIndex = 0;
            }
        }
示例#2
0
 public FunctionTask(DsaSoftPanelForm parentForm)
 {
     _globalInfo       = SoftPanelGlobalInfo.GetInstance();
     this._dataBuf     = new List <double>(Constants.DefaultDisplayBufSize);
     this._parentForm  = parentForm;
     this.FunctionType = FunctionType.None;
     this._measure     = new MeasureHandler();
 }
示例#3
0
 public ChannelViewManager(DsaSoftPanelForm parentForm, params Label[] channelButtons)
 {
     this._parentForm           = parentForm;
     this._parentControl        = parentForm.txTabControl_channel;
     this._globalInfo           = SoftPanelGlobalInfo.GetInstance();
     this._globalInfo.ShowRange = ShowMaxAndMin;
     // to fix init error
     _parentControl.TabPages.Clear();
     _parentControl.SelectedIndex = 0;
     foreach (Label channelButton in channelButtons)
     {
         channelButton.Click += ChannelButtonOnClick;
         _channelButtons.Add(channelButton);
     }
 }
示例#4
0
        public void RefreshChannelItems()
        {
            List <ChannelConfig> channels = SoftPanelGlobalInfo.GetInstance().Channels.FindAll(item => item.Enabled);

            if (channels.Count == metroComboBox_signal1.Items.Count && channels.All(item => metroComboBox_signal1.Items.Contains(item.ChannelName)))
            {
                return;
            }
            metroComboBox_signal1.Items.Clear();
            metroComboBox_signal2.Items.Clear();
            foreach (ChannelConfig channel in channels)
            {
                metroComboBox_signal1.Items.Add(channel.ChannelName);
                metroComboBox_signal2.Items.Add(channel.ChannelName);
            }
            metroComboBox_signal1.SelectedIndex      = 0;
            this.metroComboBox_signal2.SelectedIndex = channels.Count >= 2 ? 1 : 0;
        }
示例#5
0
        private void RefreshCoefficient()
        {
            double[]            coefficient = null;
            SoftPanelGlobalInfo globalInfo  = SoftPanelGlobalInfo.GetInstance();
            FilterType          type        = (FilterType)Enum.Parse(typeof(FilterType), metroComboBox_type.Text);
            double lowCutoff  = double.Parse(textBox_lowerCutoff.Text);
            double highCutoff = double.Parse(textBox_highCutoff.Text);

            switch (type)
            {
            case FilterType.LowPass:
                coefficient = FirCoefficients.LowPass(globalInfo.SampleRate, lowCutoff);
                break;

            case FilterType.HighPass:
                coefficient = FirCoefficients.HighPass(globalInfo.SampleRate, highCutoff);
                break;

            case FilterType.BandPass:
                if (lowCutoff > highCutoff)
                {
                    double tmp = lowCutoff;
                    lowCutoff  = highCutoff;
                    highCutoff = tmp;
                }
                coefficient = FirCoefficients.BandPass(globalInfo.SampleRate, lowCutoff, highCutoff);
                break;

            case FilterType.BandStop:
                if (lowCutoff > highCutoff)
                {
                    double tmp = lowCutoff;
                    lowCutoff  = highCutoff;
                    highCutoff = tmp;
                }
                coefficient = FirCoefficients.BandStop(globalInfo.SampleRate, lowCutoff, highCutoff);
                break;
            }
            _filter = new OnlineFirFilter(coefficient);
        }
示例#6
0
 public MeasureTask(DsaSoftPanelForm parentForm)
 {
     Measures = new Dictionary <MeasureType, string>(Enum.GetNames(typeof(MeasureType)).Length);
     _oscilloscopeGlobalInfo = SoftPanelGlobalInfo.GetInstance();
     this._parentForm        = parentForm;
 }
示例#7
0
 protected FunctionBase(List <double> dataBuf)
 {
     GlobalInfo = SoftPanelGlobalInfo.GetInstance();
     DataBuf    = dataBuf;
 }
示例#8
0
 protected FunctionBase(List <double[]> dataBuf)
 {
     this.GlobalInfo = SoftPanelGlobalInfo.GetInstance();
     this.DataBuf    = dataBuf;
 }
示例#9
0
 public MeasureHandler()
 {
     Measures = new Dictionary <MeasureType, string>(Enum.GetNames(typeof(MeasureType)).Length);
     _oscilloscopeGlobalInfo = SoftPanelGlobalInfo.GetInstance();
 }
示例#10
0
 public TaskBase()
 {
     _lastUsedVersion = long.MinValue;
     this.DataCache   = new List <double[]>(8);
     _globalInfo      = SoftPanelGlobalInfo.GetInstance();
 }