Beispiel #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);
                 }
             }
         });
 }
Beispiel #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");
         });
 }
Beispiel #3
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");
            });
        }
Beispiel #4
0
        public static void Run <TData>(TData context, IList <IViewSource> viewSources) where TData : class
        {
            var runner = new CrossThreadTestRunner();

            runner.RunInSTA(
                delegate
            {
                const string tempTarget = "temp.xps";
                if (File.Exists(tempTarget))
                {
                    File.Delete(tempTarget);
                }
                var xpsHelper = new XpsEngine();
                xpsHelper.Generate(viewSources, context, tempTarget);
                Process.Start(tempTarget);
            });
        }