private void AssociateValue() { if (value != null) { return; } value = ConfValuesManager.GetInstance().GetValueByName(_valueName); if (value != null) { value.OnChanged += value_OnChanged; } }
/// <summary> /// Adds a value to this manager to handle. /// </summary> public void AddVal(ConfValue v) { if (GetValueByName(v.Name) != null) { throw new ValueAlreadyExistsException(v.Name); } _values.Add(v); OnValueCreated?.Invoke(v.Name); // register this as the receiver for v's OnChanged v.OnChanged += FireValueChanged; // if there is a storage set, load the value from it if (_savedStorage != null) { v.LoadFrom(_savedStorage); } }
/// <summary> /// Removes a value from this manager's care. /// </summary> public void RemoveVal(ConfValue v) { _values.Remove(v); }