private void OnImportXML() { try { // Configure save file dialog box var dlg = new Microsoft.Win32.OpenFileDialog() { Filter = "xml files|*.xml" // Filter files by extension }; if (dlg.ShowDialog().Value) { if (File.Exists(dlg.FileName)) { // retrieve data this.CurrentFilePath = dlg.FileName; List <Node> nodes = NodeSerializer.RetrieveNodeList(this.CurrentFilePath); // attach data to the node manager foreach (Node n in nodes) { bool success = this.NManager.AddNode(n); } // publish to GUI this.OnRefreshTree(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "XML File Import Error", MessageBoxButton.OK, MessageBoxImage.Error); // MessageBox.Show(ex.StackTrace, "XML File Import Error", MessageBoxButton.OK, MessageBoxImage.Error); } }