Ejemplo n.º 1
0
        private void buttonExport_OnClick(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog()
            {
                CheckFileExists = false, ValidateNames = true, Filter = "XML Files (*.xml)|*.xml"
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                try
                {
                    UserData.ConfigToXML(saveFileDialog.FileName);
                    MessageBox.Show("Configuration successfully exported to: " + saveFileDialog.FileName, "Export successful", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch
                {
                    MessageBox.Show("Error while exporting configuration to: " + saveFileDialog.FileName, "Export failed", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }