Bend.MainWindow.UpdateFind C# (CSharp) Method

UpdateFind() public method

public UpdateFind ( string findText, bool highLightFirstMatch, bool matchCase, bool useRegex ) : void
findText string
highLightFirstMatch bool
matchCase bool
useRegex bool
return void
        public void UpdateFind(string findText, bool highLightFirstMatch, bool matchCase, bool useRegex)
        {
            if (this.currentTabIndex >= 0)
            {
                string text = tab[this.currentTabIndex].TextEditor.Text;
                TextEditor textEditor = tab[this.currentTabIndex].TextEditor;
                if (this.findOnPageThread != null)
                {
                    this.findOnPageThread.Abort();
                    this.findOnPageThread = null;
                }
                if (findText.Length > 0 && text.Length > 0)
                {
                    this.findOnPageThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(UpdateFind_WorkerThread));
                    this.findOnPageThread.IsBackground = true;
                    Object[] parameters = new Object[7];
                    parameters[0] = text;
                    parameters[1] = findText;
                    parameters[2] = highLightFirstMatch;
                    parameters[3] = matchCase;
                    parameters[4] = useRegex;
                    parameters[5] = null;
                    parameters[6] = textEditor;
                    this.findOnPageThread.Start(parameters);
                }
                else
                {
                    textEditor.Select(0, 0, true);
                    this.SetStatusText("NO MATCHES FOUND");
                }
            }
        }

Usage Example

Ejemplo n.º 1
0
 private void Find_Changed(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count != 0)
     {
         mainWindow.UpdateFind(e.AddedItems[0].ToString(), true, this.MatchCase.IsChecked ?? true, this.RegexFind.IsChecked ?? true);
     }
 }