public void Clear() { lock (m_Dictionary) { m_Dictionary.Clear(); m_IndexClearedManager.Invoke(this, new EventArgs()); } }
public void AddRemoveHandlerTest() { var manager = new WeakEventManager <EventArgs>(); var validated = false; EventHandler <EventArgs> handler = (s, e) => { Assert.Equal(s, this); validated = true; }; manager.Add(handler); manager.Invoke(this, new EventArgs()); Assert.True(validated); validated = false; manager.Remove(handler); manager.Invoke(this, new EventArgs()); Assert.False(validated); }
public void AddOrFail(IEnumerable <T> items) { lock (m_Dictionary) { foreach (var item in items) { var key = m_Core.ExtractKey(item); m_Dictionary.Add(key, item); var insert = new DbChange(DbChangeType.Inserted, item.Table.Name, null, item); m_IndexChangedManager.Invoke(this, new DbIndexChangeEventArgs(new[] { insert })); } } }
public void FireTestEvent() { m_Manager.Invoke(this, new EventArgs()); }