public ActiveGetOrDefault(IActiveLookup <TKey, TSource> source, IActiveValue <TKey> parameter) : base(source, parameter) { _source = source; Initialize(); OnParameterChanged(); }
public ActiveListJoinerSet(ActiveListJoinBehaviour joinBehaviour, TKey key, IActiveLookup <TKey, TRight> right, Func <JoinOption <TLeft>, JoinOption <TRight>, TResult> resultSelector, IEnumerable <string> leftResultSelectorPropertiesToWatch, IEnumerable <string> rightResultSelectorPropertiesToWatch) { Key = key; _joinBehaviour = joinBehaviour; _right = right[key]; _resultSelector = resultSelector; _leftResultSelectorPropertiesToWatch = leftResultSelectorPropertiesToWatch; _rightResultSelectorPropertiesToWatch = rightResultSelectorPropertiesToWatch; }
private ActiveJoin(ActiveListJoinBehaviour joinBehaviour, IActiveList <KeyValuePair <TKey, TLeft> > left, IActiveLookup <TKey, TRight> right, IActiveValue <TParameter> parameter, Func <JoinOption <TLeft>, JoinOption <TRight>, TParameter, TResult> resultSelector, IEnumerable <string> leftResultSelectorPropertiesToWatch, IEnumerable <string> rightResultSelectorPropertiesToWatch, IEnumerable <string> resultSelectorParameterPropertiesToWatch) { _joinBehaviour = joinBehaviour; _parameter = parameter; _resultSelector = resultSelector; _leftResultSelectorPropertiesToWatch = leftResultSelectorPropertiesToWatch; _rightResultSelectorPropertiesToWatch = rightResultSelectorPropertiesToWatch; if (parameter != null) { _parameterWatcher = new ValueWatcher <TParameter>(parameter, resultSelectorParameterPropertiesToWatch); _parameterWatcher.ValueOrValuePropertyChanged += () => OnParameterChanged(); } _leftJoiners = new QuickList <ActiveListJoinerData <TLeft, TRight, TResult, TKey> >(); _rightJoiners = new QuickList <ActiveListJoinerData <TLeft, TRight, TResult, TKey> >(); _joinerLookup = new Dictionary <TKey, ActiveListJoinerSet <TLeft, TRight, TResult, TKey> >(); _leftItems = new CollectionWrapper <KeyValuePair <TKey, TLeft> >(left); _leftItems.ItemModified += (s, i, v) => OnLeftReplaced(i, v, v); _leftItems.ItemAdded += (s, i, v) => OnLeftAdded(i, v); _leftItems.ItemRemoved += (s, i, v) => OnLeftRemoved(i, v); _leftItems.ItemReplaced += (s, i, o, n) => OnLeftReplaced(i, o, n); _leftItems.ItemMoved += (s, o, n, v) => OnLeftMoved(o, n, v); _leftItems.ItemsReset += s => FullReset(); _rightItems = right; _rightGroups = new CollectionWrapper <IActiveGrouping <TKey, TRight> >(right); _rightGroups.ItemModified += (s, i, v) => OnRightReplaced(i, v, v); _rightGroups.ItemAdded += (s, i, v) => OnRightAdded(i, v); _rightGroups.ItemRemoved += (s, i, v) => OnRightRemoved(i, v); _rightGroups.ItemReplaced += (s, i, o, n) => OnRightReplaced(i, o, n); _rightGroups.ItemMoved += (s, o, n, v) => OnRightMoved(o, n, v); _rightGroups.ItemsReset += s => FullReset(); _resultList = new ObservableList <TResult>(); _resultList.PropertyChanged += (s, e) => { if (!_fullResetInProgress) { NotifyOfPropertyChange(e); } }; _resultList.CollectionChanged += (s, e) => { if (!_fullResetInProgress) { NotifyOfCollectionChange(e); } }; FullReset(); }
public static IActiveValue <bool> ActiveSetContains <TKey, TSource>(this IActiveLookup <TKey, TSource> source, IActiveValue <TKey> value) => new ActiveSetContains <TKey, IActiveGrouping <TKey, TSource> >(source, source, value);
public static IActiveValue <bool> ActiveSetContains <TKey, TSource>(this IActiveLookup <TKey, TSource> source, TKey value) => ActiveSetContains(source, new ActiveValueWrapper <TKey>(value));