public new void Insert(Int32 index, T item) { base.Insert(index, item); OnAdd?.Invoke(ref item); OnInsert?.Invoke(index, ref item); ItemsChanged?.Invoke(); }
public void OnDeserializeAll(NetworkReader reader) { // This list can now only be modified by synchronization IsReadOnly = true; // if init, write the full list content int count = (int)reader.ReadPackedUInt32(); objects.Clear(); OnClear?.Invoke(); changes.Clear(); for (int i = 0; i < count; i++) { T obj = reader.Read <T>(); objects.Add(obj); OnInsert?.Invoke(i, obj); } // We will need to skip all these changes // the next time the list is synchronized // because they have already been applied changesAhead = (int)reader.ReadPackedUInt32(); OnChange?.Invoke(); }
public void Insert(T Data) { Node <T> before = null, after = this.Root; while (after != null) { before = after; if (Data.CompareTo(after.Data) == -1) { after = after.Left; } else { after = after.Right; } } Node <T> newNode = new Node <T>(Data); if (this.Root == null) { this.Root = newNode; } else if (Data.CompareTo(before.Data) == -1) { before.Left = newNode; } else { before.Right = newNode; } OnInsert?.Invoke(this, new MyTreeEventArgs <T>(newNode.Data)); }
private void RaiseEvents(Operation op, int itemIndex, T oldItem, T newItem) { switch (op) { case Operation.OP_ADD: OnInsert?.Invoke(objects.Count - 1, newItem); break; case Operation.OP_CLEAR: OnClear?.Invoke(); break; case Operation.OP_INSERT: OnInsert?.Invoke(itemIndex, newItem); break; case Operation.OP_REMOVEAT: OnRemove?.Invoke(itemIndex, oldItem); break; case Operation.OP_SET: OnSet?.Invoke(itemIndex, oldItem, newItem); break; } }
private void WriteToDb() { while (true) { try { while (DateTime.Now.Second != 0) { Thread.Sleep(TimeSpan.FromMilliseconds(400)); } try { new TemperatureFrameDatabaseAdapter().Insert(GetFromQueues()); } catch { } OnInsert?.Invoke(this, EventArgs.Empty); Thread.Sleep(TimeSpan.FromSeconds(1)); } catch (ThreadAbortException) { break; } } }
public void Insert(string key, object value) { VerifyInstance(); _inner.Insert(key, value); OnInsert?.Invoke(new CacheEventArgs(CacheOperation.Insert, key, CacheKeyHelper.GetResourceKeyFromCacheKey(key))); }
public new void Insert(int index, T item) { base.Insert(index, item); if (OnInsert != null) { OnInsert.Invoke(this, new NListEventArgs <T>(item, index)); } }
public new void Add(T item) { base.Add(item); if (OnInsert != null) { OnInsert.Invoke(this, new NListEventArgs <T>(item, this.Count)); } }
private void DeserializeAdd(NetworkReader reader, bool apply) { T newItem = reader.Read <T>(); if (apply) { objects.Add(newItem); OnInsert?.Invoke(objects.Count - 1, newItem); } }
public void Insert(string key, object value) { VerifyInstance(); var resourceKey = CacheKeyHelper.GetResourceKeyFromCacheKey(key); _inner.Insert(key, value); KnownResourceKeys.TryAdd(resourceKey, null); OnInsert?.Invoke(new CacheEventArgs(CacheOperation.Insert, key, resourceKey)); }
private void DeserializeInsert(NetworkReader reader, bool apply) { int index = (int)reader.ReadPackedUInt32(); T newItem = reader.Read <T>(); if (apply) { objects.Insert(index, newItem); OnInsert?.Invoke(index, newItem); } }
private void DeserializeAdd(NetworkReader reader, bool apply) { TKey key = reader.Read <TKey>(); TValue item = reader.Read <TValue>(); if (apply) { objects[key] = item; OnInsert?.Invoke(key, item); } }
public async Task ForceInsert() { if (Quene.Count <= 0) { return; } OnInsert?.Invoke(); await Collection.InsertManyAsync(Quene).ConfigureAwait(false); Quene.Clear(); }
public new void InsertRange(int index, IEnumerable <T> collection) { base.InsertRange(index, collection); foreach (var item in collection) { if (OnInsert != null) { OnInsert.Invoke(this, new NListEventArgs <T>(item, index)); } index++; } }
public new void Insert(int index, T item) { if (OnInsert != null) { NListInhEventArgs<T> vArgs = new NListInhEventArgs<T>(item, index); OnInsert.Invoke(this, vArgs); if (vArgs.Inherited) base.Insert(index, item); } else base.Insert(index, item); }
public new void Add(T item) { if (OnInsert != null) { NListInhEventArgs<T> vArgs = new NListInhEventArgs<T>(item, this.Count); OnInsert.Invoke(this, vArgs); if (vArgs.Inherited) base.Add(item); } else base.Add(item); }
public new void AddRange(IEnumerable<T> collection) { Int32 Index = base.Count; base.AddRange(collection); foreach (var item in collection) { if (OnInsert != null) { OnInsert.Invoke(this, new NListEventArgs<T>(item, Index)); } Index++; } }
public void Insert(string key, object value, bool insertIntoKnownResourceKeys) { VerifyInstance(); _inner.Insert(key.ToLower(), value, insertIntoKnownResourceKeys); var resourceKey = CacheKeyHelper.GetResourceKeyFromCacheKey(key); if (insertIntoKnownResourceKeys) { _knownResourceKeys.TryAdd(resourceKey, null); } OnInsert?.Invoke(new CacheEventArgs(CacheOperation.Insert, key, resourceKey)); }
/// <summary> /// Inserts a string into the string table at a zero-based index position. /// </summary> public static int Insert(int index, string str) { SampleCsStringTable string_table = SampleCsStringTable.Instance; int rc = string_table.Insert(index, str); if (rc >= 0) { // Invoke event if (null != OnInsert) { OnInsert.Invoke(index, str); } } return(rc); }
public new void InsertRange(int index, IEnumerable<T> collection) { if (OnInsert != null) { foreach (var item in collection) { NListInhEventArgs<T> vArgs = new NListInhEventArgs<T>(item, index); OnInsert.Invoke(this, vArgs); if (vArgs.Inherited) base.Insert(index, item); index++; } } else base.InsertRange(index, collection); }
///<inheritdoc/> public void Insert(int index, T item) { index = IndexProcessor(_len, index); int insertIndex = index; if (insertIndex != _arr.Length - 1) { EnsureCapacity(_len + 2, false); Array.Copy(_arr, insertIndex, _arr, insertIndex + 1, _len - insertIndex); _arr[insertIndex] = item; _len++; } else { Add(item); } OnInsert?.Invoke(item, index); _len++; }
private void RaiseEvents(Operation op, TKey key, TValue value, TValue oldValue) { switch (op) { case Operation.OP_ADD: OnInsert?.Invoke(key, value); break; case Operation.OP_CLEAR: OnClear?.Invoke(); break; case Operation.OP_REMOVE: OnRemove?.Invoke(key, value); break; case Operation.OP_SET: OnSet?.Invoke(key, oldValue, value); break; } }
public virtual void Add(T item) { lock (Items) { if (item == null) { throw new ArgumentNullException("Item cant be null"); } if (Items.Contains(item)) { throw new ArgumentException("Item is already part of this collection"); } // Control einfügen Items.Add(item); // Event werfen OnInsert?.Invoke(item, Items.IndexOf(item)); } }
public new void AddRange(IEnumerable <T> collection) { Int32 index = base.Count; if (OnInsert != null) { foreach (var item in collection) { NListInhEventArgs <T> vArgs = new NListInhEventArgs <T>(item, index); OnInsert.Invoke(this, vArgs); if (vArgs.Inherited) { base.Insert(index, item); } index++; } } else { base.AddRange(collection); } }
protected void RaiseOnInsert(T t) => OnInsert?.Invoke(t);
public void Add(T data) { OnInsert?.Invoke(this, new BinaryTreeEventArgs <T>(data)); Add(new Node <T>(data)); }
public void Add(T item) { objects.Add(item); OnInsert?.Invoke(objects.Count - 1, item); AddOperation(Operation.OP_ADD, objects.Count - 1, item); }
public void Insert(Int32 index, GenericListViewItem <T> item) { _items.Insert(index, item ?? throw new ArgumentNullException(nameof(item))); OnInsert?.Invoke(index, ref item); ItemsChanged?.Invoke(); }