Esempio n. 1
0
        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 ParameterGetterViewModelSimple(
            string paramId, IParamListener listener, IThreadNotifier uiNotifier,
            IParameterView view, IParameterLogger parameterLogger, bool isBitParam, string logName)
        {
            _listener        = listener;
            _uiNotifier      = uiNotifier;
            _view            = view;
            _parameterLogger = parameterLogger;
            _logName         = logName;
            _paramId         = paramId;

            _listener.ValueReceived += ListenerValueReceived;
            _log = isBitParam ? (Action <string, double?>)LogBool : _parameterLogger.LogAnalogueParameter;


            _value    = "?";
            _isLogged = false;
        }