public GameSessionWindow(Game.Session session) { Session = session; Scene = new SceneTree.Scene(Session); InitializeComponent(); DataContext = this; }
void OpenCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { try { var savePath = App.ShowLoadGameDialog(this); if (savePath == null) { return; } using (var stream = File.OpenRead(savePath)) { Session = Game.Session.ReadFromStream(stream); } } catch (Exception ex) { MessageBox.Show( caption: "Error", icon: MessageBoxImage.Error, messageBoxText: ex.Message, button: MessageBoxButton.OK ); } Scene = new SceneTree.Scene(Session); }