コード例 #1
0
        public BlockScanViewModel(RadioModel model, RadioViewModel view)
        {
            _model    = model;
            _mainView = view;

            _model.Radio.BlockScanner().FrequencyScanned += BlockScanViewModel_FrequencyScanned;
            _model.Radio.BlockScanner().ScanFinished     += BlockScanViewModel_ScanFinished;

            FromValue    = (uint)_model.Radio.CachedInfo.MinFrequency;
            ToValue      = (uint)_model.Radio.CachedInfo.MaxFrequency;
            SquelchValue = -85;
            ScanInfo     = OFFLINE;

            CommandScan = new DelegateCommand(() => TaskUtility.Run(() =>
            {
                if (ScanState)
                {
                    _model.PauseStreams();
                    _model.Radio.BlockScanner().Start(FrequncyCollection());
                }
                else
                {
                    _model.Radio.BlockScanner().Stop();
                }
            }));
        }
コード例 #2
0
        public SweeperViewModel(RadioModel model, RadioViewModel view)
        {
            _model    = model;
            _mainView = view;

            _mainView.SweeperAnalyzer.SelectedValueChanged += SweeperAnalyzer_SelectedValueChanged;

            CommandSweep = new DelegateCommand(StartSweep);

            FromValue      = (uint)_model.Radio.CachedInfo.MinFrequency;
            ToValue        = (uint)_model.Radio.CachedInfo.MaxFrequency;
            PrecisionValue = 31.25;
        }
コード例 #3
0
        public MemoryViewModel(RadioModel model, RadioViewModel view)
        {
            _mainView = view;
            _model    = model;

            SelectFirst();

            CommandSave = new DelegateCommand(() =>
            {
                SelectedMemory = new MemorySlot();

                SelectedName        = string.Format("{0} {1}", _model.Radio.Demodulator().Mode(), (_model.Radio.Frequency() / 1000).ToString("#.00"));
                SelectedFrequency   = _model.Radio.Frequency();
                SelectedIfBandwidth = _model.Radio.Demodulator().IfBandwidth();
                SelectedIfShift     = _model.Radio.Demodulator().IfShift();
                SelectedSquelch     = _mainView.SquelchValue;
                SelectedMode        = _model.Radio.Demodulator().Mode();

                _model.Memory.Add(SelectedMemory);
                _model.Memory.Save();
            });

            CommandLoad = new DelegateCommand(() =>
            {
                if (_selected.Frequency == default(uint))
                {
                    return;
                }

                _mainView.ModeState        = _selected.Mode;
                _mainView.FrequencyValue   = _selected.Frequency;
                _mainView.IfBandwidthValue = _selected.IfBandwidth;
                _mainView.IfShiftValue     = _selected.IfShift;
                _mainView.SquelchValue     = _selected.Squelch;
            });

            CommandNext = new DelegateCommand(() =>
            {
                if (_model.Memory.Count == 0)
                {
                    return;
                }

                var index = _model.Memory.IndexOf(SelectedMemory);
                if (index == -1)
                {
                    return;
                }

                index++;

                index = index >= _model.Memory.Count - 1 ? _model.Memory.Count - 1 : index;

                SelectedMemory = _model.Memory[index];
                //CommandLoad.Execute(null);
            });

            CommandPrevious = new DelegateCommand(() =>
            {
                if (_model.Memory.Count == 0)
                {
                    return;
                }

                var index = _model.Memory.IndexOf(SelectedMemory);
                if (index == -1)
                {
                    return;
                }

                index--;

                index = index <= 0 ? 0 : index;

                SelectedMemory = _model.Memory[index];
                //CommandLoad.Execute(null);
            });

            CommandLast = new DelegateCommand(() =>
            {
                if (_model.Memory.Count == 0)
                {
                    return;
                }

                SelectedMemory = _model.Memory[_model.Memory.Count - 1];
                //CommandLoad.Execute(null);
            });

            CommandFirst = new DelegateCommand(() =>
            {
                if (_model.Memory.Count == 0)
                {
                    return;
                }

                SelectedMemory = _model.Memory[0];
                //CommandLoad.Execute(null);
            });

            CommandDelete = new DelegateCommand(() =>
            {
                _model.Memory.Remove(SelectedMemory);
                _model.Memory.Save();
                SelectFirst();
            });

            CommandDeleteAll = new DelegateCommand(() =>
            {
                _model.Memory.Clear();
                _model.Memory.Save();
                SelectFirst();
            });
        }