private void MenuItem_Open_Click(object sender, RoutedEventArgs e) { svMap.Visibility = Visibility.Hidden; OpenFileDialog dlg = new OpenFileDialog { Filter = "Binary files (*.bin) | *.bin;" }; if (dlg.ShowDialog() == true) { currentMap = BinaryReaderWriter.Read(dlg.FileName); mapDesigner.CreateDesignArea(); mapDesigner.RenderMap(); LoadTexturesFromTileset(); svMap.Visibility = Visibility.Visible; mniSave.IsEnabled = true; } else { mniSave.IsEnabled = false; } }
private void MenuItem_Save_Click(object sender, RoutedEventArgs e) { if (currentMap != null) { SaveFileDialog dlg = new SaveFileDialog { Filter = "Binary files (*.bin) | *.bin;" }; if (dlg.ShowDialog() == true) { BinaryReaderWriter.Write(dlg.FileName, currentMap); } } }