/// <summary> /// Initializes a new instance of the <see cref="ActiveValue{TValue}"/> class /// </summary> /// <param name="value">The current value</param> /// <param name="operationFault">An action that will set the <see cref="OperationFault"/> property of the <see cref="ActiveValue{TValue}"/></param> /// <param name="elementFaultChangeNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data from which the value is aggregated</param> public ActiveValue(TValue value, Exception operationFault = null, INotifyElementFaultChanges elementFaultChangeNotifier = null) { this.value = value; this.operationFault = operationFault; this.elementFaultChangeNotifier = elementFaultChangeNotifier; InitializeFaultNotification(); }
/// <summary> /// Initializes a new instance of the <see cref="ActiveEnumerable{TElement}"/> class /// </summary> /// <param name="readOnlyList">The read-only list upon which the <see cref="ActiveEnumerable{TElement}"/> is based</param> /// <param name="faultNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data of the <see cref="ActiveEnumerable{TElement}"/></param> /// <param name="onDispose">The action to take when the <see cref="ActiveEnumerable{TElement}"/> is disposed</param> public ActiveEnumerable(IReadOnlyList <TElement> readOnlyList, INotifyElementFaultChanges faultNotifier = null, Action onDispose = null) { synchronized = readOnlyList as ISynchronized ?? throw new ArgumentException($"{nameof(readOnlyList)} must implement {nameof(ISynchronized)}", nameof(readOnlyList)); this.faultNotifier = faultNotifier ?? (readOnlyList as INotifyElementFaultChanges); if (this.faultNotifier != null) { this.faultNotifier.ElementFaultChanged += FaultNotifierElementFaultChanged; this.faultNotifier.ElementFaultChanging += FaultNotifierElementFaultChanging; } if (readOnlyList is ActiveEnumerable <TElement> activeEnumerable) { this.readOnlyList = activeEnumerable.readOnlyList; } else { this.readOnlyList = readOnlyList; } if (this.readOnlyList is INotifyCollectionChanged collectionNotifier) { isCollectionNotifier = true; collectionNotifier.CollectionChanged += CollectionChangedHandler; } if (this.readOnlyList is INotifyGenericCollectionChanged <TElement> genericCollectionNotifier) { isGenericCollectionNotifier = true; genericCollectionNotifier.GenericCollectionChanged += GenericCollectionChangedHandler; } this.onDispose = onDispose; }
/// <summary> /// Initializes a new instance of the <see cref="ActiveDictionary{TKey, TValue}"/> class /// </summary> /// <param name="readOnlyDictionary">The read-only dictionary upon which the <see cref="ActiveDictionary{TKey, TValue}"/> is based</param> /// <param name="setOperationFault">An action that will set the <see cref="OperationFault"/> property of the <see cref="ActiveDictionary{TKey, TValue}"/></param> /// <param name="faultNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data of the <see cref="ActiveDictionary{TKey, TValue}"/></param> /// <param name="onDispose">The action to take when the <see cref="ActiveDictionary{TKey, TValue}"/> is disposed</param> public ActiveDictionary(IReadOnlyDictionary <TKey, TValue> readOnlyDictionary, out Action <Exception> setOperationFault, INotifyElementFaultChanges faultNotifier = null, Action onDispose = null) : this(readOnlyDictionary, faultNotifier, onDispose) =>
/// <summary> /// Initializes a new instance of the <see cref="ActiveDictionary{TKey, TValue}"/> class /// </summary> /// <param name="readOnlyDictionary">The read-only dictionary upon which the <see cref="ActiveDictionary{TKey, TValue}"/> is based</param> /// <param name="faultNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data of the <see cref="ActiveDictionary{TKey, TValue}"/></param> /// <param name="onDispose">The action to take when the <see cref="ActiveDictionary{TKey, TValue}"/> is disposed</param> public ActiveDictionary(IReadOnlyDictionary <TKey, TValue> readOnlyDictionary, INotifyElementFaultChanges faultNotifier, Action onDispose = null) : this(readOnlyDictionary, onDispose) { this.faultNotifier = faultNotifier ?? (readOnlyDictionary as INotifyElementFaultChanges); if (this.faultNotifier != null) { this.faultNotifier.ElementFaultChanged += FaultNotifierElementFaultChanged; this.faultNotifier.ElementFaultChanging += FaultNotifierElementFaultChanging; } }
/// <summary> /// Initializes a new instance of the <see cref="ActiveGrouping{TKey, TElement}"/> class /// </summary> /// <param name="key">The key value that members of the group share in common</param> /// <param name="list">The list of members of the group</param> /// <param name="faultNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data of the group's members</param> /// <param name="onDispose">The action to take when the <see cref="ActiveGrouping{TKey, TValue}"/> is disposed</param> public ActiveGrouping(TKey key, ObservableCollection <TElement> list, INotifyElementFaultChanges faultNotifier = null, Action onDispose = null) : base(list, faultNotifier, onDispose) => Key = key;
/// <summary> /// Initializes a new instance of the <see cref="ActiveValue{TValue}"/> class /// </summary> /// <param name="value">The current value</param> /// <param name="setValue">An action that will set the <see cref="Value"/> property of the <see cref="ActiveValue{TValue}"/></param> /// <param name="setOperationFault">An action that will set the <see cref="OperationFault"/> property of the <see cref="ActiveValue{TValue}"/></param> /// <param name="elementFaultChangeNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data from which the value is aggregated</param> /// <param name="onDispose">The action to take when the <see cref="ActiveValue{TValue}"/> is disposed</param> public ActiveValue(TValue value, out Action <TValue> setValue, out Action <Exception> setOperationFault, INotifyElementFaultChanges elementFaultChangeNotifier = null, Action onDispose = null) : this(value, out setValue, null, elementFaultChangeNotifier, onDispose) =>
/// <summary> /// Initializes a new instance of the <see cref="ActiveValue{TValue}"/> class /// </summary> /// <param name="value">The current value</param> /// <param name="setValue">An action that will set the <see cref="Value"/> property of the <see cref="ActiveValue{TValue}"/></param> /// <param name="operationFault">The current operation fault</param> /// <param name="elementFaultChangeNotifier">The <see cref="INotifyElementFaultChanges"/> for the underlying data from which the value is aggregated</param> /// <param name="onDispose">The action to take when the <see cref="ActiveValue{TValue}"/> is disposed</param> public ActiveValue(TValue value, out Action <TValue> setValue, Exception operationFault = null, INotifyElementFaultChanges elementFaultChangeNotifier = null, Action onDispose = null) : this(value, operationFault, elementFaultChangeNotifier) { setValue = SetValue; this.onDispose = onDispose; }