protected BindBoxBase(IConfigurationChangeNotifyable changeNotifyable, BindSettings bindSettings, ConfigBindMode mode) { ChangeNotifyable = changeNotifyable ?? throw new ArgumentNullException(nameof(changeNotifyable)); BindSettings = bindSettings ?? throw new ArgumentNullException(nameof(bindSettings)); Mode = mode; once = new ConcurrentOnce(); }
public ObservableBindBox(IConfigurationChangeNotifyable changeNotifyable, BindSettings bindSettings, ConfigBindMode mode, Action <Action> updater) : this(changeNotifyable, changeNotifyable, bindSettings, mode, updater) { }
public BindBox(IConfigurationChangeNotifyable changeNotifyable, BindSettings bindSettings, ConfigBindMode mode, Action <Action> updater) { ChangeNotifyable = changeNotifyable ?? throw new ArgumentNullException(nameof(changeNotifyable)); BindSettings = bindSettings ?? throw new ArgumentNullException(nameof(bindSettings)); Mode = mode; Updater = updater ?? throw new ArgumentNullException(nameof(updater)); once = new ConcurrentOnce(); }
public ObservableBindBox(IConfigurationChangeNotifyable changeNotifyable, IConfiguration configuration, BindSettings bindSettings, ConfigBindMode mode, Action <Action> updater) : base(changeNotifyable, bindSettings, mode, updater) { Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); NotifyObject = bindSettings.Value as INotifyPropertyChanged; if (NotifyObject is null) { throw new InvalidCastException($"Can't case {changeNotifyable.GetType().FullName} to {typeof(INotifyPropertyChanged).FullName}"); } notifyPropertyMap = NotifyObject.GetType().GetProperties() .ToDictionary(x => x.Name, x => new PropertyBindBox(x)); propertyConfigMap = new Dictionary <string, PropertyBindBox>(); propertyVisitor = CompilePropertyVisitor.Instance; }
public static BindBox Bind(this IConfigurationChangeNotifyable notifyable, BindSettings bindSettings, ConfigBindMode configBindMode) { var updater = bindSettings.Updater; if (updater is null) { updater = a => a(); } var box = new BindBox(notifyable, bindSettings, configBindMode, updater); box.Bind(); return(box); }
public BindBox(IConfigurationChangeNotifyable changeNotifyable, BindSettings bindSettings, ConfigBindMode mode, Action <Action> updater) : base(changeNotifyable, bindSettings, mode) { Updater = updater ?? throw new ArgumentNullException(nameof(updater)); }
public static BindBox Bind(this IConfigurationChangeNotifyable notifyable, BindSettings bindSettings, ConfigBindMode configBindMode) { if (notifyable is null) { throw new ArgumentNullException(nameof(notifyable)); } if (bindSettings is null) { throw new ArgumentNullException(nameof(bindSettings)); } var updater = bindSettings.Updater; if (updater is null) { updater = a => a(); } var box = new BindBox(notifyable, bindSettings, configBindMode, updater); box.Bind(); return(box); }