public Freeze100Test(IWorker <Action> sharedTestsWorker, ICmdListener <IMukFanVaporizerDataReply03> evaporator03Listener, ICmdListener <IMukFlapWinterSummerReply03Telemetry> mukFlapWinterSummerReply03Listener, Timer sharedTestTimer, IParameterSetter parameterSetter) { _sharedTestsWorker = sharedTestsWorker; _evaporator03Listener = evaporator03Listener; _mukFlapWinterSummerReply03Listener = mukFlapWinterSummerReply03Listener; _sharedTestTimer = sharedTestTimer; _parameterSetter = parameterSetter; _sharedTestTimer.Elapsed += SharedTestTimerOnElapsed; _evaporator03Listener.DataReceived += Evaporator03ListenerOnDataReceived; _isTestCanceledSync = new object(); _isTestCanceled = false; _isTestRunningSync = new object(); _isTestRunning = false; _timeSync = new object(); _testTimeout = TimeSpan.FromSeconds(5.0); _lastReceivedDataSyncMukFanVaporizer03Reply = new object(); _lastReceivedDataMukFanVaporizer03Reply = null; _testCompleteSync = new object(); _testComplete = null; _progressChangedSync = new object(); _progressChanged = null; }
public MukWarmFloorSetParamsViewModel(IThreadNotifier uiNotifier, IParameterSetter parameterSetter) { SettableParam519 = new SettableParameterViewModel(519, "5.19 Резерв", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam520 = new SettableParameterViewModel(520, "5.20 Резерв", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam521 = new SettableParameterViewModel(521, "5.21 Резерв", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam522 = new SettableParameterViewModel(522, "5.22 Резерв", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); }
public ParameterVMsHolder(IParametersPresenterXmlBuilder ppBuilder, IPsnParamsList psnParamsList, IParamListener paramListener, IThreadNotifier uiNotifier, IParameterLogger parameterLogger, IParameterSetter parameterSetter) { var paramsPresenter = ppBuilder.BuildParametersPresentationFromXml(); var parameters = new Dictionary <string, IParameterViewModel>(); foreach (var paramDescriptionAndKey in paramsPresenter.Parameters) { var key = paramDescriptionAndKey.Key; var description = paramDescriptionAndKey.Value; var configuration = psnParamsList.PsnProtocolConfigurationParams[description.Identifier]; parameters.Add( key, new ParameterViewModelSimple(description.CustomName, configuration.Item2.Name, new ParameterGetterViewModelSimple( description.Identifier, paramListener, uiNotifier, description.View, parameterLogger, configuration.Item2.IsBitSignal, configuration.Item1.PartName + ": " + configuration.Item2.Name), description.Injection == null ? null : new ParameterSetterViewModelSimple(parameterSetter, uiNotifier, description.Injection))); } Parameters = parameters; }
public ParameterSetterViewModelSimple(IParameterSetter parameterSetter, IThreadNotifier uiNotifier, IParameterInjectionConfiguration injectionConfiguration) { _uiNotifier = uiNotifier; CustomValueList = injectionConfiguration.PreselectedValueList; _lastSet = LastSetStateResult.Unknown; // TODO: follow https://reactiveui.net/docs/guidelines/framework/prefer-oaph-over-properties var x = this.WhenAnyValue(vm => vm.SelectedValue).Subscribe(val => Value = val.Value); _setValue = ReactiveCommand.Create(() => { Console.WriteLine($"Setting for param {injectionConfiguration.ZeroBasedParameterNumber} value " + injectionConfiguration.GetValue(_value)); parameterSetter.SetParameterAsync(injectionConfiguration.ZeroBasedParameterNumber, injectionConfiguration.GetValue(_value), ex => { _uiNotifier.Notify(() => { if (ex != null) { LastSet = LastSetStateResult.Unsuccess; } else { LastSet = LastSetStateResult.Success; } }); }); }); }
public MukVaporizerSetParamsViewModel(IThreadNotifier uiNotifier, IParameterSetter parameterSetter) { SettableParam324 = new SettableParameterViewModel(324, "Zone зона нечувствительности ПИДа", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam325 = new SettableParameterViewModel(325, "Td дифференциальная составляющая", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam326 = new SettableParameterViewModel(326, "Kp коеффициент пропорциональности", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam327 = new SettableParameterViewModel(327, "T_i интегральная составляющая", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam328 = new SettableParameterViewModel(328, "T_0 время вызова ПИДа", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam329 = new SettableParameterViewModel(329, "Ручной/автоматический режим. 1 = ручной режим", 1.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam330 = new SettableParameterViewModel(330, "Уставка уровень вентилир.в ручном режиме 0 - 4", 4.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam331 = new SettableParameterViewModel(331, "Уровень вентилирования 1 в режиме настройки; 0-255", 255.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam332 = new SettableParameterViewModel(332, "Уровень вентилирования 2 в режиме настройки; 0-255", 255.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam333 = new SettableParameterViewModel(333, "Уровень вентилирования 3 в режиме настройки; 0-255", 255.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam334 = new SettableParameterViewModel(334, "Уровень вентилирования 4 в режиме настройки; 0-255", 255.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam335 = new SettableParameterViewModel(335, "Настроечный параметр регулятора отопления", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); }
public void SetParameter(IParameterSetter setter, object parameter) { if (parameter == null) { setter.Value = null; } setter.Value = parameter.ToString(); }
public TabInterfaceBuilder(IThreadNotifier mainWindowUiUiNotifier, ICmdListener <IList <byte> > cmdListenerWinSum03Reply, ICmdListener <IMukFlapAirWinterSummerRequest16Data> cmdListener16Request, IParameterLogger parameterLogger, IParameterSetter parameterSetter) { _uiNotifier = mainWindowUiUiNotifier; _cmdListenerWinSum03Reply = cmdListenerWinSum03Reply; _cmdListener16Request = cmdListener16Request; _parameterLogger = parameterLogger; _parameterSetter = parameterSetter; }
public SdTabInterfaceBuilder(IThreadNotifier mainWindowUiUiNotifier, ICmdListener <IList <BytesPair> > cmdListenerKsmParams, IParameterLogger parameterLogger, IParameterSetter parameterSetter, AppVersion version) { _uiNotifier = mainWindowUiUiNotifier; _cmdListenerKsmParams = cmdListenerKsmParams; _parameterLogger = parameterLogger; _parameterSetter = parameterSetter; _version = version; }
public MukFlapWinterSummerSetParamsViewModel(IThreadNotifier uiNotifier, IParameterSetter parameterSetter) { SettableParam827 = new SettableParameterViewModel(827, "Ручной/автоматический режим. 1 = ручной режим", 1.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam828 = new SettableParameterViewModel(828, "Уставка ШИМ на заслонку в ручном режиме 0 - 255", 255.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam829 = new SettableParameterViewModel(829, "H – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam830 = new SettableParameterViewModel(830, "I – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam831 = new SettableParameterViewModel(831, "J – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam832 = new SettableParameterViewModel(832, "A – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam833 = new SettableParameterViewModel(833, "E – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam834 = new SettableParameterViewModel(834, "C – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam835 = new SettableParameterViewModel(835, "D – параметр драйвера 1w", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); }
/// <summary> /// Performs processing on a value before it is used to set /// the parameter of a IDbCommand. /// </summary> /// <param name="setter">The interface for setting the value on the IDbCommand.</param> /// <param name="parameter">The value to be set</param> public void SetParameter(IParameterSetter setter, object parameter) { try { DateTime date = (DateTime)parameter; setter.Value = date.ToString("yyyy-MM-dd HH:mm:ss.fff"); } catch (Exception) { setter.Value = null; } }
public void SetParameter(IParameterSetter setter, object parameter) { bool b = Convert.ToBoolean(parameter); if (b) { setter.Value = YES; } else { setter.Value = NO; } }
public MukVaporizerFanDataViewModelParamcentric(IThreadNotifier notifier, IParameterSetter parameterSetter, IReceiverModbusRtu rtuReceiver, ICmdListener <IMukFanVaporizerDataReply03> cmdListenerMukVaporizerReply03, ICmdListener <IMukFanVaporizerDataRequest16> cmdListenerMukVaporizerRequest16) { _notifier = notifier; _cmdListenerMukVaporizerReply03 = cmdListenerMukVaporizerReply03; _cmdListenerMukVaporizerReply03.DataReceived += CmdListenerMukVaporizerReply03OnDataReceived; _cmdListenerMukVaporizerRequest16 = cmdListenerMukVaporizerRequest16; _cmdListenerMukVaporizerRequest16.DataReceived += CmdListenerMukVaporizerRequest16OnDataReceived; _children = new List <IGroupItem>(); var pwmParameter = new ReceivableModbusRtuParameterSimpleViewModel("Уставка ШИМ на вентилятор", 3, 3, 0, new BytesPairNullableToStringThroughDoubleConverter(1.0, 0.0, false, true, "f0")); var t1Parameter = new ReceivableModbusRtuParameterSimpleViewModel("Температура 1wire адрес 1", 3, 3, 1, new BytesPairNullableToStringThroughOneWireConverter(0.01, 0.0, "f2", new BytesPair(0x85, 0x00))); var t2Parameter = new ReceivableModbusRtuParameterSimpleViewModel("Температура 1wire адрес 2", 3, 3, 2, new BytesPairNullableToStringThroughOneWireConverter(0.01, 0.0, "f2", new BytesPair(0x85, 0x00))); var inputSignals = new ReceivableModbusRtuParameterSimpleViewModel("Байт входных сигналов (резерв)", 3, 3, 3, new BytesPairNullableToStringThroughDoubleConverter(1.0, 0.0, false, true, "f0")); var outputSignals = new ReceivableModbusRtuParameterSimpleViewModel("Байт выходных сигналов (резерв)", 3, 3, 4, new BytesPairNullableToStringThroughDoubleConverter(1.0, 0.0, false, true, "f0")); var pwmCalorifer = new ReceivableModbusRtuParameterSimpleViewModel("ШИМ на калорифер", 3, 3, 5, new BytesPairNullableToStringThroughDoubleConverter(1.0, 0.0, false, true, "f0")); var workStage = new ReceivableModbusRtuParameterSimpleViewModel("Этап работы", 3, 3, 6, new BytesPairNullableToStringThroughVaporizerFanWorkstageConverter()); rtuReceiver.RegisterParamToReceive(pwmParameter); rtuReceiver.RegisterParamToReceive(t1Parameter); rtuReceiver.RegisterParamToReceive(t2Parameter); rtuReceiver.RegisterParamToReceive(inputSignals); rtuReceiver.RegisterParamToReceive(outputSignals); rtuReceiver.RegisterParamToReceive(pwmCalorifer); rtuReceiver.RegisterParamToReceive(workStage); _children.Add(pwmParameter); _children.Add(t1Parameter); _children.Add(t2Parameter); _children.Add(inputSignals); _children.Add(outputSignals); _children.Add(pwmCalorifer); _children.Add(workStage); MukFanVaporizerDataReply03Text = new AnyCommandPartViewModel(); Request16TelemetryText = new AnyCommandPartViewModel(); MukVaporizerSetParamsVm = new MukVaporizerSetParamsViewModel(notifier, parameterSetter); }
public SerialChannelWithTimeoutMonitorAndSendReplyAbility(ISerialChannel channel) { Channel = channel; Channel.CommandHearedWithReplyPossibility += SerialChannelOnCommandHearedWithReplyPossibility; TimeoutMonitor = new CommandHearedTimerNotThreadSafe(Channel, TimeSpan.FromSeconds(1)); TimeoutMonitor.Start(); var replyGenerator = new ReplyGeneratorWithQueueAttempted(); ReplyGenerator = replyGenerator; ReplyAcceptor = replyGenerator; ParamSetter = replyGenerator; }
public void SetParameter(IParameterSetter setter, object parameter) { bool b = Convert.ToBoolean(parameter); if (b) { setter.Value = 100; } else { setter.Value = 200; } }
public object[] GetParameters(MethodInfo Method, IParameterSetter LastSetter) { ParameterInfo[] parameters = Method.GetParameters(); object[] array = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { if (!this.SetValue(parameters[i], i, ref array[i])) { LastSetter.GetParameterValue(parameters[i], i, ref array[i]); } } return(array); }
void ITypeHandlerCallback.SetParameter(IParameterSetter setter, object parameter) { if (parameter is DateTime) { DateTime time = (DateTime)parameter; if (time == DateTime.MinValue) { setter.Value = null; return; } } setter.Value = parameter; }
public void SetParameter(IParameterSetter setter, object parameter) { if (parameter is DateTime) { DateTime time = (DateTime)parameter; if (time == DateTime.MinValue) { setter.Value = null; return; } } setter.Value = parameter; }
public TabInterfaceBuilder( IThreadNotifier mainWindowUiUiNotifier, ICmdListener <IMukFanVaporizerDataReply03> cmdListenerEvaporator03Reply, ICmdListener <IMukFanVaporizerDataRequest16> cmdListenerEvaporator16Request, IParameterLogger parameterLogger, IParameterSetter parameterSetter) { _uiNotifier = mainWindowUiUiNotifier; _cmdListenerEvaporator03Reply = cmdListenerEvaporator03Reply; _cmdListenerEvaporator16Request = cmdListenerEvaporator16Request; _parameterLogger = parameterLogger; _parameterSetter = parameterSetter; }
public void SetParameter(IParameterSetter setter, object parameter) { if (parameter is DateTime) { DateTime time = (DateTime)parameter; if (time == DateTime.MinValue) { setter.Value = null; return; } } setter.Value = parameter; }
public MukWarmFloorDataViewModel(IThreadNotifier notifier, IParameterSetter parameterSetter, ICmdListener <IMukWarmFloorReply03Data> reply03Listener, ICmdListener <IMukWarmFloorRequest16Data> request16Listener) { _notifier = notifier; _reply03Listener = reply03Listener; _request16Listener = request16Listener; Reply03BytesTextVm = new AnyCommandPartViewModel(); Request16BytesTextVm = new AnyCommandPartViewModel(); MukWarmFloorSetParamsVm = new MukWarmFloorSetParamsViewModel(notifier, parameterSetter); _reply03Listener.DataReceived += Reply03ListenerOnDataReceived; _request16Listener.DataReceived += Request16ListenerOnDataReceived; }
public MukAirExhausterDataViewModel(IThreadNotifier notifier, IParameterSetter parameterSetter, ICmdListener <IMukAirExhausterReply03Data> cmdListenerMukAirExhausterReply03, ICmdListener <IMukFanAirExhausterRequest16Data> cmdListenerMukAirExhausterRequest16) { _notifier = notifier; _cmdListenerMukAirExhausterReply03 = cmdListenerMukAirExhausterReply03; _cmdListenerMukAirExhausterRequest16 = cmdListenerMukAirExhausterRequest16; Reply03TelemetryText = new AnyCommandPartViewModel(); Request16TelemetryText = new AnyCommandPartViewModel(); MukAirExhausterSetParamsVm = new MukAirExhausterSetParamsViewModel(notifier, parameterSetter); _cmdListenerMukAirExhausterReply03.DataReceived += CmdListenerMukAirExhausterReply03OnDataReceived; _cmdListenerMukAirExhausterRequest16.DataReceived += CmdListenerMukAirExhausterRequest16OnDataReceived; }
public SettableDropdownParameterViewModel( int paramIndex, string name, TRaw?defaultValue, IBuilderOneToOne <TRaw, string> stringBuilder, List <IRawAndConvertedValues <TRaw, string> > dropItems, string toolTipText, IParameterSetter parameterSetter, IThreadNotifier uiNotifier, IBuilderOneToOne <TRaw, BytesPair> sendConverter) : base(paramIndex, name, defaultValue, stringBuilder, toolTipText, parameterSetter, uiNotifier, sendConverter) { DropItems = dropItems; }
public object[] GetParameters(MethodInfo Method, IParameterSetter LastSetter) { ParameterInfo[] Params = Method.GetParameters(); object[] Values = new object[Params.Length]; //TODO: Update to iterate backwards for (int i = 0; i < Params.Length; ++i) { if (!SetValue(Params[i], i, ref Values[i])) { LastSetter.GetParameterValue(Params[i], i, ref Values[i]); } } return(Values); }
public TabInterfaceBuilderFc( IThreadNotifier mainWindowUiUiNotifier, ICmdListener <IRequestF0> cmdListenerFcRequest, ICmdListener <IReplyF0> cmdListenerFcReply, IParameterLogger parameterLogger, IParameterSetter parameterSetter) { _uiNotifier = mainWindowUiUiNotifier; _cmdListenerFcRequest = cmdListenerFcRequest; _cmdListenerFcReply = cmdListenerFcReply; _parameterLogger = parameterLogger; _parameterSetter = parameterSetter; }
public MukFridgeSetParamsViewModel(IThreadNotifier uiNotifier, IParameterSetter parameterSetter) { SettableParam415 = new SettableParameterViewModel(415, "Zone зона нечувствительности ПИДа", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam416 = new SettableParameterViewModel(416, "Td дифференциальная составляющая", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam417 = new SettableParameterViewModel(417, "Kp коеффициент пропорциональности", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam418 = new SettableParameterViewModel(418, "T_i интегральная составляющая", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam419 = new SettableParameterViewModel(419, "T_0 время вызова ПИДа", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam420 = new SettableParameterViewModel(420, "Ручной/автоматический режим. 1 = ручной режим", 1.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam421 = new SettableParameterViewModel(421, "Уставка уровень вентилир.в ручном режиме 0 - 3", 3.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam422 = new SettableParameterViewModel(422, "Ограничение максимального ШИМа в режиме настройки", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam423 = new SettableParameterViewModel(423, "Ограничение максимального ШИМа стоянки в режиме настройки", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); SettableParam424 = new SettableParameterViewModel(424, "Ограничение минимального ШИМа", 65535.0, 0.0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, uiNotifier, null); }
public MukFridgeFanDataViewModel( IThreadNotifier notifier, IParameterSetter parameterSetter, ICmdListener <IMukCondensorFanReply03Data> cmdListenerMukFridgeFanReply03, ICmdListener <IMukCondenserRequest16Data> cmdListenerMukCondenserRequest16) { _notifier = notifier; _cmdListenerMukFridgeFanReply03 = cmdListenerMukFridgeFanReply03; _cmdListenerMukCondenserRequest16 = cmdListenerMukCondenserRequest16; Reply03DataText = new AnyCommandPartViewModel(); Request16DataText = new AnyCommandPartViewModel(); MukFridgeSetParamsVm = new MukFridgeSetParamsViewModel(notifier, parameterSetter); _cmdListenerMukFridgeFanReply03.DataReceived += CmdListenerMukFridgeFanReply03OnDataReceived; _cmdListenerMukCondenserRequest16.DataReceived += CmdListenerMukCondenserRequest16OnDataReceived; }
public MukFlapDataViewModel( ISharedMainViewModel mainVm, IThreadNotifier notifier, IParameterSetter parameterSetter, ICmdListener <IMukFlapOuterAirReply03Telemetry> cmdListenerMukFlapOuterAirReply03, ICmdListener <IMukFlapOuterAirRequest16Data> cmdListenerMukFlapOuterAirRequest16) { MainVm = mainVm; _notifier = notifier; _cmdListenerMukFlapOuterAirReply03 = cmdListenerMukFlapOuterAirReply03; _cmdListenerMukFlapOuterAirRequest16 = cmdListenerMukFlapOuterAirRequest16; Reply03TelemetryText = new AnyCommandPartViewModel(); Request16TelemetryText = new AnyCommandPartViewModel(); MukFlapOuterAirSetParamsVm = new MukFlapOuterAirSetParamsViewModel(notifier, parameterSetter); _cmdListenerMukFlapOuterAirReply03.DataReceived += CmdListenerMukFlapOuterAirReply03OnDataReceived; _cmdListenerMukFlapOuterAirRequest16.DataReceived += CmdListenerMukFlapOuterAirRequest16OnDataReceived; }
/// <summary> /// Performs processing on a value before it is used to set /// the parameter of a IDbCommand. /// </summary> /// <param name="setter">The interface for setting the value on the IDbCommand.</param> /// <param name="parameter">The value to be set</param> public void SetParameter(IParameterSetter setter, object parameter) { if (parameter == null) { setter.Value = string.Empty; } else { // 设置parameter的其它属性,本例为size. if (setter.DataParameter is System.Data.SqlClient.SqlParameter) { // SQL Server ((System.Data.SqlClient.SqlParameter)setter.DataParameter).Size = int.MaxValue; } setter.Value = parameter; } }
public SettableAnyParameterViewModel(int paramIndex, string name, double maxValue, double minValue, double?doubleValue, string stringFormat, IDoubleBytesPairConverter doubleBytesPairConverter, IParameterSetter parameterSetter, IThreadNotifier uiNotifier) { _doubleBytesPairConverter = doubleBytesPairConverter; _parameterSetter = parameterSetter; _uiNotifier = uiNotifier; ParamIndex = paramIndex; Name = name; MaxValue = maxValue; MinValue = minValue; DoubleValue = doubleValue; StringFormat = stringFormat; _receivedDoubleValue = null; _isEnabled = true; _lastOperationColor = Colors.Transparent; _resetCommand = new RelayCommand(Reset, () => _receivedDoubleValue.HasValue); _setCommand = new RelayCommand(Set, () => _doubleValue.HasValue && IsEnabled); }
public SendableParameterBase( int paramIndex, string name, TRaw?defaultValue, IBuilderOneToOne <TRaw, string> stringBuilder, string toolTipText, IParameterSetter parameterSetter, IThreadNotifier uiNotifier, IBuilderOneToOne <TRaw, BytesPair> sendConverter) : base(paramIndex.ToString(), name, defaultValue, stringBuilder, toolTipText) { _isEnabled = true; _paramIndex = paramIndex; _parameterSetter = parameterSetter; _uiNotifier = uiNotifier; _sendConverter = sendConverter; //_resetCommand = new RelayCommand(Reset, () => ReceivedValueFormatted.HasValue); _setCommand = new DependedCommand(Set, () => FormattedValue != null && IsEnabled); _setCommand.AddDependOnProp(this, () => FormattedValue); _setCommand.AddDependOnProp(this, () => IsEnabled); _lastOperationColor = Colors.Transparent; }
public SettableTemperatureParameterViewModel( int paramIndex, string name, double maxValue, double minValue, double?formattedValue, string stringFormat, IDoubleBytesPairConverter doubleBytesPairConverter, IParameterSetter parameterSetter, IThreadNotifier uiNotifier, string toolTipText) : base( paramIndex, name, maxValue, minValue, formattedValue, stringFormat, doubleBytesPairConverter, parameterSetter, uiNotifier, toolTipText) { }
public DynamicMethodCall(object obj, MethodInfo method, IParameterSetter setter) { _obj = obj; _method = method; ParamList.Add(setter); }
public IAsyncResult BeginExecute(IParameterSetter Params, AsyncCallback callback, object obj) { Exec2 exec = new Exec2(Execute); return exec.BeginInvoke(Params, callback, null); }
public void SetParameter(IParameterSetter setter, object parameter) { throw new NotImplementedException(); }
public object Execute(IParameterSetter Params) { return _method.Invoke(_obj, GetParameterList(Method, Params)); }
public IAsyncResult BeginExecute(IParameterSetter paramSetter, AsyncCallback callback, Object obj) { return new ExecParam(Execute).BeginInvoke(paramSetter, callback, obj); }
public DelegateMethodCall(Delegate func, IParameterSetter paramSetter) { Func = func; CollParam.Add(paramSetter); }
public object[] GetParameters(MethodInfo Method, IParameterSetter LastSetter) { ParameterInfo[] Params = Method.GetParameters(); object[] Values = new object[Params.Length]; //TODO: Update to iterate backwards for(int i=0; i<Params.Length; ++i) { if (!SetValue(Params[i], i, ref Values[i])) LastSetter.GetParameterValue(Params[i], i, ref Values[i]); } return Values; }
public Object Execute(IParameterSetter paramSetter) { return MethodInfo.Invoke(_Obj, GetParameterList(MethodInfo, paramSetter)); }
public DynamicMethodCall(Object obj, MethodInfo methodInfo, IParameterSetter paramSetter) { _Obj = obj; MethodInfo = methodInfo; CollParam.Add(paramSetter); }
public Object Execute(IParameterSetter paramSetter) { return Func.DynamicInvoke(GetParameterList(MethodInfo, paramSetter)); }
public void SetParameter(IParameterSetter setter, object parameter) { if (parameter == null) setter.Value = null; setter.Value = parameter.ToString(); }
protected object[] GetParameterList(MethodInfo Method, IParameterSetter Params) { ParamList.reset(); object[] objParams = ParamList.GetParameters(Method, Params); return objParams; }
public object Execute(IParameterSetter Params) { return f.DynamicInvoke(GetParameterList(Method, Params)); }
protected Object[] GetParameterList(MethodInfo methodInfo, IParameterSetter paramSetter) { CollParam.Reset(); return CollParam.GetParameters(methodInfo, paramSetter); }
public void SetParameter(IParameterSetter setter, object parameter) { setter.Value = parameter.ToString(); }
public void Add(IParameterSetter setter) { _List.Add(setter); }
public KsmDataViewModel(IThreadNotifier notifier, IParameterSetter parameterSetter, ICmdListener <IList <BytesPair> > cmdListenerKsmParams) { _notifier = notifier; _cmdListenerKsmParams = cmdListenerKsmParams; _itemsToWrite = new BlockingCollection <Tuple <int, ushort, Action <Exception> > >(); _parameterVmList = new List <IReceivableParameter> { new KsmReadonlyParamViewModel(0, "Датчик 1wire №1", new TextFormatterSensor(0.01, 0.0, new BytesPair(0x85, 0x00), "f2", "хз", "обрыв")), new KsmReadonlyParamViewModel(1, "Датчик 1wire №2 ", new TextFormatterSensor(0.01, 0.0, new BytesPair(0x85, 0x00), "f2", "хз", "обрыв")), new KsmReadonlyParamViewModel(2, "Датчик 1wire №3", new TextFormatterSensor(0.01, 0.0, new BytesPair(0x85, 0x00), "f2", "хз", "обрыв")), new KsmReadonlyParamViewModel(3, "Датчик 1wire №4", new TextFormatterSensor(0.01, 0.0, new BytesPair(0x85, 0x00), "f2", "хз", "обрыв")), new KsmReadonlyParamViewModel(4, "Датчик 1wire №5", new TextFormatterSensor(0.01, 0.0, new BytesPair(0x85, 0x00), "f2", "хз", "обрыв")), new KsmBitsParameterViewModel(5, "PIC порт A", new TextFormatterBits(UnknownBits), new List <IKsmBitParameterViewModel> { new KsmBitParameterViewModel(4, "PA.4 = 0. Подогрев картера, включение"), }), new KsmBitsParameterViewModel(6, "PIC порт C", new TextFormatterBits(UnknownBits), new List <IKsmBitParameterViewModel> { new KsmBitParameterViewModel(2, "PC.2 = 0: Клапан разгрузки кондиционера, включение"), new KsmBitParameterViewModel(6, "PC.6 = 0: Включение реле разрешения подачи питания на компрессор"), }), new KsmBitsParameterViewModel(7, "Диагностика контроллера (ErrorsFlags)", new TextFormatterBits(UnknownBits), null), new KsmReadonlyParamViewModel(8, "Этап работы", new TextFormatterSimple("f2", "хз")), new KsmBitsParameterViewModel(9, "Регистр аварий в режиме включено", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(10, "Регистр аварий в режиме резерв", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(11, "Регистр аварий в режиме отстой", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(12, "Регистр аварий в режиме обслуживание", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(13, "Регистр аварий в режиме мойка", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(14, "Регистр аварий в режиме ручной", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(15, "Регистр аварий в режиме выключено", new TextFormatterBits(UnknownBits), null), new KsmBitsParameterViewModel(16, "Состояние обмена 1 (ErrorsResponse), 1 = ошибка обмена", new TextFormatterBits(UnknownBits), new List <IKsmBitParameterViewModel> { new KsmBitParameterViewModel(0, "b.0 - вычитка текущих данных из МУК заслонки наружного воздуха"), new KsmBitParameterViewModel(1, "b.1 - запись команд в МУК заслонки наружного воздуха"), new KsmBitParameterViewModel(2, "b.2 - вычитка текущих данных из МУК испарителя"), new KsmBitParameterViewModel(3, "b.3 - запись команд в МУК испарителя"), new KsmBitParameterViewModel(4, "b.4 - вычитка текущих данных из МУК конденсатора"), new KsmBitParameterViewModel(5, "b.5 - запись команд в МУК конденсатора"), new KsmBitParameterViewModel(6, "b.6 - вычитка текущих данных из МУК теплого пола"), new KsmBitParameterViewModel(7, "b.7 - запись команд в МУК теплого пола") }), new KsmBitsParameterViewModel(17, "Состояние обмена 2 (ErrorsResponse), 1 = ошибка обмена", new TextFormatterBits(UnknownBits), new List <IKsmBitParameterViewModel> { new KsmBitParameterViewModel(0, "b.0 - обмен с БС-СМ"), new KsmBitParameterViewModel(1, "b.1 - обмен с БВС"), new KsmBitParameterViewModel(2, "b.2 - запись данных в РПД"), new KsmBitParameterViewModel(3, "b.3 - вычитка корректируемого параметра из программы технического абонента"), new KsmBitParameterViewModel(4, "b.4 - отсылка текущих данных техническому абоненту") }), new KsmReadonlyParamViewModel(18, "Уставка ШИМ на клапан", new TextFormatterSimple("f2", "хз")), new KsmReadonlyParamViewModel(19, "Ручной принудительный режим", new TextFormatterSimple("f2", "хз")), new KsmBitsParameterViewModel(20, "PIC порт B", new TextFormatterBits(UnknownBits), new List <IKsmBitParameterViewModel> { new KsmBitParameterViewModel(1, "PB.1 = 1: аварийное отключение"), }) }; for (int i = 21; i < 27; ++i) { _parameterVmList.Add(new KsmReadonlyParamViewModel(i, "Параметр " + i, new TextFormatterSimple("f2", "хз"))); } _parameterVmList.Add(new KsmReadonlyParamViewModel(27, "Версия ПО", new TextFormatterDotted("хз"))); _parameterVmList.Add(new SettableParameterViewModel(28, "Максимальный ШИМ (PWMmax_cool)", 255, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(29, "Минимальный ШИМ (PWMmin_cool)", 255, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(30, "Дельта + (plus_cool)", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(31, "Дельта - (minus_cool)", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(32, "Компрессор, почасовой счетчик работы", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(33, "Вентилятор конденсатора, почасовой счетчик работы", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(34, "Отопитель 380 в., почасовой счетчик работы", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(35, "Вентилятор приточного воздуха, почасовой счетчик работы", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); _parameterVmList.Add(new SettableParameterViewModel(36, "Дельта уставки температуры, отладка, ЦМР 0.1 0 = -2.5, 50 = +2.5", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); var converter = new WarmOrCoolForcedModeToStringConverter(); var bpConverter = new BuilderOneToOneFunc <BytesPair, string>(bp => { try { //Console.WriteLine("Need to convert " + bp.HighFirstSignedValue + " to WarmOrCoolForcedMode"); return(converter.Build((WarmOrCoolForcedMode)bp.HighFirstSignedValue)); } catch { //Console.WriteLine("Cannot convert value " + bp + " to WarmOrCoolForcedMode"); return(converter.Build(WarmOrCoolForcedMode.Unknown)); } }); _parameterVmList.Add(new WarmOrCoolForcedModeViewModel(37, "Принудительный режим обогрев/охлаждение", null, bpConverter, new List <IRawAndConvertedValues <BytesPair, string> > { new RawAndConvertedValuesSimple <BytesPair, string>(new BytesPair(0, 0), converter.Build(WarmOrCoolForcedMode.AutomaticMode)), new RawAndConvertedValuesSimple <BytesPair, string>(new BytesPair(0, 1), converter.Build(WarmOrCoolForcedMode.Cool100Percent)), new RawAndConvertedValuesSimple <BytesPair, string>(new BytesPair(0, 2), converter.Build(WarmOrCoolForcedMode.Cool50Percent)), new RawAndConvertedValuesSimple <BytesPair, string>(new BytesPair(0, 3), converter.Build(WarmOrCoolForcedMode.Ventilation)), new RawAndConvertedValuesSimple <BytesPair, string>(new BytesPair(0, 4), converter.Build(WarmOrCoolForcedMode.Warm100Percent)), new RawAndConvertedValuesSimple <BytesPair, string>(new BytesPair(0, 5), converter.Build(WarmOrCoolForcedMode.Warm50Percent)) }, "Режим работы", parameterSetter, _notifier, new BuilderOneToOneFunc <BytesPair, BytesPair>(bp => bp))); for (int i = 38; i < 50; ++i) { _parameterVmList.Add(new SettableParameterViewModel(i, "Параметр", 65535, 0, null, "f0", new DoubleBytesPairConverterSimpleUshort(), parameterSetter, notifier, null)); } DataAsText = new AnyCommandPartViewModel(); _cmdListenerKsmParams.DataReceived += CmdListenerKsmParamsOnDataReceived; }
public DelegateMethodCall(Delegate f, IParameterSetter Params) { _f = f; ParamList.Add(Params); }