Пример #1
0
 public void WriteToFile()
 {
     var runner = new CrossThreadTestRunner();
     runner.RunInSTA(
         () =>
         {
             const string tempTarget = "temp.xps";
             try
             {
                 if (File.Exists(tempTarget))
                 {
                     File.Delete(tempTarget);
                 }
                 var xpsHelper = new XpsEngine();
                 var sources = new List<IViewSource> { new FileViewSource(new FileInfo("XpsWithData.haml")) };
                         xpsHelper.Generate(sources, "Hello", tempTarget);
                 Assert.IsTrue(File.Exists(tempTarget));
             }
             finally
             {
                 if (File.Exists(tempTarget))
                 {
                     File.Delete(tempTarget);
                 }
             }
         });
 }
Пример #2
0
 public void PrintPreview()
 {
     var runner = new CrossThreadTestRunner();
     runner.RunInSTA(
         () =>
         {
             var xpsHelper = new XpsEngine();
             var sources = new List<IViewSource>{new FileViewSource(new FileInfo("XpsWithData.haml"))};
             xpsHelper.PrintPreview(sources, "Hello");
         });
 }