public void RemoveAllThumbs() { IEnumerator enumerator = thumbsContainer.Controls.GetEnumerator(); while (enumerator.MoveNext()) { VideoThumbControl thumbControl = enumerator.Current as VideoThumbControl; if (thumbControl != null) { thumbControl.Selected -= new VideoThumbControl.SelectEventHandler(thumbControl_Selected); } } thumbsContainer.Controls.Clear(); thumbsContainer.ActiveThumbControlIndex = -1; }
public void AddThumb(Bitmap bitmap, HeaderTree headerTree, IDataPacket sourceNode) { // TODO: why is this property not true when the is disposed? if (this.IsDisposed || thumbsContainer.IsDisposed) { return; } // Execute Add method in Thread context of the Form. this.Invoke((MethodInvoker) delegate { VideoThumbControl thumbControl = new VideoThumbControl(bitmap, headerTree, sourceNode); thumbControl.Selected += new VideoThumbControl.SelectEventHandler(thumbControl_Selected); thumbsContainer.Controls.Add(thumbControl); UpdateProgress(); }); }