示例#1
0
        void buttonReplaceAll_Click(object sender, EventArgs e)
        {
            // todo: replace all is too slow on large files, it should do this in batch mode.
            // todo: would be nice if XPath could select elements or attribute for deletion.

            UndoManager mgr = (UndoManager)this.Site.GetService(typeof(UndoManager));

            mgr.OpenCompoundAction("Replace All");
            try
            {
                string replacement = this.comboBoxReplace.Text;
                _target.ReplaceCurrent(replacement);
                bool rc = FindNext(false);
                while (rc)
                {
                    Application.DoEvents();
                    _target.ReplaceCurrent(replacement);
                    rc = FindNext(true);
                }
            }
            catch (Exception ex)
            {
                OnError(ex, SR.ReplaceErrorCaption);
            }
            finally
            {
                mgr.CloseCompoundAction();
            }
        }
        void buttonReplaceAll_Click(object sender, EventArgs e)
        {
            UndoManager mgr = (UndoManager)this.Site.GetService(typeof(UndoManager));

            mgr.OpenCompoundAction("Replace All");
            try {
                string replacement = this.comboBoxReplace.Text;
                target.ReplaceCurrent(replacement);
                bool rc = FindNext(false);
                while (rc)
                {
                    Application.DoEvents();
                    target.ReplaceCurrent(replacement);
                    rc = FindNext(true);
                }
            } catch (Exception ex) {
                OnError(ex, SR.ReplaceErrorCaption);
            } finally {
                mgr.CloseCompoundAction();
            }
        }