public void showSaveFileDialog(string filterString, SendResult <string> resultCallback) { FileSaveDialog dlg = new FileSaveDialog(wildcard: filterString); dlg.showModal((mResult, mFiles) => { saveResults(mResult, mFiles, resultCallback, dlg); }); }
private void exportToJson() { FileSaveDialog saveDialog = new FileSaveDialog(controller.MainWindow); saveDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { controller.saveModelJSON(path); } }); }
/// <summary> /// This will show the save file dialog and will return the newly chosen file. /// </summary> /// <param name="parent">The parent window.</param> /// <returns>The current file or null if the user canceled the dialog.</returns> public void saveFileAs(FileChosen fileChosenCb) { FileSaveDialog save = new FileSaveDialog(ParentWindow, "", DefaultDirectory, "", Filter); save.showModal((result, file) => { if (result == NativeDialogResult.OK && !String.IsNullOrEmpty(file)) { currentFile = file; fileChosenCb(currentFile); } }); }
private void saveResults(NativeDialogResult result, String path, SendResult <String> resultCallback, FileSaveDialog dlg) { if (result == NativeDialogResult.OK) { String errorPrompt = null; if (!resultCallback(path, ref errorPrompt)) { dlg.showModal((mResult, mPath) => { saveResults(mResult, mPath, resultCallback, dlg); }); } } }
void saveAllVisible_MouseButtonClick(Widget source, EventArgs e) { FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, "Dump Positions to 3ds Max", Environment.CurrentDirectory, "AnomalousMedicalSimObjects.ms", "MaxScript (*.ms)|*.ms"); saveDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { using (MaxWriter maxWriter = new MaxWriter(path)) { maxWriter.write(AnatomyManager.AnatomyList.Where(a => a.CurrentAlpha > 0.0f).Select(a => new MaxWriterInfo(a.Owner))); } } }); }
void saveAll_MouseButtonClick(Widget source, EventArgs e) { FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, "Dump Positions to 3ds Max", Environment.CurrentDirectory, "AnomalousMedicalSimObjects.ms", "MaxScript (*.ms)|*.ms"); saveDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { using (MaxWriter maxWriter = new MaxWriter(path)) { maxWriter.write(medicalController.SimObjects.Select(so => new MaxWriterInfo(so))); } } }); }
public override void clicked(TaskPositioner taskPositioner) { FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, "Save Microcode Cache", Environment.CurrentDirectory, Root.getSingleton().getRenderSystem().Name + ".mcc", "Microcode Cache (*.mcc)|*.mcc"); saveDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { using (Stream stream = File.Open(path, FileMode.Create, FileAccess.Write)) { GpuProgramManager.Instance.saveMicrocodeCache(stream); } } fireItemClosed(); }); }
private void finishTransformedSave(Dictionary <String, MaxWriterInfo> transforms) { FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, "Dump Positions to 3ds Max", Environment.CurrentDirectory, "AnomalousMedicalSimObjects.ms", "MaxScript (*.ms)|*.ms"); saveDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { using (MaxWriter maxWriter = new MaxWriter(path)) { maxWriter.write(from so in medicalController.SimObjects where transforms.ContainsKey(so.Name) select transformWriter(new MaxWriterInfo(so), transforms)); } } }); }
void save_MouseButtonClick(Widget source, EventArgs e) { if (recordingSequence != null) { FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, message: "Save Recorded Sequence", wildcard: "Movement Sequence (*.seq)|*.seq"); saveDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { using (Stream stream = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None)) { SharedXmlSaver.Save(recordingSequence, stream); } } }); } }
private void saveAs() { if (slideEditController.ResourceProvider != null) { try { slideEditController.stopPlayingTimelines(); FileSaveDialog fileDialog = new FileSaveDialog(MainWindow.Instance, wildcard: wildcard); fileDialog.showModal((result, path) => { if (result == NativeDialogResult.OK) { bool doSaveAs = true; if (path.EndsWith(".show", StringComparison.InvariantCultureIgnoreCase)) //Special case for .show (folders) create a folder with the name of the project for the result to go into { String projectDir = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); path = Path.Combine(projectDir, Path.GetFileName(path)); if (Directory.Exists(projectDir)) { doSaveAs = false; MessageBox.show(String.Format("The folder for this project already exists at\n{0}\n\nWould you like to delete it and replace it with your new project?", projectDir), "Overwrite?", MessageBoxStyle.IconQuest | MessageBoxStyle.Yes | MessageBoxStyle.No, overwriteResult => { if (overwriteResult == MessageBoxStyle.Yes) { slideEditController.saveAs(path); updateCaption(); } }); } } if (doSaveAs) { slideEditController.saveAs(path); updateCaption(); } } }); } catch (Exception ex) { MessageBox.show(String.Format("{0} saving the project. Message {1}.", ex.GetType().Name, ex.Message), "Project Save Error", MessageBoxStyle.IconError | MessageBoxStyle.Ok); } } }
unsafe void reset_MouseButtonClick(Widget source, EventArgs e) { FileSaveDialog fileSave = new FileSaveDialog(MainWindow.Instance, "Save your audio file", wildcard: "Ogg Vorbis (*.ogg)|*.ogg"); fileSave.showModal((result, file) => { if (result == NativeDialogResult.OK) { try { using (Stream destFile = File.Open(file, FileMode.Create, FileAccess.Write)) { recordAudioController.save(destFile); } } catch (Exception ex) { Logging.Log.Error(ex.Message); } } }); }
public void initialize(StandaloneController standaloneController) { GUIManager guiManager = standaloneController.GUIManager; testImageAtlas = new TestImageAtlas(); guiManager.addManagedDialog(testImageAtlas); testSoundRecord = new TestSoundRecord(standaloneController); guiManager.addManagedDialog(testSoundRecord); testTextureSceneView = new TestTextureSceneView(standaloneController.SceneViewController); guiManager.addManagedDialog(testTextureSceneView); standaloneController.TaskController.addTask(new CallbackTask("UnitTest.SaveFileDialog", "Test Save File", CommonResources.NoIcon, "Unit Test", 0, false, (item) => { FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, wildcard: "All Files|*"); saveDialog.showModal((result, path) => { Log.Debug("Save dialog returned '{0}', path '{1}'", result, path); }); })); //This is a test to make all the geometry in the scene one large object to test batching reduction, initial tests show huge improvement, only works under open gl. standaloneController.TaskController.addTask(new CallbackTask("UnitTest.StaticTest", "Static Test", CommonResources.NoIcon, "Unit Test", (item) => { var scene = standaloneController.MedicalController.CurrentScene; var sceneManager = scene.getSimElementManager("Ogre") as OgrePlugin.OgreSceneManager; var ogreScene = sceneManager.SceneManager; var staticGeo = ogreScene.createStaticGeometry("Test"); staticGeo.addSceneNode(ogreScene.getRootSceneNode()); ogreScene.getRootSceneNode().setVisible(false); staticGeo.build(); })); standaloneController.TaskController.addTask(new MDIDialogOpenTask(testSoundRecord, "UnitTestPlugin.TestSoundRecord", "Sound Record", CommonResources.NoIcon, "Unit Test", true)); standaloneController.TaskController.addTask(new MDIDialogOpenTask(testTextureSceneView, "UnitTestPlugin.TestTextureSceneView", "Texture Scene View", CommonResources.NoIcon, "Unit Test", true)); standaloneController.TaskController.addTask(new MDIDialogOpenTask(testImageAtlas, "UnitTestPlugin.TestImageAtlas", "Image Atlas", CommonResources.NoIcon, "Unit Test", true)); }