private void StateManager_Cleared(object sender, EventArgs e) { this.InvokeSafe(new System.Action(() => { if (Monitor.TryEnter(lpScannedFiles, TIMEOUT)) { try { foreach (ItemControl cnt in lpScannedFiles.Controls) { cnt.Click -= new EventHandler(ImageIconControl_Click); cnt.Updated -= new EventHandler(ImageIconControl_Updated); //cnt.DisposeSf(); ItemControl.SetInstance(cnt); } ToolTip1.RemoveAll(); lpScannedFiles.Controls.Clear(); tbTransferFile.Clear(); m_ScanFileOrganizer.Clear(); m_SendFileOrganizer.Clear(); lblItemsWithErr.Text = null; lblMessage.Text = string.Empty; } finally { Monitor.Exit(lpScannedFiles); } } //m_ControlIndexes.Clear(); })); }