// private void SubscribeToTabEvents() // { ///* viewFileTab.FileChangedEvent += new View.FileTabView.FileChangeHandler(SetFileData); // viewShapeTab.ShapeChangedEvent += new View.ShapeTabView.ShapeChangeHandler(SetShapeData); // viewBlockTab.BlockChangedEvent += new View.BlockTabView.BlockChangeHandler(SetBlockData); //*/ // // viewBlockTab // } /* * private void SetFileData(object sender, FileChangeEventArgs fcea) * { * if (((App)Application.Current).controller != null) ((App)Application.Current).controller.UpdateFileData(fcea); * } * * private void SetShapeData(object sender, ShapeChangeEventArgs scea) * { * if (((App)Application.Current).controller != null) ((App)Application.Current).controller.UpdateShapeData(scea); * } * * private void SetBlockData(object sender, BlockChangeEventArgs bcea) * { * if (((App)Application.Current).controller != null) ((App)Application.Current).controller.UpdateBlockData(bcea); * } */ private void MainClose(object sender, System.ComponentModel.CancelEventArgs e) { System.Diagnostics.Trace.WriteLine(e.ToString()); MessageBoxResult goodBye = MessageBox.Show("Do you intend on leaving? ", "exit app", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.DefaultDesktopOnly); if (goodBye != MessageBoxResult.Yes) { e.Cancel = true; } else { //unsubscribe to tabs /* if (((App)Application.Current).controller != null) ((App)Application.Current).controller.UnSubscribeFromOthers(); * viewFileTab.FileChangedEvent -= new View.FileTabView.FileChangeHandler(SetFileData); * viewShapeTab.ShapeChangedEvent -= new View.ShapeTabView.ShapeChangeHandler(SetShapeData); * viewBlockTab.BlockChangedEvent -= new View.BlockTabView.BlockChangeHandler(SetBlockData); */} }
private void GameForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { EditorObjects.Gui.LayoutManager.SaveWindowLayout(); } catch (Exception saveException) { System.Windows.Forms.MessageBox.Show("Error saving the screen layout. " + "A file has been saved containing error information. You can help solve this problem " + "by posting the error contained in this file on the FlatRedBall forums. The file can be " + "found in My Documents"); StringBuilder errorInformation = new StringBuilder(); errorInformation.AppendLine("Error saving window layout. Error information: "); errorInformation.AppendLine(e.ToString()); errorInformation.AppendLine("The following windows are contained in the GuiManager"); foreach (Window w in GuiManager.Windows) { errorInformation.AppendLine(w.GetType() + " " + w.Name + " " + w.ToString()); } FileManager.SaveText(errorInformation.ToString(), FileManager.MyDocuments + "WindowLayoutError.txt"); } OkCancelWindow toExit = GuiManager.AddOkCancelWindow(); toExit.Message = "Any unsaved changes will be lost. Are you sure you want to exit?"; toExit.ScaleX = 9.4f; toExit.ScaleY = 7; toExit.OkClick += new GuiMessage(ExitMessage); InputManager.ReceivingInput = toExit; GuiManager.AddDominantWindow(toExit); e.Cancel = true; }