public static void Replace(PwDatabase pd, XmlReplaceOptions opt)
        {
            if (pd == null)
            {
                Debug.Assert(false); return;
            }
            if (opt == null)
            {
                Debug.Assert(false); return;
            }

            StatusProgressForm dlg = null;

            try
            {
                if ((opt.Flags & XmlReplaceFlags.StatusUI) != XmlReplaceFlags.None)
                {
                    dlg = StatusProgressForm.ConstructEx(KPRes.XmlReplace,
                                                         true, false, opt.ParentForm, KPRes.XmlReplace + "...");
                }

                PerformXmlReplace(pd, opt, dlg);
            }
            finally
            {
                if (dlg != null)
                {
                    StatusProgressForm.DestroyEx(dlg);
                }
            }
        }
        private void DestroyStatusDialog(StatusProgressForm dlg)
        {
            if (dlg != null)
            {
                MainForm mfOwner = ((m_fOwner != null) ? (m_fOwner as MainForm) : null);
                if ((m_bUseThread == false) && (mfOwner != null))
                {
                    // mfOwner.RedirectActivationPop();
                    mfOwner.UIBlockInteraction(false);
                }

                StatusProgressForm.DestroyEx(dlg);

                // Conflict with 3116455
                // if(mfOwner != null) mfOwner.Activate(); // Prevent disappearing
            }
        }