Esempio n. 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);
                 }
             }
         });
 }
Esempio n. 2
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);
                    }
                }
            });
        }
Esempio n. 3
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);
            });
        }