/// <summary> /// Exports a simple model in a STA. /// </summary> /// <param name="e">The exporter.</param> /// <param name="stream">The stream.</param> protected void ExportSimpleModel(IExporter e, Stream stream) { Exception exception = null; CrossThreadTestRunner.RunInSTA( () => { var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 }; vp.Children.Add(new DefaultLights()); var box = new BoxVisual3D(); box.UpdateModel(); vp.Children.Add(box); try { e.Export(vp, stream); } catch (Exception ex) { exception = ex; } }); if (exception != null) { throw exception; } }
public void Export_SimpleModel_ValidOutput() { string path = "temp.x3d"; var runner = new CrossThreadTestRunner(); runner.RunInSTA( delegate { Console.WriteLine(Thread.CurrentThread.GetApartmentState()); var vp = new Viewport3D(); vp.Camera = CameraHelper.CreateDefaultCamera(); vp.Width = 1280; vp.Height = 720; vp.Children.Add(new DefaultLightsVisual3D()); var box = new BoxVisual3D(); box.UpdateModel(); vp.Children.Add(box); using (var e = new X3DExporter(path)) { e.Export(vp); } }); var result = Validate(path); Assert.IsNull(result, result); }
/// <summary> /// Exports a simple model in a STA. /// </summary> /// <param name="e">The exporter.</param> /// <param name="stream">The stream.</param> protected void ExportSimpleModel(IExporter e, Stream stream) { CrossThreadTestRunner.RunInSTA( () => { var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 }; vp.Children.Add(new DefaultLights()); var box = new BoxVisual3D(); box.UpdateModel(); vp.Children.Add(box); e.Export(vp, stream); }); }
protected void ExportSimpleModel(Exporter e) { var runner = new CrossThreadTestRunner(); runner.RunInSTA( delegate { Console.WriteLine(Thread.CurrentThread.GetApartmentState()); var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 }; vp.Children.Add(new DefaultLights()); var box = new BoxVisual3D(); box.UpdateModel(); vp.Children.Add(box); e.Export(vp); }); }