private void ExportToXml_Click(object sender, RoutedEventArgs e) { Exporter exporter = new Exporter(workArea); string path = null; if (Global.Template == Data.Resources.TemplateType.UrbanGame) { var folderDialog = new System.Windows.Forms.FolderBrowserDialog(); folderDialog.Description = "Select the destination folder of the template."; var dialogres = folderDialog.ShowDialog(); if (dialogres != System.Windows.Forms.DialogResult.OK) { MessageBox.Show("Operation aborted."); return; } path = folderDialog.SelectedPath; } else { var fileDialog = new Microsoft.Win32.SaveFileDialog(); fileDialog.Filter = "CHe Xml File|*.xml"; var result = fileDialog.ShowDialog(); if (result.HasValue && result.Value) path = fileDialog.SafeFileName; } if (path!=null) { bool success = true; switch (Global.Template) { case Data.Resources.TemplateType.MuseumGuide: exporter.ExportMuseumGuideXML(path); break; case Data.Resources.TemplateType.ExcursionGame: success = exporter.ExportExcursionGameXML(path); break; case Data.Resources.TemplateType.UrbanGame: success = exporter.ExportUrbanGameXML(path); break; default: break; } if (success) MessageBox.Show("Export operation successfully completed !", "Export", MessageBoxButton.OK, MessageBoxImage.Information); } }