public virtual void OnDestroy() { if (Removed != null) { Removed.Invoke(this); } }
public void Remove(T element) { _list.Remove(element); Removed.Invoke(this, new RemovedEventArgs <T> { Element = element }); }
private void Child_Removed(object value) { if (Removed != null) { Removed.Invoke(value as UIElement); } }
public void Remove() { if (Removed != null) { Removed.Invoke(this); } }
protected virtual void OnRemoved(EventArgs e) { if (Removed != null) { Removed.Invoke(this, e); } }
public override void Remove(Panel panel) { if (!_materialPanels.Contains((MaterialPanel)panel)) { return; } _materialPanels.Remove((MaterialPanel)panel); RemovePanelFromColumns(panel); panel.Destroy(); Removed.Invoke(panel); }
public override void Remove(Panel panel) { if (!_kvid3Panels.Contains((KVID3Panel)panel)) { return; } _kvid3Panels.Remove((KVID3Panel)panel); RemovePanelFromColumns(panel); panel.Destroy(); Removed.Invoke(panel); }
internal static void Remove(DBProfile profile) { profile.Saved = false; s_profiles.Remove(profile.Handle); if (Removed != null) { Removed.Invoke(profile); } if (s_profiles.Count == 0 && NoProfiles != null) { NoProfiles.Invoke(); } }
/// <summary> /// Replaces the Remove method in order to fire the Removed and Changed events. /// </summary> public new bool Remove(T item) { // Call base class implementation to remove item from list bool result = base.Remove(item); // Fire events (if removed) if (result) { Removed?.Invoke(this, EventArgs.Empty); Changed?.Invoke(this, EventArgs.Empty); } // Return result return(result); }
public bool Remove(object value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (OnRemove(value)) { Removed?.Invoke(this, value); return(true); } return(false); }
public void RemoveRange(IEnumerable <T> items) { _suppressCollectionChangedEvent = true; try { foreach (T item in items) { Remove(item); } Removed?.Invoke(this, new DataEventArgs <IEnumerable>(items)); } finally { _suppressCollectionChangedEvent = false; } }
public BlogOperationResult Remove(User entity) { if (!Exists(entity)) { return(BlogOperationResult.UserDoesNotExist); } using (_db = new BlogEngineDbContext()) { _db.Users.Remove(entity); Removed?.Invoke(this, "user-removed-message", entity); _db.SaveChanges(); } return(BlogOperationResult.OK); }
void ISecurityStorage.DeleteBy(Security criteria) { var removed = new List <Security>(); foreach (var security in _securities.Cache.Filter(criteria)) { if (_securities.Remove(security)) { removed.Add(security); } } Removed?.Invoke(removed); Save(); }
internal bool TryRemove(InstallationLocation oldItem) { if (oldItem == null) { return(false); } if (!Items.Remove(oldItem)) { return(false); } oldItem.DeleteSettings(); Removed?.Invoke(this, new LocationEvent(oldItem)); return(true); }
private void _navigationStack_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) { foreach (var item in e.OldItems) { Removed?.Invoke((ViewModelBase)item); } } else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { foreach (var item in e.NewItems) { Added?.Invoke((ViewModelBase)item); } } }
public bool Remove(T item) { Node prev = null; Node current = First; while (current != null) { if (Equals(current.Item, item)) { if (prev != null) { prev.Next = current.Next; if (current.Next == null) { Last = prev; } else { current.Next.Prev = prev; } Count--; } else { if (Count != 0) { First = First.Next; Count--; if (Count == 0) { Last = null; } else { First.Prev = null; } } } Removed?.Invoke(item); return(true); } prev = current; current = current.Next; } return(false); }
public bool Remove(T item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (Remove(ref root, item)) { Count--; Removed?.Invoke(this, new BinaryTreeItemRemovedEventArgs <T>(item)); return(true); } return(false); }
private static void remove(List <CacheEntry> entries) { if (entries is null) { return; } lock (locker) { foreach (var entry in entries) { cache.Remove(entry); Removed?.Invoke(null, entry); } save(); } }
public bool Remove(T _item) //Удаляет первое вхождение указанного объекта { Node <T> prev = null; Node <T> current = first; while (current != null) { if (Equals(current.item, _item)) { if (prev != null) { prev.next = current.next; if (current.next == null) { last = prev; } else { current.next.prev = prev; } Count--; } else { if (!isEmpty()) { first = first.next; Count--; if (isEmpty()) { last = null; } else { first.prev = null; } } } Removed?.Invoke(_item); return(true); } prev = current; current = current.next; } return(false); }
public void Clear() { if (Count == 0) { return; } Diagram.Batch(() => { for (var i = _items.Count - 1; i >= 0; i--) { var item = _items[i]; _items.RemoveAt(i); OnItemRemoved(item); Removed?.Invoke(item); } }); }
public bool Remove(TId id) { if (m_typeId.IsClass && EqualityComparer <TId> .Default.Equals(id, default)) { throw new ArgumentNullException(nameof(id)); } if (m_entries.TryGetValue(id, out TEntry entry)) { OnRemove(id, entry); Removed?.Invoke(this, id, entry); m_removedHandler?.Invoke(this, id, entry); return(true); } return(false); }
private void Remove(int index, T item) { if (ReferenceEquals(item, null)) { return; } dict.Remove(item); INotifyPropertyChanged changedItem = item as INotifyPropertyChanged; if (changedItem != null) { changedItem.PropertyChanged -= Item_PropertyChanged; } Removed?.Invoke(this, new ChangedEventArgs <T>(index, item)); }
public bool Remove(TKey query, TValue value) { if (query == null || value == null) { return(false); } Debug.WriteLine($"Removing \"{value}\" for \"{query}\" query to index. Thread = {Thread.CurrentThread.ManagedThreadId}"); var isRemoved = RemoveIndex(query, value); if (isRemoved) { Removed?.Invoke(query, new [] { value }); } return(isRemoved); }
public bool RemoveById(int id) { var document = XDocument.Load(_storageFileInfo.FullName); var match = document.Root.Elements() .FirstOrDefault(xElement => xElement.FromXElement <T>().Id == id); if (match == null) { return(false); } var entity = match.FromXElement <T>(); match.Remove(); document.Save(_storageFileInfo.FullName); Removed?.Invoke(this, entity); return(true); }
private static void RemoveAsync(int progid) { lock (DbUpdateLock) { using (SQLiteCommand command = new SQLiteCommand("delete from subscriptions where progid=@progid", FetchDbConn())) { command.Parameters.Add(new SQLiteParameter("@progid", progid)); if (command.ExecuteNonQuery() == 0) { // Subscription has already been removed return; } } } RaiseUpdated(progid); Removed?.Invoke(progid); }
internal void RefreshConnectedFlag() { var newConnectedFlag = HidDevices.IsConnected(_devicePath); if (newConnectedFlag != isConnectedFlag) { if (newConnectedFlag) { ReconnectDevice(); Inserted?.Invoke(); } else { Removed?.Invoke(); } } isConnectedFlag = newConnectedFlag; }
public bool RemoveAll(TKey query, out IEnumerable <TValue> old) { old = default; if (query == null) { return(false); } Debug.WriteLine($"Removing whole index for \"{query}\". Thread = {Thread.CurrentThread.ManagedThreadId}"); var isRemoved = RemoveAllIndex(query, out old); if (isRemoved) { Removed?.Invoke(query, old); } return(isRemoved); }
//Удаление элемента public bool Remove(T item) { Object node = new Object(); node = first; for (int i = 0; i < count; i++) { if (node.current.Equals(item)) { if (i == 0) { if (count == 1) { first = null; last = null; } else { first = node.next; node.next.previous = null; } } else { if (i == count - 1) { last = node.previous; node.previous.next = null; } else { node.previous.next = node.next.previous; node.next.previous = node.previous.next; } } count--; Removed?.Invoke(this, item); return(true); } node = node.next; } return(false); }
public void Update() { var added = mCollection.Except(mLastUpdated); foreach (var elem in added) { Added?.Invoke(this, new CollectionChangedEventArgs <T>(elem)); } var removed = mLastUpdated.Except(mCollection); foreach (var elem in removed) { Removed?.Invoke(this, new CollectionChangedEventArgs <T>(elem)); } mLastUpdated.Clear(); mLastUpdated.AddRange(mCollection); }
public virtual void Remove(IEnumerable <T> items) { if (items is null) { throw new ArgumentNullException(nameof(items)); } Diagram.Batch(() => { foreach (var item in items) { if (_items.Remove(item)) { OnItemRemoved(item); Removed?.Invoke(item); } } }); }