internal ChainedDynamicProperty(DynamicProperties manager, T defaultValue = default(T), params string[] properties)
        {
            if (properties.Length < 2)
            {
                throw new ArgumentException("You must provided at least 2 properties.");
            }
            _propertiesManager  = manager;
            _fallbackProperties = properties.ToArray();
            _defaultValue       = defaultValue;
            _propertiesManager.PropertyChanged += OnPropertyChanged;

            Reset();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialise dynamic properties configuration. Can be call only once and before any call to DynamicProperties.Instance.
        /// </summary>
        /// <param name="pollingIntervalInSeconds">Polling interval in seconds (default 60)</param>
        /// <param name="sourceTimeoutInMs">Max time allowed to a source to retrieve new values (Cancel the request but doesn't raise an error)</param>
        /// <returns>Current DynamicProperties instance</returns>
        public static IDynamicProperties Init(int pollingIntervalInSeconds = 60, int sourceTimeoutInMs = 1000)
        {
            if (_instance == null)
            {
                lock (_sync)
                {
                    if (_instance == null)
                    {
                        _instance = new DynamicProperties(pollingIntervalInSeconds, sourceTimeoutInMs);
                    }
                }
                return(_instance);
            }

            throw new Exception("Can not initialize an active instance. Use Reset().");
        }
 internal DynamicProperty(DynamicProperties manager, string name)
 {
     this.Name = name;
     this.propertiesManager = manager;
 }
Exemplo n.º 4
0
 internal PropertiesFactory([NotNull] DynamicProperties dynamicProperties)
 {
     this._properties = dynamicProperties;
 }