コード例 #1
0
        //=====================================================================

        /// <summary>
        /// This handles the Perform Find Text event
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void editor_PerformFindText(object sender, EventArgs e)
        {
            FindAndReplaceWindow findWindow = null;

            foreach (IDockContent content in this.DockPanel.Contents)
            {
                findWindow = content as FindAndReplaceWindow;

                if (findWindow != null)
                {
                    break;
                }
            }

            if (findWindow != null && findWindow.Visible)
            {
                if (!findWindow.ShowReplaceControls(false) &&
                    !String.IsNullOrEmpty(findWindow.FindText))
                {
                    if (!this.FindText(findWindow.FindText,
                                       findWindow.CaseSensitive))
                    {
                        MessageBox.Show("The specified text was not found",
                                        Constants.AppName, MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    findWindow.Activate();
                }
            }
            else
            if (findWindow == null)
            {
                findWindow = new FindAndReplaceWindow();
                findWindow.Show(this.DockPanel);
            }
            else
            {
                findWindow.Activate();
                findWindow.ShowReplaceControls(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// This handles the Perform Replace Text event
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void editor_PerformReplaceText(object sender, EventArgs e)
        {
            FindAndReplaceWindow findWindow = null;

            foreach (IDockContent content in this.DockPanel.Contents)
            {
                findWindow = content as FindAndReplaceWindow;

                if (findWindow != null)
                {
                    break;
                }
            }

            if (findWindow != null && findWindow.Visible)
            {
                if (findWindow.ShowReplaceControls(true) &&
                    !String.IsNullOrEmpty(findWindow.FindText))
                {
                    this.ReplaceText(findWindow.FindText, findWindow.ReplaceWith,
                                     findWindow.CaseSensitive);
                }
                else
                {
                    findWindow.Activate();
                }
            }
            else
            if (findWindow == null)
            {
                findWindow = new FindAndReplaceWindow();
                findWindow.Show(this.DockPanel);
                findWindow.ShowReplaceControls(true);
            }
            else
            {
                findWindow.Activate();
                findWindow.ShowReplaceControls(true);
            }
        }