private void CleanUpPaneAndControl(PaneAndControl target) { target.Control.CurrentHandler?.Dispose(); try { target.Pane.VisibleChanged -= Pane_VisibleChanged; CustomTaskPanes.Remove(target.Pane); } catch (ObjectDisposedException) { // 無視 } }