Bend.MainWindow.ReplaceStringOnPage C# (CSharp) Method

ReplaceStringOnPage() public method

public ReplaceStringOnPage ( string searchText, string replacementText, bool matchCase, bool useRegex ) : void
searchText string
replacementText string
matchCase bool
useRegex bool
return void
        public void ReplaceStringOnPage(string searchText, string replacementText, bool matchCase, bool useRegex)
        {
            if (replacementText.Length > 0 && this.currentTabIndex >= 0 && this.currentTabIndex < this.tab.Count && searchText != replacementText)
            {
                Object[] parameters = new Object[7];
                string text = tab[this.currentTabIndex].TextEditor.Text;
                TextEditor textEditor = tab[this.currentTabIndex].TextEditor;
                textEditor.BeginChange();
                parameters[0] = text;
                parameters[1] = searchText;
                parameters[2] = false;
                parameters[3] = matchCase; //matchCase;
                parameters[4] = useRegex; //useRegex;
                parameters[5] = replacementText;
                parameters[6] = textEditor;
                this.UpdateFind_WorkerThread(parameters);
                textEditor.EndChange();
            }
        }

Usage Example

Ejemplo n.º 1
0
 private void Replace_Click(object sender, RoutedEventArgs e)
 {
     if (FindText.Text.Length > 0 && FindText.Items != null && (FindText.Items.Count == 0 || (string)FindText.Items[0] != FindText.Text))
     {
         FindText.Items.Insert(0, FindText.Text);
     }
     if (replaceall.IsChecked ?? true)
     {
         mainWindow.ReplaceStringOnPage(FindText.Text, ReplaceText.Text, this.MatchCase.IsChecked ?? true, this.RegexFind.IsChecked ?? true);
         mainWindow.FindNextStringOnPage("", false, false, this.MatchCase.IsChecked ?? true, this.RegexFind.IsChecked ?? true);
         this.mainWindow.SetStatusText("");
     }
     else
     {
         this.mainWindow.ReplaceSelectedText(ReplaceText.Text);
         mainWindow.FindNextStringOnPage(FindText.Text, false, false, this.MatchCase.IsChecked ?? true, this.RegexFind.IsChecked ?? true);
     }
 }