public static void DestroyEx(StatusProgressForm dlg) { if (dlg == null) { Debug.Assert(false); return; } dlg.EndLogging(); dlg.CloseEx(); UIUtil.DestroyForm(dlg); }