public IProducerBinding GetProducerBinding(string repositoryGroup, string variableName, BuiltInType encoding) { string _key = String.Format("{0}.{1}", repositoryGroup, variableName); IProducerBinding _npb = new ProducerBindingMonitoredValue <object>(_key, new UATypeInfo(encoding)); m_Repository.Add(_key, _npb); return(_npb); }
public IProducerBinding GetProducerBinding(string repositoryGroup, string processValueName, UATypeInfo encoding) { string _key = String.Format("{0}.{1}", repositoryGroup, processValueName); ProducerBindingMonitoredValue<object> _npb = new ProducerBindingMonitoredValue<object>(_key, new UATypeInfo(encoding.BuiltInType)); _npb.MonitoredValue = Guid.NewGuid(); m_Repository.Add(_key, _npb); return _npb; }
private IProducerBinding AddBinding <type>(string key, Func <type, type> increment, type defaultValue, UATypeInfo typeInfo) { ProducerBindingMonitoredValue <type> binding = new ProducerBindingMonitoredValue <type>(key, typeInfo) { MonitoredValue = defaultValue }; m_NodesDictionary.Add(key, binding); m_TimeEven += (x, y) => binding.MonitoredValue = increment(binding.MonitoredValue); return(binding); }
internal IProducerBinding GetProducerBinding(string variableName, BuiltInType encoding) { UATypeInfo _uaTypeInfo = new UATypeInfo(encoding); if (variableName == "Value1") { Value1 = new ProducerBindingMonitoredValue<string>(variableName, _uaTypeInfo); return Value1; } else if (variableName == "Value2") { Value2 = new ProducerBindingMonitoredValue<double>(variableName, _uaTypeInfo); return Value2; } else throw new ArgumentOutOfRangeException("variableName"); }
internal IProducerBinding GetProducerBinding(string variableName, BuiltInType encoding) { UATypeInfo _uaTypeInfo = new UATypeInfo(encoding); if (variableName == "Value1") { Value1 = new ProducerBindingMonitoredValue <string>(variableName, _uaTypeInfo); return(Value1); } else if (variableName == "Value2") { Value2 = new ProducerBindingMonitoredValue <double>(variableName, _uaTypeInfo); return(Value2); } else { throw new ArgumentOutOfRangeException("variableName"); } }
//methods private IProducerBinding AddBinding <type>(string key, UATypeInfo typeInfo) { IVariable _variable = m_NodesDictionary[key]; Type _expectedType = typeof(type); if (!_expectedType.GetUATypeInfo().IsEqual(_variable.ValueType)) { throw new ArgumentOutOfRangeException($"Wrong argument type: {_expectedType.GetUATypeInfo()} but expected {_variable.ValueType}"); } ProducerBindingMonitoredValue <type> _binding = new ProducerBindingMonitoredValue <type>(key, typeInfo) { MonitoredValue = default(type) }; _variable.OnStateChanged += (context, node, changes) => { if (changes == NodeStateChangeMasks.Value) { _binding.MonitoredValue = (type)_variable.Value; } }; return(_binding); }
public IProducerBinding GetProducerBinding(string repositoryGroup, string variableName, BuiltInType encoding) { string _key = String.Format("{0}.{1}", repositoryGroup, variableName); IProducerBinding _npb = new ProducerBindingMonitoredValue<object>(_key, new UATypeInfo(encoding)); m_Repository.Add(_key, _npb); return _npb; }