public override void Run() { string clipboardText = Clipboard.GetText(); if (clipboardText == null) { clipboardText = String.Empty; } InputDialog dialog = new InputDialog("Enter text", clipboardText, "Enter the value to search"); if (dialog.ShowDialog() == CustomDialogResult.Ok) { XmlEditor editor = this.Owner as XmlEditor; if (editor == null) { return; } SingleDirectionData currentData = editor.SingleDirectionData; currentData.ShowAttributes = true; currentData.ShowValues = true; string tempXPath = string.Format("//*[text() = \"{0}\"]", dialog.InputString); if (XmlUtils.IsXPathValid(tempXPath)) { XPathData xpath = new XPathData(); xpath.XPath = tempXPath; currentData.HighlightedXPath = xpath; } } }
private void ShowXmlDialog(string xml) { CustomDialog dialog = new CustomDialog(); XmlViewSingleContent content = new XmlViewSingleContent(); SingleDirectionData data = new SingleDirectionData(); content.DataContext = data; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); data.Document = doc; dialog.Content = content; dialog.MaxWidth = 800; dialog.AddOkButton(); dialog.AddButton("reformat", Reformat, System.Windows.Input.Key.R, System.Windows.Input.ModifierKeys.Alt, "Reformat"); dialog.Show(); }