private void NotifyCommand(string commandName) { switch (commandName) { case "New": editorGameHost.NewScene(); break; case "Save": case "SaveAs": { var saveFileDialog = new Winforms.SaveFileDialog(); saveFileDialog.Filter = "C3DE Scene (*.scene)|*.scene"; if (saveFileDialog.ShowDialog() == Winforms.DialogResult.OK) { if (!editorGameHost.SaveScene(saveFileDialog.FileName)) { MessageBox.Show("This scene can't be saved. Please contact the developer with the error file", "Save error", MessageBoxButton.OK, MessageBoxImage.Error); } } } break; case "Load": { var openFileDialog = new Winforms.OpenFileDialog(); openFileDialog.Filter = "C3DE Scene (*.scene)|*.scene"; if (openFileDialog.ShowDialog() == Winforms.DialogResult.OK) { if (!editorGameHost.LoadScene(openFileDialog.FileName)) { MessageBox.Show("This scene can't be loaded. Please contact the developer with the error file", "Load error", MessageBoxButton.OK, MessageBoxImage.Error); } } } break; case "All": Messenger.Notify(EditorEvent.CommandAll); break; case "Copy": Messenger.Notify(EditorEvent.CommandCopy); break; case "Cut": Messenger.Notify(EditorEvent.CommandCut); break; case "Past": Messenger.Notify(EditorEvent.CommandPast); break; case "Duplicate": Messenger.Notify(EditorEvent.CommandDuplicate); break; case "Delete": Messenger.Notify(EditorEvent.CommandDelete); break; case "Exit": WPFApplication.Current.Shutdown(); break; case "Escape": Messenger.Notify(EditorEvent.CommandEscape); break; } }
private void OnExportClick(object sender, RoutedEventArgs e) { var item = sender as Control; if (item != null) { var format = item.Tag.ToString(); var saveFileDialog = new Winforms.SaveFileDialog(); saveFileDialog.Filter = format == "stl" ? "STL file (*.stl)|*.stl" : "OBJ/MTL file (*.obj)|*.obj"; if (saveFileDialog.ShowDialog() == Winforms.DialogResult.OK) { var result = editorGameHost.ExportSceneTo(format); if (result != null) { File.WriteAllText(saveFileDialog.FileName, result[0]); } } } }