private void DirectFileExport(string notes) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); bool newFile = false; SmileFile.Patient = Patient; SmileFile.Description = notes; SmileFile.Type = Smile.MANIPULATION; if (SmileFile.Id == null) { SmileFile.Id = DB.getSmileFileNewId(Patient.Id); newFile = true; } jawFilename = "JAW" + SmileFile.Id + ".obj"; var path = Smile.MANIPULATED_PATH + jawFilename; var e = new SmileObjExporter(path); //e.Export(CurrentModel); ((SmileObjExporter)e).jawVisual = JawVisual; ((SmileObjExporter)e).Export(JawVisual, Patient); e.Close(); string screenShot = "JAW" + SmileFile.Id + ".png"; path = Smile.MANIPULATED_PATH + screenShot; HelixView.Export(path); //TODO save to table SmileFile.FileName = jawFilename; SmileFile.Screenshot = screenShot; Treatment.Phase = Smile.GetPhase(Smile.MANIPULATION); if (Treatment.Id != null) { DB.UpdateTreatment(Treatment); } else { Treatment.Id = DB.getTreatmentNewId(Patient.Id); Treatment.TreatmentDate = DateTime.Now; Treatment.TreatmentTime = DateTime.Now.ToString(Smile.TIME_FORMAT); DB.InsertTreatment(Treatment); } if (newFile) { DB.InsertFileInfo(SmileFile); DB.insertTreatmentFiles(Treatment, SmileFile); } else { DB.UpdateFileInfo(SmileFile); } showStatus(stopWatch, "Exported"); }
private void FileExport() { var path = FileDialogService.SaveFileDialog(null, null, Exporters.Filter, ".png"); if (path == null) { return; } HelixView.Export(path); /* * var ext = Path.GetExtension(path).ToLowerInvariant(); * switch (ext) * { * case ".png": * case ".jpg": * HelixView.Export(path); * break; * case ".xaml": * { * var e = new XamlExporter(path); * e.Export(CurrentModel); * e.Close(); * break; * } * * case ".xml": * { * var e = new KerkytheaExporter(path); * e.Export(HelixView.Viewport); * e.Close(); * break; * } * case ".obj": * { * var e = new ObjExporter(path); * e.Export(CurrentModel); * e.Close(); * break; * } * case ".objz": * { * var tmpPath = Path.ChangeExtension(path, ".obj"); * var e = new ObjExporter(tmpPath); * e.Export(CurrentModel); * e.Close(); * GZipHelper.Compress(tmpPath); * break; * } * case ".x3d": * { * var e = new X3DExporter(path); * e.Export(CurrentModel); * e.Close(); * break; * } * }*/ }
private void FileExportRaw() { var path = FileDialogService.SaveFileDialog(null, null, Exporters.Filter, ".png"); if (path == null) { return; } //HelixView.Export(path); ///* Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); var ext = Path.GetExtension(path).ToLowerInvariant(); switch (ext) { case ".png": case ".jpg": HelixView.Export(path); break; case ".xaml": { var e = new XamlExporter(path); e.Export(CurrentModel); e.Close(); break; } case ".xml": { var e = new KerkytheaExporter(path); e.Export(HelixView.Viewport); e.Close(); break; } case ".obj": { var patient = new Patient(); var e = new SmileObjExporter(path); //e.Export(CurrentModel); ((SmileObjExporter)e).rawVisual = RawVisual; ((SmileObjExporter)e).Export(RawVisual, patient); e.Close(); break; } case ".objz": { var tmpPath = Path.ChangeExtension(path, ".obj"); var e = new ObjExporter(tmpPath); e.Export(CurrentModel); e.Close(); GZipHelper.Compress(tmpPath); break; } case ".x3d": { var e = new X3DExporter(path); e.Export(CurrentModel); e.Close(); break; } } showStatus(stopWatch, "Exported"); //*/ }