// Reload the raw tree, with no exploration public void EmptyTree() { Result = ""; Footer = ""; if (!string.IsNullOrWhiteSpace(SelectedFilePath)) { try { Tree = XMLConverter.ConvertXMLtoTree(SelectedFilePath); TreeViewModel.UpdateTree(Tree, IsRootMax); } catch { MessageBox.Show("Wrong XML data ! ", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
////////////// METHODS ///////////////// // Choose the XML file containing the tree public void ChooseFile() { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.Filter = "XML Files (*.xml)|*.xml"; var result = dlg.ShowDialog(); // Get the selected file name if (result != null && result == true) { SelectedFilePath = dlg.FileName; } try { Tree = XMLConverter.ConvertXMLtoTree(SelectedFilePath); UpdateTree(); } catch { MessageBox.Show("Wrong XML data ! ", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }