C# / .Net API Library Reference
Public Functions
IRenderedView Interface Reference

The IRenderedView interface is used for streaming images from a service application to a view container on a remote client. The interface includes methods for keeping the size of the view in sync between the service and the client, and for handling user input events within the client view.

About View Size
When the client application first launches, PureWeb automatically captures and stores the size of the client-side view's container. From there, in the background it will take care of keeping the service-side and client-side views in sync and responding appropriately to resizing events. As a developer, you only need to choose whether the size of the view on the service should reflect the size of the view on the client, or the other way around. If you want the view size to be based on the client (this is by far the most common approach), use SetClientSize. To match the client-side view to the size of the view on the service, use GetActualSize.
About User Input Events
Whenever the end user interacts with a view using either mouse or keyboard, the client API automatically sends a command to the service with the relevant details. On the service, a built-in handler for this command then calls either postMouseEvent or postKeyEvent. The purpose of these methods is to map the PureWeb client event to its equivalent event on the framework used by the service (Windows Forms, Qt, MFC, and so on).

Because image rendering varies greatly between applications, and because handling of user input events vary between frameworks, it is difficult to provide a one-size fits all description of the methods in this interface. Refer to the sample applications for actual implementation examples.

Public Functions

Size GetActualSize ()
void PostKeyEvent (PureWebKeyboardEventArgs keyEvent)
void PostMouseEvent (PureWebMouseEventArgs mouseEvent)
void RenderView (RenderTarget target)
bool RequiresRender ()
void SetClientSize (Size clientSize)

Usage Description

Size GetActualSize ( )

Returns the size of this view as it is currently displayed in the service application.

If this size and the client size are different, PureWeb will calculate the size of the buffer provided by RenderView and automatically scale the client-side view appropriately, minimizing bandwidth where possible.

If you prefer to have the service-side view change based on the size of the view on the client, stub out this method and implement SetClientSize instead.

void PostKeyEvent ( PureWebKeyboardEventArgs  keyEvent)

Posts the specified keyboard event to the receiver.

void PostMouseEvent ( PureWebMouseEventArgs  mouseEvent)

Posts the specified mouse event to the receiver. Coordinates will be relative to the remote client area, not the local client area.

void RenderView ( RenderTarget  target)

Streams the specified image to the client-side view container.

Although PureWeb does the actual work of streaming the image, you must tell it where to get that image, and this is the purpose of implementing RenderView. This involves populating the RenderTargetImage parameter of RenderTarget with the actual image data. See RenderTarget.

bool RequiresRender ( )

Returns true if the view needs to be rendered. This function is only called by PureWeb when the view is registered with the PolledRenders view registration option set to true. The default implementation returns false.

void SetClientSize ( Size  clientSize)

Sets the desired size of the client rendering area, in pixels.

When you use this method, you are telling PureWeb to automatically resize the service-side view whenever a resizing event occurs on the client, for example if the end user resizes the browser window or rotates the device. If you prefer that the client-side view always match the size of the view on the service, stub out this method and implement GetActualSize instead.

clientSizeThe size of the view on the client, which will be used to set the size of the view on the service.