public static void Open(MainWindow window, Model model) { bool goAhead = true; if (model != null && model.IsDirty && !CommandDoer.PromptSave(window, model)) { goAhead = false; } if (goAhead) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); ofd.InitialDirectory = CommandDoer.MapsDirectory; System.Windows.Forms.DialogResult result = ofd.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { string filename = ofd.FileName; MapParser mapParser = new MapParser(filename, window.TileTemplateLookup); window.ActiveModel = mapParser.Parse(); window.ActiveModel.IsDirty = false; window.InvalidateDrawing(); window.UpdateTitle(); } } }
public static void New(MainWindow window, Model model) { window.ActiveModel = new Model(16, 14); window.InvalidateDrawing(); window.UpdateTitle(); }