private void MenuItem_SaveAs_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Level data (*.xml)|*.xml"; if (saveFileDialog.ShowDialog() == true) { // Saved to the selected path _path = saveFileDialog.FileName; LevelXML.SaveXML(_path, _layerTiles, _level); } _Level_Menu.Visibility = Visibility.Collapsed; }
private void MenuItem_Save_Click(object sender, RoutedEventArgs e) { // If attempting to save but the current level is new, use Save As if (_path == "") { MenuItem_SaveAs_Click(null, null); } else // otherwise overwrite the file { LevelXML.SaveXML(_path, _layerTiles, _level); } _Level_Menu.Visibility = Visibility.Collapsed; }