0

I am working on rendering XPS documents in a WCF service and want it to be as fast as possible.

Is it possible to turn off any UI related overhead, since there is no UI interaction necessary in my use case? I want to just utilize the UI layout management piece of Xaml. Basically, how can I turn off anything unnecessary to the creation of a document?

When I'm done rendering, I'm adding each FrameworkElement to a DocumentPages to be rendered with a DocumentPaginator and then saving that to an XPS using the XpsDocumentWriter.

Charlie
  • 846
  • 7
  • 21
  • I don't think your service would be receiving any UI notifications. Does you service use Application.Run()? – Glen Thomas Aug 12 '15 at 19:42
  • Correct, it doesn't receive any UI notifications because it is a web service, so if there's any event wiring, or additional overhead by Xaml that I can turn off, that's what I'm looking to do. While I'm building out the visual tree, I want there to be as little overhead as possible. – Charlie Aug 12 '15 at 19:46
  • I know what the intent of your service is, what I am saying is that I don't think there would be a message loop running to receive UI events. Do you use the method Application.Run()? – Glen Thomas Aug 12 '15 at 19:52
  • No, I never call Application.Run – Charlie Aug 12 '15 at 20:01
  • I do pump the message queue once to achieve page number binding though. Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.SystemIdle, new DispatcherOperationCallback(delegate { return null; }), null); – Charlie Aug 12 '15 at 20:01
  • Then you are fine. Your service is not processing Windows messages. – Glen Thomas Aug 12 '15 at 20:03

1 Answers1

0

Just make sure you don't call Application.Run in your service and there will be no message loop processing Windows messages.

Glen Thomas
  • 10,190
  • 5
  • 33
  • 65