Exemple #1
0
        void ErrorView_DoubleClick(object sender, EventArgs e)
        {
            if (SelectedItems.Count == 1)
            {
                ActionResult ar = (ActionResult)SelectedItems[0].Tag;

                if (!File.Exists(ar.Location.Filename))
                {
                    return;
                }

                AdvancedTextBox atb = (ServiceHost.Project.Current == null ?
                                       ServiceHost.File.Open(ar.Location.Filename)
          : ServiceHost.Project.Current.OpenFile(ar.Location.Filename)) as AdvancedTextBox;

                if (atb != null)
                {
                    if (ar.Location.LineNumber > 0)
                    {
                        atb.Buffer.SelectLocation(ar.Location);
                        atb.ScrollToCaret();
                    }
                    ServiceHost.File.BringToFront(atb);
                }
            }
        }
Exemple #2
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            button1.BackColor = SystemColors.Control;
            RichTextBoxFinds options = 0;
            int end   = atb.TextLength - 1;
            int start = atb.SelectionStart + atb.SelectionLength;

            if (checkBox1.Checked)
            {
                options |= RichTextBoxFinds.MatchCase;
            }
            if (checkBox2.Checked)
            {
                options |= RichTextBoxFinds.WholeWord;
            }
            if (checkBox3.Checked)
            {
                options |= RichTextBoxFinds.Reverse;
                end      = start - 1;
                start    = 0;
            }
            if (checkBox4.Checked)
            {
                options |= RichTextBoxFinds.NoHighlight;
            }

            int    pos;
            string pat = lastfind = comboBox1.Text;

            pos = atb.Find(pat, start, end, options);
            if (pos != -1)
            {
                atb.Select(pos, pat.Length);
                atb.ScrollToCaret();
            }
            else
            {
                button1.Enabled = false;
            }
        }