WPF - Remoting the Right Way

DAN SHAPPIR on July 29, 2014 | 2347

In previous posts I described Session Virtualization, a feature I would like to see added to modern OSs. I also explained why this feature would be particularly useful for Microsoft Windows Terminal Services. In this post I will describe another new feature I would like to see, this one specific to Terminal Servers: WPF Remoting.

Imagine a web page constructed as one big GIF or JPG – a single large image covering the entire browser window, containing all the text, links, graphics and white-spaces that constitute the display. Such a site design would obviously be extremely foolish and unprofessional because:

  1. Due to the image’s large size, the page would be slow to load.
  2. The image would either be fixed, in which case it wouldn’t properly support varying display and window sizes, or scalable, in which case it would become pixelated.
  3. It would not leverage client-side features such as font smoothing.
  4. It would be problematic to print.
  5. It would not properly support user operations such as Copy and Paste.

For these reasons and more, such a design should be avoided. I am not familiar with any web page that is constructed this way. Yet this is how remoting protocols such as RDP, ICA and VNC work. These protocols transmit the content of a remote display to the client essentially as a sequence of images. So, in fact, these protocols are even worse than the ridiculous web page design I described in that they transmit a stream of images rather than just one.

Obviously these protocols perform various optimizations to reduce the communication bandwidth, such as transmitting only the changes, caching images on the client-side, and compressing the transmitted data. In addition some protocol are able to work at a slightly higher level of representation than simple images, being able to transmit simple graphical primitives such as lines and areas. Still the fundamental structure of the protocols remains image or bitmap based.

Comparing this approach to the web makes it obvious that a much better alternative exists: a simple HTML page, containing some style data, scripts and references to a few small images can be used to construct a very sophisticated presentation. And the total size of these components is much, much smaller than a single large image. So what is needed is a mechanism that enables transmitting the remote display in much the same way – as a set of instructions that are used to render the display on the client-side. Well, unlike Virtual Sessions, which to my knowledge do not currently exist as I’ve described them, this feature does exist and may be included in the upcoming release of Windows Longhorn Terminal Services.

Windows Presentation Foundation, formerly code named Avalon, is the graphical subsystem feature of the .NET Framework 3.0 (formerly called WinFX). WPF comes preinstalled on Windows Vista and Longhorn, and is also available for installation on Windows XP SP2 and Windows Server 2003. WPF provides the set of services which enable application to render their User Interface and to manage user interactions. It provides numerous high-level features such as 3D manipulations, transitions and transformations, document and media management, animations and sophisticated text rendering.

Where WPF really becomes interesting in the context of Terminal Services is its introduction and use of a new markup language called eXtensible Application/Avalon Markup Language (XAML). XAML is an XML dialect used to declaratively define UI elements, data binding, eventing, workflows, and other features. What this means is that WPF applications can use XAML to construct their applicative UI in much the same way that Web applications use HTML to construct their browser-based UI. A WPF application hands over its XAML resources to the underlying WPF subsystem to be rendered onto the display. A remoted WPF application running on a server transmits its XAML resources to be rendered on the client’s display.

Read the last sentence again: A remoted WPF application running on a server transmits its XAML resources to be rendered on the client’s display. This means that instead of transmitting a UI rendered on the server as an image to the client, XAML text is transmitted by the remoting protocol much like HTML is transmitted over HTTP. This new mode of operation has the following advantages:

  1. XAML text is much more lightweight than the image it generates.
  2. XAML can define transformation and animations, so a single XAML page can substitute a whole sequence of images.
  3. XAML is vector based so it can rescale to match any resolution and leverage graphical services provided by the client, such as font smoothing.
  4. Because XAML is rendered on the client it can offload the effort of the rendering operation from the server, reducing resource consumption and improving server scalability.
  5. XAML can also have code embedded within it to manage various “rollover” effects. This code can be executed on the client thus providing instant response to user interactions (like JavaScript embedded within a Web page).

So, will Microsoft include WPF Remoting in the upcoming Longhorn Terminal Services? Unfortunately it’s not clear yet. Microsoft have indicated that they plan to, but existing Longhorn betas don’t provide this functionality is far as I know. I guess we will have to wait until the fat lady sings.

Author | 180 Blog Posts

Dan Shappir

Dan Shappir is responsible for all aspects of product design, software development and maintenance of the Ericom's product lines. | Ericom Software

Recommended Articles