public void OnFindInFilesResult(object sender, FindInFilesResultEventArgs args) { if (FindInFilesResult != null) FindInFilesResult(sender, args); }
void Manager_FindInFilesResult(object sender, FindInFilesResultEventArgs args) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate() { Manager_FindInFilesResult(sender, args); })); } else { HtmlElement element = outputBrowser.Document.CreateElement("p"); int id = m_resultCount++; element.Id = id.ToString(); element.SetAttribute("className", "result"); element.SetAttribute("myFile", args.File); element.SetAttribute("myLine", args.Line.ToString()); element.SetAttribute("myStartChar", args.StartChar.ToString()); element.SetAttribute("myEndChar", args.EndChar.ToString()); element.DoubleClick += new HtmlElementEventHandler(Result_DoubleClick); element.Click += new HtmlElementEventHandler(Result_Click); element.KeyDown += new HtmlElementEventHandler( delegate(object s, HtmlElementEventArgs e) { if (e.KeyPressedCode == (int) Keys.Up && id > 1) { SelectResult(id - 1); e.ReturnValue = true; } else if (e.KeyPressedCode == (int) Keys.Down && id < m_resultCount) { SelectResult(id + 1); e.ReturnValue = true; } } ); if (args.StartChar >= 0 && args.EndChar >= 0) { element.InnerHtml = System.Web.HttpUtility.HtmlEncode(String.Format("{0}({1}): {2}", args.File, args.Line, args.Message.Substring(0, args.StartChar))) + "<span class='match'>" + System.Web.HttpUtility.HtmlEncode(args.Message.Substring(args.StartChar, args.EndChar - args.StartChar)) + "</span>" + System.Web.HttpUtility.HtmlEncode(args.Message.Substring(args.EndChar)); } else { element.InnerText = String.Format("{0}({1}): {2}", args.File, args.Line, args.Message); } outputBrowser.Document.Body.AppendChild(element); // element.ScrollIntoView(false); } }