public SourcesTabViewModel(ISourceConfigViewModelFactory sourceConfigViewModelFactory, IDerivedSourceConfigViewModelFactory derivedSourceConfigViewModelFactory, ISerialPortListProviderService serialPortListProviderService) { this._sourceCount = 1; this._colorList = new List <string>() { "Red", "Blue", "Green", "Magenta", "Cyan", "Yellow" }; this._sourceConfigViewModelFactory = sourceConfigViewModelFactory; this._derivedSourceConfigViewModelFactory = derivedSourceConfigViewModelFactory; this._serialPortListProviderService = serialPortListProviderService; this.Sources = new ObservableCollection <ISourceConfigViewModel>(); this.DerivedSources = new ObservableCollection <IDerivedSourceConfigViewModel>(); foreach (SerialPortInfo spi in _serialPortListProviderService.GetSerialPortInfos()) { if (spi.Description == "STMicroelectronics STLink Virtual COM Port") { AddNewSource(spi.Name); } } }
public SourceConfigViewModel(IProbeDataReadingService probeDataReadingService, ISerialPortListProviderService serialPortListProviderService, string name, string colorName, string comPort) { _probeDataReadingService = probeDataReadingService; _serialPortListProviderService = serialPortListProviderService; _serialPortListProviderService.SerialPortListUpdated += SerialPortListProviderService_SerialPortListUpdated; _comPortOptions = serialPortListProviderService.GetSerialPortInfos().Select(spi => spi.NameAndDescription).ToList(); _newName = name; _newColor = (Color)ColorConverter.ConvertFromString(colorName); _newColorString = colorName; _newCOMPort = comPort != "" ? serialPortListProviderService.GetSerialPortInfos().First(spi => spi.Name == comPort).NameAndDescription : ""; _newSampleTime = 2; _newXResolution = 1920; _newYResolution = 1080; _newProbeType = "x1"; _newTriggerStatus = "Trigger Off"; _newTriggerType = "Rising Edge"; _newTriggerLevel = 1000; _newAFGStatus = "AFG Off"; _newAFGFrequency = 800; _newAFGAmplitude = 3300; _newAFGWaveform = "Sine Wave"; ApplyChanges(); }
public SourceConfigViewModelFactory(ISerialPortListProviderService serialPortListProviderService, ILoggingService loggingService) { _serialPortListProviderService = serialPortListProviderService; _loggingService = loggingService; }