public Group99SettingsViewModel(IUserInterfaceRoot uiRoot, ILogger logger, IAinSettingsReaderWriter ainSettingsReaderWriter, IAinSettingsReadNotify ainSettingsReadNotify, IAinSettingsStorage ainSettingsStorage, IAinSettingsStorageUpdatedNotify ainSettingsStorageUpdatedNotify, IAinsCounter ainsCounter, IEngineSettingsReader engineSettingsReader, IEngineSettingsWriter engineSettingsWriter, IEngineSettingsReadNotify engineSettingsReadNotify, IEngineSettingsStorage engineSettingsStorage, IEngineSettingsStorageUpdatedNotify engineSettingsStorageUpdatedNotify, ImcwParameterViewModel imcwParameterVm) { _uiRoot = uiRoot; _logger = logger; _ainSettingsReaderWriter = ainSettingsReaderWriter; _ainSettingsReadNotify = ainSettingsReadNotify; _ainSettingsStorage = ainSettingsStorage; _ainSettingsStorageUpdatedNotify = ainSettingsStorageUpdatedNotify; _ainsCounter = ainsCounter; _engineSettingsReader = engineSettingsReader; _engineSettingsWriter = engineSettingsWriter; _engineSettingsReadNotify = engineSettingsReadNotify; _engineSettingsStorage = engineSettingsStorage; _engineSettingsStorageUpdatedNotify = engineSettingsStorageUpdatedNotify; _imcwParameterVm = imcwParameterVm; Parameter01Vm = new ParameterDecimalEditCheckViewModel( "99.01. Номинальное напряжение обмотки статора (действующее) [В]", "f0", 0, 10000); Parameter02Vm = new ParameterDecimalEditCheckViewModel("99.02. Номинальный ток обмотки статора [А]", "f0", 0, 10000); Parameter03Vm = new ParameterDecimalEditCheckViewModel("99.03. Номинальная частота напряжения питающей сети [Гц]", "f1", 8, 300); Parameter04Vm = new ParameterDecimalEditCheckViewModel("99.04. Номинальная скорость вращения двигателя [об/мин]", "f0", 0, 18000); Parameter05Vm = new ParameterDecimalEditCheckViewModel("99.05. Максимальная скорость вращения двигателя [об/мин]", "f0", 0, 18000); Parameter06Vm = new ParameterDecimalEditCheckViewModel("99.06. Номинальная мощность на валу двигателя [кВт]", "f3", 0, 9000); Parameter07Vm = new ParameterComboEditableViewModel <int>("99.07. Режим управления двигателем", new[] { new ComboItemViewModel <int> { ComboText = "Скалярный", ComboValue = 0 }, new ComboItemViewModel <int> { ComboText = "Векторный", ComboValue = 1 } }); Parameter07Vm.PropertyChanged += Parameter07VmOnPropertyChanged; _imcwParameterVm.PropertyChanged += ImcwParameterVmOnPropertyChanged; Parameter08Vm = new ParameterDecimalEditCheckViewModel("99.08. Номинальный коэффициент мощности cos(ϕ)", "f2", 0, 1.0m); Parameter09Vm = new ParameterDecimalEditCheckViewModel("99.09. Номинальный КПД двигателя [%]", "f1", 0, 100.0m); Parameter10Vm = new ParameterDecimalEditCheckViewModel("99.10. Масса двигателя [кг]", "f0", 0, 10000); Parameter11Vm = new ParameterDecimalEditCheckViewModel("99.11. Кратность максимального момента (Mmax/Mnom)", "f0", 0, 10000); Parameter12Vm = new ParameterDecimalEditCheckViewModel("99.12. Конструктивная высота [мм]", "f0", 0, 10000); ReadSettingsCmd = new RelayCommand(ReadSettings, () => true); // TODO: read only when connected to COM WriteSettingsCmd = new RelayCommand(WriteSettings, () => IsWriteEnabled); // TODO: read only when connected to COM _ainSettingsReadNotify.AinSettingsReadComplete += AinSettingsReadNotifyOnAinSettingsReadComplete; _ainSettingsStorageUpdatedNotify.AinSettingsUpdated += (zbAinNuber, settings) => { _uiRoot.Notifier.Notify(() => WriteSettingsCmd.RaiseCanExecuteChanged()); }; _engineSettingsReadNotify.EngineSettingsReadComplete += EngineSettingsReadNotifyOnEngineSettingsReadComplete; _engineSettingsStorageUpdatedNotify.EngineSettingsUpdated += settings => { _uiRoot.Notifier.Notify(() => WriteSettingsCmd.RaiseCanExecuteChanged()); }; }
public Group102SettingsViewModel(IUserInterfaceRoot uiRoot, ILogger logger, IAinSettingsReaderWriter readerWriter, IAinSettingsReadNotify ainSettingsReadNotify, IAinSettingsStorage storage, IAinSettingsStorageUpdatedNotify storageUpdatedNotify, IAinsCounter ainsCounter) { _uiRoot = uiRoot; _logger = logger; _readerWriter = readerWriter; _ainSettingsReadNotify = ainSettingsReadNotify; _storage = storage; _storageUpdatedNotify = storageUpdatedNotify; _ainsCounter = ainsCounter; Parameter01Vm = new ParameterDecimalEditCheckViewModel("102.01. Постоянная времени обмотки ротора, Tr [мс]", "f4", -3.2768m, 3.2767m) { Increment = 0.0001m }; Parameter02Vm = new ParameterDecimalEditCheckViewModel("102.02. Индуктивность намагничивания, Lm [мкГн]", "f5", -0.32768m, 0.32767m) { Increment = 0.00001m }; Parameter03Vm = new ParameterDecimalEditCheckViewModel("102.03. Индуктивность рассеяния обмотки статора, Lsl [мкГн]", "f6", -0.032768m, 0.032768m) { Increment = 0.000001m }; Parameter04Vm = new ParameterDecimalEditCheckViewModel("102.04. Индуктивность рассеяния обмотки ротора, Lrl [мкГн]", "f6", -0.032768m, 0.032768m) { Increment = 0.000001m }; Parameter05Vm = new ParameterDecimalEditCheckViewModel("102.05. Активное сопротивление обмотки статора, Rs [Ом]", "f4", -3.2768m, 3.2767m) { Increment = 0.0001m }; Parameter06Vm = new ParameterDecimalEditCheckViewModel("102.06. Число пар полюсов", "f0", 0, 31); Parameter07Vm = new ParameterComboEditableViewModel <int>("102.07. Число импульсов датчика частоты вращения", new[] { new ComboItemViewModel <int> { ComboText = "256", ComboValue = 0 }, new ComboItemViewModel <int> { ComboText = "512", ComboValue = 1 }, new ComboItemViewModel <int> { ComboText = "1024", ComboValue = 2 }, new ComboItemViewModel <int> { ComboText = "2048", ComboValue = 3 }, new ComboItemViewModel <int> { ComboText = "4096", ComboValue = 4 }, new ComboItemViewModel <int> { ComboText = "8192", ComboValue = 5 }, new ComboItemViewModel <int> { ComboText = "16384", ComboValue = 6 }, new ComboItemViewModel <int> { ComboText = "32768", ComboValue = 7 } }); Parameter08Vm = new ParameterComboEditableViewModel <AinTelemetryFanWorkmode>( "102.08. Режим работы вентилятора", new[] { new ComboItemViewModel <AinTelemetryFanWorkmode> { ComboText = AinTelemetryFanWorkmode.AllwaysOff.ToHumanString(), ComboValue = AinTelemetryFanWorkmode.AllwaysOff }, new ComboItemViewModel <AinTelemetryFanWorkmode> { ComboText = AinTelemetryFanWorkmode.SwitchOnSyncToPwmSwtichOffTwoMinutesLaterAfterPwmOff .ToHumanString(), ComboValue = AinTelemetryFanWorkmode.SwitchOnSyncToPwmSwtichOffTwoMinutesLaterAfterPwmOff }, new ComboItemViewModel <AinTelemetryFanWorkmode> { ComboText = AinTelemetryFanWorkmode.SwitchOnSyncToPwmSwtichOffAfterPwmOffAndTempGoesDownBelow45C .ToHumanString(), ComboValue = AinTelemetryFanWorkmode .SwitchOnSyncToPwmSwtichOffAfterPwmOffAndTempGoesDownBelow45C }, new ComboItemViewModel <AinTelemetryFanWorkmode> { ComboText = AinTelemetryFanWorkmode.AllwaysOn.ToHumanString(), ComboValue = AinTelemetryFanWorkmode.AllwaysOn } }); Parameter09Vm = new ParameterBooleanEditCheckViewModel("102.09. Намагничивание постоянным током", "Нет", "Да"); ReadSettingsCmd = new RelayCommand(ReadSettings, () => true); // TODO: read only when connected to COM WriteSettingsCmd = new RelayCommand(WriteSettings, () => IsWriteEnabled); // TODO: read only when connected to COM _ainSettingsReadNotify.AinSettingsReadComplete += AinSettingsReadNotifyOnAinSettingsReadComplete; _storageUpdatedNotify.AinSettingsUpdated += (zbAinNuber, settings) => { _uiRoot.Notifier.Notify(() => WriteSettingsCmd.RaiseCanExecuteChanged()); }; }