//Reload Button private void btnReload_Click(object sender, RoutedEventArgs e) { txtFind.Text = String.Empty; txtFind2.Text = String.Empty; txtReplace.Text = String.Empty; txtEval.Text = String.Empty; txtValue.Text = String.Empty; tvxpath.Items.Clear(); if (xmlin.Text != string.Empty) { LoadXml(xmlpath); foldingStrategy = new XmlFoldingStrategy(); if (foldingStrategy != null) { if (foldingManager == null) { foldingManager = FoldingManager.Install(xmlin.TextArea); } foldingStrategy.UpdateFoldings(foldingManager, xmlin.Document); } else { if (foldingManager != null) { FoldingManager.Uninstall(foldingManager); foldingManager = null; } } } }
//OpenFile Method for DragDrop Events private void OpenFile(string sFile) { txtXMLPath.Text = System.IO.Path.GetFileName(sFile); if (!sFile.Contains(".xml")) { MessageBox.Show(sFile + " Is Not An XML File!"); } else if (sFile == xmlpath) { MessageBox.Show(sFile + " Is Already Open!"); } else { xmlpath = sFile.ToString(); txtXMLPath.ToolTip = "Full Path: " + xmlpath; LoadXml(xmlpath); foldingStrategy = new XmlFoldingStrategy(); if (foldingStrategy != null) { if (foldingManager == null) { foldingManager = FoldingManager.Install(xmlin.TextArea); } foldingStrategy.UpdateFoldings(foldingManager, xmlin.Document); } else { if (foldingManager != null) { FoldingManager.Uninstall(foldingManager); foldingManager = null; } } } }