/// <summary> /// Releases all resources used by the <see cref="Component"/>. /// </summary> protected virtual void Dispose(bool disposing) { if (!Disposed) { if (disposing) { Timer.Elapsed -= Timer_Elapsed; // if an action is staged, invoke it to 'flush' if (FlushOnDispose) { Staged?.Invoke(); } Staged = null; Timer.Dispose(); } Disposed = true; } }
private void Timer_Elapsed(object sender, EventArgs args) { Staged?.Invoke(); Staged = null; }