public BoundCollectionChangedEventArgs(string propertyName, NotifyCollectionChangedEventArgs sourceEventArgs, IBinding binding, object[] PreviousCollectionContent) { Argument.NotNull(() => sourceEventArgs); this.PropertyName = propertyName; this.SourceEventArgs = sourceEventArgs; this.Binding = binding; this.PreviousCollectionContent = PreviousCollectionContent; }
void ActiveItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if(e.OldItems != null) { foreach(ISelectable item in e.OldItems) { item.RemoveHighlightColor(ActiveColor); } } if (e.NewItems != null) { foreach (ISelectable item in e.NewItems) { item.AddHighlightColor(ActiveColor); } } }
void Polygons_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if(e.NewItems != null) { foreach(GMapPolygon obj in e.NewItems) { if(obj != null) { obj.Overlay = this; Control.UpdatePolygonLocalPosition(obj); } } } if(!Control.HoldInvalidation) { Control.Core_OnNeedInvalidation(); } }
public void Test_New() { var args = new NotifyCollectionChangedEventArgs<int>(NotifyCollectionChangedAction.Add, new List<int> { 1 }, null); Assert.Equal(NotifyCollectionChangedAction.Add, args.Action); Assert.NotNull(args.NewItems); Assert.Equal(1, args.NewItems.Count); Assert.Contains(1, args.NewItems); Assert.Null(args.OldItems); args = new NotifyCollectionChangedEventArgs<int>(NotifyCollectionChangedAction.Move, new List<int> { 1 }, new List<int> { 3, 4 }); Assert.Equal(NotifyCollectionChangedAction.Move, args.Action); Assert.NotNull(args.NewItems); Assert.Equal(1, args.NewItems.Count); Assert.Contains(1, args.NewItems); Assert.NotNull(args.OldItems); Assert.Equal(2, args.OldItems.Count); Assert.Contains(3, args.OldItems); Assert.Contains(4, args.OldItems); args = new NotifyCollectionChangedEventArgs<int>(NotifyCollectionChangedAction.Remove, null, new List<int> { 3, 4 }); Assert.Equal(NotifyCollectionChangedAction.Remove, args.Action); Assert.Null(args.NewItems); Assert.NotNull(args.OldItems); Assert.Equal(2, args.OldItems.Count); Assert.Contains(3, args.OldItems); Assert.Contains(4, args.OldItems); args = new NotifyCollectionChangedEventArgs<int>(NotifyCollectionChangedAction.Replace, new List<int> { 1 }, new List<int> { 5 }); Assert.Equal(NotifyCollectionChangedAction.Replace, args.Action); Assert.NotNull(args.NewItems); Assert.Equal(1, args.NewItems.Count); Assert.Contains(1, args.NewItems); Assert.NotNull(args.OldItems); Assert.Equal(1, args.OldItems.Count); Assert.Contains(5, args.OldItems); args = new NotifyCollectionChangedEventArgs<int>(NotifyCollectionChangedAction.Reset, null, null); Assert.Equal(NotifyCollectionChangedAction.Reset, args.Action); Assert.Null(args.NewItems); Assert.Null(args.OldItems); }
public void collection_changed_is_not_propagated_from_child_node_after_disconnect() { var propertyName = "Nested"; var obj = new TestClass(); var childEventStream = new Subject<BoundCollectionChangedEventArgs>(); InitMocks(); InitTestObjectWithCollectionChangedStream(childEventStream, obj); var events = new List<BoundCollectionChangedEventArgs>(); testObject.CollectionChangedEventStream.Subscribe(ev => events.Add(ev)); testObject.Disconnect(); var fakeCollectionChangedEventArgs = new NotifyCollectionChangedEventArgs(); childEventStream.OnNext(new BoundCollectionChangedEventArgs(propertyName, fakeCollectionChangedEventArgs, null, null)); Assert.Empty(events); }
public void collection_changed_is_propagated_from_child_node() { var propertyName = "Nested"; var obj = new TestClass(); var childEventStream = new Subject<BoundCollectionChangedEventArgs>(); InitMocks(); InitTestObjectWithCollectionChangedStream(childEventStream, obj); var events = new List<BoundCollectionChangedEventArgs>(); testObject.CollectionChangedEventStream.Subscribe(ev => events.Add(ev)); var fakeCollectionChangedEventArgs = new NotifyCollectionChangedEventArgs(); childEventStream.OnNext(new BoundCollectionChangedEventArgs(propertyName, fakeCollectionChangedEventArgs, null, null)); Assert.Equal(1, events.Count); Assert.Equal(propertyName, events[0].PropertyName); Assert.Equal(fakeCollectionChangedEventArgs, events[0].SourceEventArgs); }
public void BoundCollectionChanged_event_from_child_passed_on() { InitMocks(1); var childEventStream = new Subject<BoundCollectionChangedEventArgs>(); mockArrayItemBindings[0] .Setup(m => m.CollectionChangedEventStream) .Returns(childEventStream); InitTestObject(testArray); var events = new List<BoundCollectionChangedEventArgs>(); testObject.CollectionChangedEventStream.Subscribe(ev => events.Add(ev)); var fakeCollectionChangedEventArgs = new NotifyCollectionChangedEventArgs(); childEventStream.OnNext(new BoundCollectionChangedEventArgs("Nested", fakeCollectionChangedEventArgs, null, null)); Assert.Equal(1, events.Count); Assert.Equal("Nested", events[0].PropertyName); Assert.Equal(fakeCollectionChangedEventArgs, events[0].SourceEventArgs); }
private void ResultOperators_CollectionChanged (object sender, NotifyCollectionChangedEventArgs e) { ArgumentUtility.CheckNotNull ("e", e); ArgumentUtility.CheckItemsNotNullAndType ("e.NewItems", e.NewItems, typeof (ResultOperatorBase)); }
private void ItemPropertyChanged(object sender, PropertyChangedEventArgs e) { NotifyCollectionChangedEventArgs args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, sender, sender, IndexOf((T)sender)); //OnCollectionChanged(args); }
private void Orderings_CollectionChanged (object sender, NotifyCollectionChangedEventArgs e) { ArgumentUtility.CheckNotNull ("e", e); ArgumentUtility.CheckItemsNotNullAndType ("e.NewItems", e.NewItems, typeof (Ordering)); }
private void FramesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.OldItems != null && e.OldItems.Count > 0) { foreach (MetroTileFrame item in e.OldItems) { item.PropertyChanged -= FramePropertyChanged; } } if (e.NewItems != null && e.NewItems.Count > 0) { foreach (MetroTileFrame item in e.NewItems) { item.PropertyChanged += FramePropertyChanged; } } if (_CurrentFrame >= _Frames.Count) { _CurrentFrame = 0; this.Refresh(); } }
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { this.ReindexItems(); base.OnItemsChanged(e); }
private void Lights_CollectionChanged(object sender, NotifyCollectionChangedEventArgs<Light> e) { this.buildPhotonMaps = true; }
void items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { updateItems(); }
protected void PropertyGroupsChanged(object sender, NotifyCollectionChangedEventArgs e) { OnPropertyChanged(nameof(PropertyGroups)); }
private void ServerListChanged(object sender, NotifyCollectionChangedEventArgs e) { //EntitySerializer.Instance.StoreEntities(Entities); ApplicationManager.Instance.TriggerServerListEvent(this, new EventArgs()); ApplicationManager.Instance.MainViewModel.SetServerList(ref entities); }
/* Implementation */ private void ModsOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { RaiseCanExecute(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); }
private void EventListenersCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { // let's make this real simple, just invalidate the eventhandlers property this.EventHandlers.Invalidate(this.EventListeners); }
void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { InvalidateEnumerator(); }
void points_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { addPointCommand.RaiseCanExecuteChanged(); removePointCommand.RaiseCanExecuteChanged(); }
private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { _hub.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, Apply); }
void Routes_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if(e.NewItems != null) { foreach(GMapRoute obj in e.NewItems) { if(obj != null) { obj.Overlay = this; if(Control != null) { Control.UpdateRouteLocalPosition(obj); } } } } if(Control != null) { if(!Control.HoldInvalidation) { Control.Core.Refresh.Set(); } } }
/// <summary> /// Forwards CollectionChanged notifications for the GenericTypeArguments property to the parent model element /// </summary> /// <param name="sender">The collection that raised the change</param> /// <param name="e">The original event data</param> private void GenericTypeArgumentsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { this.OnCollectionChanged("GenericTypeArguments", e, _genericTypeArgumentsReference); }
void CellsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Add: GridPanel panel = GridPanel; if (e.Action == NotifyCollectionChangedAction.Replace) { for (int i = 0; i < e.OldItems.Count; i++) { GridCell cell = e.OldItems[i] as GridCell; if (cell != null) { if (panel.ExpDictionary.ContainsKey(cell)) panel.ExpDictionary.Remove(cell); } } } for (int i = 0; i < e.NewItems.Count; i++) { GridCell cell = e.NewItems[i] as GridCell; if (cell != null) { cell.Parent = this; cell.ColumnIndex = e.NewStartingIndex + i; if (panel != null) { string newExp = cell.Value as string; if (newExp != null) { newExp = newExp.Trim(); if (newExp.StartsWith("=")) cell.SetCellExp(panel, newExp); } } } } break; default: for (int i = 0; i < _Cells.Count; i++) { _Cells[i].Parent = this; _Cells[i].ColumnIndex = i; } break; } if (SuperGrid != null) { GridCell cell = SuperGrid.ActiveElement as GridCell; if (cell != null) { if (cell.GridRow == this && cell.ColumnIndex < Cells.Count) SuperGrid.ActiveElement = Cells[cell.ColumnIndex]; } } NeedsMeasured = true; if (GridPanel != null && GridPanel.VirtualMode == false) InvalidateLayout(); }
private void OnChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) => OnChildrenChanged();
private void Primitives_CollectionChanged(object sender, NotifyCollectionChangedEventArgs<Primitive> e) { this.buildPhotonMaps = true; }
private void onSamplesChanged(object sender, NotifyCollectionChangedEventArgs e) => LoadSamples();
private void RaiseCollectionChanged(NotifyCollectionChangedEventArgs e) { CollectionChanged?.Invoke(this, e); }
public static void RaiseCollectionChanged(this INotifyCollectionChanged sender, NotifyCollectionChangedEventArgs eventArgs) => Events.InvokeEvent(sender, nameof(INotifyCollectionChanged.CollectionChanged), eventArgs);
void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { UpdatePoints(); }
private void parentItemsContentChanged(object sender, NotifyCollectionChangedEventArgs e) { resetParentItems(); }
void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: if (e.NewStartingIndex != -1) { if (e.NewItems.Count == 1) { InsertItem(e.NewStartingIndex, (TItem)e.NewItems[0]); } else { InsertRange(e.NewStartingIndex, e.NewItems.Cast <TItem>()); } } else { AddRange(e.NewItems.Cast <TItem>()); } break; case NotifyCollectionChangedAction.Move: if (e.OldStartingIndex != -1) { RemoveRange(e.OldStartingIndex, e.OldItems.Count); } else { RemoveRange(e.OldItems.Cast <TItem>()); } InsertRange(e.NewStartingIndex, e.NewItems.Cast <TItem>()); break; case NotifyCollectionChangedAction.Remove: if (e.OldStartingIndex != -1) { if (e.OldItems.Count == 1) { RemoveItem(e.OldStartingIndex); } else { RemoveRange(e.OldStartingIndex, e.OldItems.Count); } } else { RemoveRange(e.OldItems.Cast <TItem>()); } break; case NotifyCollectionChangedAction.Replace: if (e.OldStartingIndex != -1) { RemoveRange(e.OldStartingIndex, e.OldItems.Count); InsertRange(e.OldStartingIndex, e.NewItems.Cast <TItem>()); } else { for (int i = 0; i < e.OldItems.Count; i++) { var index = IndexOf((TItem)e.OldItems[i]); RemoveItem(index); InsertItem(index, (TItem)e.NewItems[i]); } } break; case NotifyCollectionChangedAction.Reset: Reset(); break; } }
protected virtual void OnItemsCollectionChagned(object sender, NotifyCollectionChangedEventArgs e) => _tablayout.Visibility = (SectionController.GetItems().Count > 1) ? ViewStates.Visible : ViewStates.Gone;
private void SkippedRecurrencesCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { OnPropertyChanged(new PropertyChangedEventArgs("SkippedRecurrences")); }
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) { base.OnCollectionChanged(e); owner.Invalidate(); }
private void OnMenuItemsChanged(object sender, NotifyCollectionChangedEventArgs e) { QueueReset(); }
private void OnNotifyCollectionChanged(NotifyCollectionChangedEventArgs args) { this.CollectionChanged?.Invoke(this, args); }
private void BodyClauses_CollectionChanged (object sender, NotifyCollectionChangedEventArgs e) { ArgumentUtility.CheckNotNull ("e", e); ArgumentUtility.CheckItemsNotNullAndType ("e.NewItems", e.NewItems, typeof (IBodyClause)); if (e.NewItems != null) { foreach (var fromClause in e.NewItems.OfType<IFromClause>()) _uniqueIdentifierGenerator.AddKnownIdentifier (fromClause.ItemName); } }
/// <summary> /// This event will be called when the AdditonalQueryPrams dictionary changed. We have to reset the cached values. /// </summary> private void AdditionalQueryParams_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { BuiltQueryParams = null; }
void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { GridPanel panel = GridPanel; bool dataRowChange = false; switch (e.Action) { case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Add: foreach (GridElement item in e.NewItems) { if (panel != null && panel.VirtualMode == true) throw new Exception("Virtual Grid can not have nested items."); item.Parent = this; item.NeedsMeasured = true; if (panel != null) { GridRow row = item as GridRow; if (row != null) { dataRowChange = true; if (e.Action == NotifyCollectionChangedAction.Replace) panel.RemoveFromExpDictionary(row); panel.AddToExpDictionary(row); } else { panel.NeedToUpdateIndicees = true; } panel.ExpandDeletedAtIndex(FullIndex + 1, 1); panel.NeedToUpdateIndicees = true; } } if (dataRowChange == true && panel.GroupColumns.Count > 0) NeedsGrouped = true; break; case NotifyCollectionChangedAction.Reset: if (panel != null) { dataRowChange = true; panel.ClearAll(); panel.ExpDictionary.Clear(); } break; case NotifyCollectionChangedAction.Remove: if (panel != null) { dataRowChange = true; panel.ClearAll(); if (panel.ExpDictionary.Count > 0) { foreach (GridContainer item in e.OldItems) panel.RemoveFromExpDictionary(item as GridRow); } } break; } InvalidateLayout(); if (dataRowChange == true) { panel.UpdateRowCount(); SuperGrid.Invalidate(); } }
void Markers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if(e.NewItems != null) { foreach(GMapMarker obj in e.NewItems) { if(obj != null) { obj.Overlay = this; Control.UpdateMarkerLocalPosition(obj); } } } if(e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Reset) { #if !PocketPC if(Control.IsMouseOverMarker) { Control.IsMouseOverMarker = false; Control.Cursor = Cursors.Default; } #endif } if(!Control.HoldInvalidation) { Control.Core_OnNeedInvalidation(); } }
void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { GridPanel panel = GridPanel; if (panel != null) { panel.NeedToUpdateIndicees = true; panel.InvalidateLayout(); } }
private void vertices_CollectionChanged(object sender, NotifyCollectionChangedEventArgs<Point3D> e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Replace: this.Preprocess(); break; } }
private void Materials_CollectionChanged(object sender, NotifyCollectionChangedEventArgs<Material> e) { this.buildPhotonMaps = true; }
private void OnZoneCategoriesCollectionChanged(object sender, NotifyCollectionChangedEventArgs<IZoneCategory> e) { var referenceList = new List<IZoneCategory>(); if (e.Action != NotifyCollectionChangedAction.Move) { referenceList.AddRange(e.NewItems); referenceList.AddRange(e.OldItems); if (referenceList != null) { foreach (IZoneCategory currentItem in referenceList) { if (ZoneCategoryListChanged != null) { ZoneCategoryListChanged(this, currentItem); } } } } }
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args) { CollectionChanged?.Invoke(this, args); }
private void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) { InitItems(Items); }
/// <summary> /// Occurs when the items collection changes. /// </summary> private async void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { await CollectionChangedAsync(e); }
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e) { RaiseCollectionChanged(e); RaisePropertyChanged(new PropertyChangedEventArgs(nameof(Count))); }
private void OnPointCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { RegisterCollectionItemPropertyChanged(e.NewItems); UnRegisterCollectionItemPropertyChanged(e.OldItems); SetWrapToothRect(); }
void RepositoriesOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { UpdateTokens(); }
public static void Raise (this NotifyCollectionChangedEventHandler handler, object sender, NotifyCollectionChangedEventArgs e) { if (handler != null) handler (sender, e); }
private void ValueListChanged(object sender, NotifyCollectionChangedEventArgs e) { OnPropertyChanged(sender == ValueLeft ? nameof(ValueLeft) : nameof(ValueRight)); }
private void OnActivityCategoriesCollectionChanged( object sender, NotifyCollectionChangedEventArgs<IActivityCategory> e) { var referenceList = new List<IActivityCategory>(); if (e.Action != NotifyCollectionChangedAction.Move) { referenceList.AddRange(e.NewItems); referenceList.AddRange(e.OldItems); if (referenceList != null) { foreach (IActivityCategory currentItem in referenceList) { if (ActivityCategoryListChanged != null) { ActivityCategoryListChanged(this, currentItem); } } } } // Refresh our callbacks so that it registers the new categories this.UnregisterCategoryCallback(m_CurrentLogbook); this.RegisterCategoryCallback(m_CurrentLogbook); }
/// <summary> /// Handles quick access menu items chages /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnQuickAccessItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: for (var i = 0; i < e.NewItems.Count; i++) { if (this.menuDownButton != null) { this.menuDownButton.Items.Insert(e.NewStartingIndex + i + 1, e.NewItems[i]); } else { this.AddLogicalChild(e.NewItems[i]); } } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { if (this.menuDownButton != null) { this.menuDownButton.Items.Remove(item); } else { this.RemoveLogicalChild(item); } } break; case NotifyCollectionChangedAction.Replace: foreach (var item in e.OldItems) { if (this.menuDownButton != null) { this.menuDownButton.Items.Remove(item); } else { this.RemoveLogicalChild(item); } } var ii = 0; foreach (var item in e.NewItems) { if (this.menuDownButton != null) { this.menuDownButton.Items.Insert(e.NewStartingIndex + ii + 1, item); } else { this.AddLogicalChild(item); } ii++; } break; } }
protected override void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { base.CollectionChanged(sender, e); ValidateSelected(); }
private void _keyColumns_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { VulcanOnCollectionPropertyChanged("KeyColumns", e); }
void Markers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if(e.NewItems != null) { foreach(GMapMarker obj in e.NewItems) { if(obj != null) { obj.Overlay = this; if(Control != null) { Control.UpdateMarkerLocalPosition(obj); } } } } if(Control != null) { if(e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Reset) { if(Control.IsMouseOverMarker) { Control.IsMouseOverMarker = false; #if !PocketPC Control.RestoreCursorOnLeave(); #endif } } if(!Control.HoldInvalidation) { Control.Invalidate(); } } }
void notifyCollectionChanged_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: { int index = e.NewStartingIndex; foreach (var item in e.NewItems) AddItem(item, index++); UpdateItemsFinish(); } break; case NotifyCollectionChangedAction.Move: { int i = 0; foreach (var dataItem in e.OldItems) { if (dataItem == null) continue; int index = e.OldStartingIndex + i; if (index < 0 || index >= sourceCollection.Count) continue; var oldItem = sourceCollection[index]; if (oldItem == null) continue; var oldI = GetBindedItemFromData(oldItem); var newI = GetBindedItemFromData(dataItem); if (oldI == null || newI == null) continue; dic_obj_go[oldItem] = newI; SetDataContext(newI, oldItem); dic_obj_go[dataItem] = oldI; SetDataContext(oldI, dataItem); } } break; case NotifyCollectionChangedAction.Remove: { var itemList = new List<object>(); foreach (var item in e.OldItems) { if (item != null) { var node = GetBindedItemFromData(item); if (node != null) { dic_obj_go.Remove(item); itemList.Add(node); } } } itemsContainerNode.DestroyItems(itemList); UpdateItemsFinish(); } break; case NotifyCollectionChangedAction.Replace: { int oldItemsCount = e.OldItems.Count; int newItemsCount = e.NewItems.Count; int minCount = oldItemsCount < newItemsCount ? oldItemsCount : newItemsCount; for (int i = 0; i < minCount; ++i) { var oldItem = e.OldItems[i]; var newItem = e.NewItems[i]; if (oldItem == null || newItem == null) continue; var item = GetBindedItemFromData(oldItem); if (item == null) AddItem(item, e.OldStartingIndex + i); else { dic_obj_go.Remove(oldItem); dic_obj_go[newItem] = item; SetDataContext(item, newItem); } } } break; case NotifyCollectionChangedAction.Reset: UpdateItems(); break; } }