public override bool RemoveItem(AbstractDockItem item) { if (item is TimerMainDockItem) { Items = Enumerable.Empty <AbstractDockItem> (); foreach (AbstractDockItem adi in items) { if (adi is TimerDockItem) { (adi as TimerDockItem).Finished -= HandleTimerFinished; } adi.Dispose(); } } else { TimerDockItem timer = item as TimerDockItem; timer.Finished -= HandleTimerFinished; items.Remove(timer); Items = items; timer.Dispose(); } return(true); }
void HandleTimerFinished(object o, EventArgs args) { TimerDockItem timer = o as TimerDockItem; timer.Finished -= HandleTimerFinished; items.Remove(timer); Items = items; timer.Dispose(); }