private void AddItemExpanded(ImageCollection imagecollection) { Panel PanelItem; int index; foreach (ImageItem img in imagecollection.Images) { index = this.Controls.Count; CreateItemPanel(img, imagecollection.Name, index, out PanelItem); PanelItem.Location = new Point(index * PanelItem.Width, 0); PanelItem.Controls[0].Controls[0].Click += new EventHandler(ExpandedCheck_Click); this.Controls.Add(PanelItem); if (img.Checked) { Items.Add(new ListItem(CheckState.Checked, img, PanelItem, this)); } else { Items.Add(new ListItem(CheckState.Unchecked, img, PanelItem, this)); } if (ItemAdded != null) { ItemAdded.Invoke(null, null); } } }
// Inserts an element into this list at a given index. The size of the list // is increased by one. If required, the capacity of the list is doubled // before inserting the new element. // public void Insert(int index, T item) { // Note that insertions at the end are legal. if ((uint)index > (uint)_size) { throw new InvalidOperationException("Argument out of range"); } Contract.EndContractBlock(); if (_size == _items.Length) { EnsureCapacity(_size + 1); } if (index < _size) { Array.Copy(_items, index, _items, index + 1, _size - index); } _items[index] = item; _size++; _version++; if (ItemAdded != null) { ItemAdded.Invoke((T)_items[index]); } }
public new void Add(T item) { int c = Count; base.Add(item); if (ItemAdded != null && c != Count) ItemAdded.Invoke(this, new EventArgs()); } // Add
} // AddRange public new void Insert(int index, T item) { int c = Count; base.Insert(index, item); if (ItemAdded != null && c != Count) ItemAdded.Invoke(this, new EventArgs()); } // Insert
} // Clear public new void AddRange(IEnumerable<T> collection) { int c = Count; base.AddRange(collection); if (ItemAdded != null && c != Count) ItemAdded.Invoke(this, new EventArgs()); } // AddRange
} // Insert public new void InsertRange(int index, IEnumerable<T> collection) { int c = Count; base.InsertRange(index, collection); if (ItemAdded != null && c != Count) ItemAdded.Invoke(this, new EventArgs()); } // InsertRange
protected void OnItemAdded(object sender) { if (ItemAdded != null) { ItemAdded.Invoke(sender, new System.EventArgs()); } }
public void OverwriteAt(int index, Control c, bool fitted = false) { if (!ValidIndex(index)) { return; } if (cells[index] != null) { Remove(cells[index]); if (ItemRemoved != null) { ItemRemoved.Invoke(this, new EventArgs()); } } cells[index] = c; fitToCell[index] = fitted; Add(c); if (ItemAdded != null) { ItemAdded.Invoke(this, new EventArgs()); } }
private void ExtendedListbox_DragDropCompleted(object sender, DragEventArgs e) { try { //prevent to do drag drop in the same window - will create an item copy if (((extendedListbox <T>)sender).Name != _Source.Name) { //change target - step 1 update the items in the box if (!(((extendedListbox <T>)sender).Items.Contains(_Source.SelectedItem))) { ((extendedListbox <T>)sender).Items.Add(_Source.SelectedItem); if (((extendedListbox <T>)sender).ItemAdded != null) { ItemAdded.Invoke((extendedListbox <T>)sender, (T)_Source.SelectedItem); } if (_Source.ItemRemoved != null) { _Source.ItemRemoved.Invoke(_Source, (T)_Source.SelectedItem); } _Source.Items.Remove(_Source.SelectedItem); } } } catch (Exception ee) { } DragDropBusy = false; }
// 添加项事件,自定义事件 protected virtual void EventAddItems(int itemcount) { if (ItemAdded != null) { ItemAdded.Invoke(this, new CEventSingleArgs <int>(itemcount)); } RefreshItems(); }
public void AddItem(KeyCollectionItem item) { Items.Add(item); if (ItemAdded != null) { ItemAdded.Invoke(item); } }
/// <summary> /// Update a <see cref="T"/> in the database. /// </summary> /// <param name="item">The item to update.</param> public void Update(T item) { using (var usage = ContextFactory.GetForWrite()) usage.Context.Update(item); ItemRemoved?.Invoke(item); ItemAdded?.Invoke(item); }
public void AddItem(ListViewItem item) { Items.Add(item); if (ItemAdded != null) { ItemAdded.Invoke(this, new ItemsAddedArgs(item)); } }
public new void AddRange(IEnumerable <T> objs) { foreach (var obj in objs) { base.Add(obj); ItemAdded?.Invoke(this, new EventListArgs <T>(obj)); } }
/// <summary> /// Called when [insert]. /// </summary> /// <param name="index">The index.</param> /// <param name="value">The value.</param> protected virtual void OnItemAdded(int index, T value) { if (value != null) { value.PropertyChanged += OnItemPropertyChanged; ItemAdded?.Invoke(this, new ListChangedEventArgs <T>(ListChangedType.ItemAdded, value, index)); } }
public void Report(ContentItem item) { readItems.Add(item); if (ItemAdded != null) { ItemAdded.Invoke(this, new ItemEventArgs(item)); } }
public void AddPlaylistItem(IVideoContent item) { _playlistRepository.AddItem(Id, item.Id); ItemAdded?.Invoke(this, new LocalPlaylistItemAddedEventArgs() { PlaylistId = Id, AddedItems = new[] { item.Id } }); }
/// <summary> /// Raises <see cref="CollectionModified" /> and <see cref="ItemAdded" /> events /// </summary> /// <param name="e">An <see cref="EasyTabs.EventList.ListItemEventArgs" /> that contains the event data</param> protected virtual void OnItemAdded(ListItemEventArgs e) { if (IgnoreEvents) { return; } ItemAdded?.Invoke(this, e); OnCollectionModified(new ListModificationEventArgs(ListModification.ItemAdded, e.ItemIndex, 1)); }
public new void AddRange(IEnumerable <T> collection) { base.AddRange(collection); if (collection.Count() > 0) { ItemAdded?.Invoke(); ItemsChanged?.Invoke(); } }
public void AddItem(Entity item) { items [item.Id] = item; ItemAdded?.Invoke(this, new InventoryEventArgs(item)); var nc = NSNotificationCenter.DefaultCenter; nc.PostNotificationName(ItemCollectedNotification, item); }
public new void InsertRange(int index, IEnumerable <T> collection) { base.InsertRange(index, collection); if (collection.Count() > 0) { ItemAdded?.Invoke(); ItemsChanged?.Invoke(); } }
protected void OnItemAdded() { if (_disableChangeEvents > 0) { return; } UpdateScrollbar(); ItemAdded?.Invoke(this); }
public virtual void Add(TItem item) { if (_Items.Contains(item)) { return; } _Items.Add(item); ItemAdded?.Invoke(this, item); }
public override Boolean TryInsert(Int32 index, GenericListViewItem <T> lvitem) { if (!base.TryInsert(index, lvitem)) { return(false); } ItemAdded?.Invoke(index, lvitem); return(true); }
public void AddItem(IInventoryItem item) { if (item == null || items.Contains(item)) { return; } items.Add(item); ItemAdded?.Invoke(item); }
public void Add(TKey key, TValue value) { if (Contains(key)) { return; } _map.Add(key, value); ItemAdded?.Invoke(this, new KeyValueMapItemAddedEventArgs <TKey, TValue>(this, key, value)); }
private void ViewChannels_ItemAdded(object sender, ListEventArgs <ViewChannel> e) { e.Item.ColorChanged += ViewChannel_ColorChanged; e.Item.NameChanged += ViewChannel_ValueChanged; e.Item.VisibleChanged += ViewChannel_ValueChanged; m_BindingSource.ResetBindings(false); ItemAdded?.Invoke(this, e); }
/// <summary> /// Add a <see cref="T"/> to the database. /// </summary> /// <param name="item">The item to add.</param> public void Add(T item) { using (var usage = ContextFactory.GetForWrite()) { var context = usage.Context; context.Attach(item); } ItemAdded?.Invoke(item); }
public new void Add(T item) { int c = this.Count; base.Add(item); if (ItemAdded != null && c != this.Count) { ItemAdded.Invoke(item, new EventArgs()); } }
public new void Insert(int index, T item) { int c = this.Count; base.Insert(index, item); if (ItemAdded != null && c != this.Count) { ItemAdded.Invoke(item, new EventArgs()); } }