Пример #1
0
        private void OnFind(FindEventArgs e)
        {
            var find = Find;

            if (find != null)
            {
                find(e);
            }
        }
Пример #2
0
        void findDialog_Find(FindEventArgs e)
        {
            var stop = false;

            if (e.SearchLeft)
            {
                stop = FindInTextBox(rtbLeft, e.Text, e.UseRegularExpressions, e.CaseSensitive);
            }
            if (e.SearchRight && !stop)
            {
                stop = FindInTextBox(rtbRight, e.Text, e.UseRegularExpressions, e.CaseSensitive);
            }

            if (stop)
            {
                lastSuccessfulSearch = e.Text;
            }
            else
            {
                if (lastSuccessfulSearch == e.Text)
                {
                    MessageBox.Show("No more matches found; restarting from the top.", formTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    if (e.SearchLeft)
                    {
                        rtbLeft.SelectionStart = 0;
                    }
                    if (e.SearchRight)
                    {
                        rtbRight.SelectionStart = 0;
                    }

                    if (e.SearchLeft)
                    {
                        stop = FindInTextBox(rtbLeft, e.Text, e.UseRegularExpressions, e.CaseSensitive);
                    }
                    if (e.SearchRight && !stop)
                    {
                        stop = FindInTextBox(rtbRight, e.Text, e.UseRegularExpressions, e.CaseSensitive);
                    }
                }

                if (!stop)
                {
                    MessageBox.Show("No matches found.", formTitle, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }