C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Data Structures | Public Functions | Properties | Events
ViewManager Class Reference

The ViewManager class manages the views streamed from the service application. Most calls may only be made in the UI thread unless otherwise specified.

About View Registration
Many methods in the ViewManager class expect the view's name as a parameter. This name is assigned to the view when you first register it using RegisterView, the first method to call when adding a new view. Once a view is registered, its name acts as a unique ID, and both the service and the client must use that exact name when referring to it.

About the Timing of View Updates
Your application needs to know when to stream a new image to a view. To do this, you add either the RenderViewImmediate or RenderViewDeferred method to an event handler. As their name indicates, the main difference between the two methods is timing. In one case, the call to RenderView is immediate, in the other instance, it is deferred. Using the deferred method is the most common, as it is less resource-intensive: the service does not need to spend time churning image bits that may not be needed by the client right away.

About View Interactivity Modes
The purpose of the view interactivity modes is to make it possible to send images of lower quality when the end user is interacting with a view, and to restore full quality when interaction stops. This way, the size of the view updates during interaction can be smaller. The interactivity mode is set using the SetViewInteracting method. Once this is in place, you can configure the image quality values for the interactive and non-interactive modes using the client-side APIs.

Public Functions

List< ResponseInfo > GetNextResponses (Guid sessionId)
 
ViewImageFormat GetViewImageFormat (string viewName)
 
void Initialize (StateManager stateManager)
 
bool IsRenderAvailable (string viewName)
 
void RefreshViews ()
 
void RegisterView (string viewName, IRenderedView view)
 
void RenderViewDeferred (string viewName)
 
void RenderViewImmediate (string viewName)
 
void SessionConnected (Guid sessionId, XElement command)
 
void SessionDisconnected (Guid sessionId, XElement command)
 
void SetViewImageFormat (string viewName, ViewImageFormat format)
 
void SetViewInteracting (string viewName, bool isInteracting)
 
bool TryGetView (string viewName, out IRenderedView view)
 
void Uninitialize ()
 
bool UnregisterView (string viewName)
 
Constructors and Destructors
 ViewManager ()
 

Properties

EncoderConfiguration DefaultEncoderConfiguration [get, set]
 
Deprecated
int MaxImageQuality [get, set]
 
int MinImageQuality [get, set]
 
int FullImageQuality [get, set]
 
int InteractiveImageQuality [get, set]
 

Events

EventHandler< EncoderConfigurationChangedEventArgsEncoderConfigurationChanged
 
EventHandler FullImageQualityChanged
 
EventHandler< ImageCompressionEventArgsImageEncoding
 
EventHandler InteractiveImageQualityChanged
 
EventHandler< PureWebKeyboardEventArgsKeyboardEvent
 
EventHandler MaxImageQualityChanged
 
EventHandler MinImageQualityChanged
 
EventHandler< PureWebMouseEventArgsMouseEvent
 
EventHandler< ViewRenderedEventArgsViewRendered
 

Usage Description

List<ResponseInfo> GetNextResponses ( Guid  sessionId)
inherited

Gets the next responses for the specified session.

Parameters
sessionIdThe unique identifier of the session.
ViewImageFormat GetViewImageFormat ( string  viewName)
inline

Returns the current view image format (pixel format, scan line order and alignment) for the specified view.

Implements IRemoteRenderer.

void Initialize ( StateManager  stateManager)
inline

Initializes the ViewManager plugin with the specified StateManager.

Implements IStateManagerPlugin.

bool IsRenderAvailable ( string  viewName)
inherited

Returns true if the image bits are available for the specified view. May only be called on UI thread.

void RefreshViews ( )
inline

Causes all views to be re-rendered. This method is called automatically when a client calls refresh on a view.

Implements IViewManager.

void RegisterView ( string  viewName,
IRenderedView  view 
)
inline

Registers the specified view with StateManager.

Parameters
viewNameThe name that you want to give to the view. This name will act as a unique ID, and both the service and the client must use this name when referring to the view.
viewThe view that you are registering.

Implements IViewManager.

void RenderViewDeferred ( string  viewName)
inline

Notifies StateManager that the image in the specified view has been updated and needs to be rendered. The view image bits will be acquired later via the view's IRenderedView interface (the timing of the call to RenderView is not configurable; this is handled automatically by PureWeb).

Implements IRemoteRenderer.

void RenderViewImmediate ( string  viewName)
inline

Notifies StateManager that the image in the specified view has been updated needs to be rendered. The view image bits will be acquired immediately via the view's IRenderedView interface. This must be called on the UI thread.

Implements IRemoteRenderer.

void SessionConnected ( Guid  sessionId,
XElement  command 
)
inherited

Indicates that the specified session is connected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that caused the connection.
void SessionDisconnected ( Guid  sessionId,
XElement  command 
)
inherited

Indicates that the specified session is disconnected.

Parameters
sessionIdThe session's unique identifer.
commandThe command that caused the disconnection.
void SetViewImageFormat ( string  viewName,
ViewImageFormat  format 
)
inline

Sets the view image format (pixel format, scan line order and alignment) for the specified view.

The main purpose of this method is to overwrite framework defaults when needed.

Implements IRemoteRenderer.

void SetViewInteracting ( string  viewName,
bool  isInteracting 
)
inline

Sets the interactive mode for the specified view to either true or false.

The SetViewInteracting method is used to notify StateManager when user interaction begins and when it stops. For example, you could set the interactive mode to true on a mouse down event, and set it back to false on a mouse up event. Once this is in place, you can configure the image quality values for the interactive and non-interactive modes using the client-side APIs.

Implements IRemoteRenderer.

bool TryGetView ( string  viewName,
out IRenderedView  view 
)
inherited

Tries to get the view with the specified name. May only be called on UI thread.

void Uninitialize ( )
inline

Uninitializes the ViewManager plugin.

Implements IStateManagerPlugin.

bool UnregisterView ( string  viewName)
inline

Unregisters the specified view. Returns true if the view was successfully unregistered, or false otherwise.

Implements IViewManager.

Property Documentation

EncoderConfiguration DefaultEncoderConfiguration
getset

Gets or sets the default encoder configuration. Clients will receive this configuration when they initially connect.

int FullImageQuality
getset
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Gets or sets the value for the full (non-interactive) image quality. Can be accessed from any thread.

int InteractiveImageQuality
getset
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Gets or sets the value for the interactive image quality. Can be accessed from any thread.

int MaxImageQuality
getset
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Gets or sets the value for the maximum image quality.

int MinImageQuality
getset
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Gets or sets the value for the minimum image quality.

Event Documentation

EventHandler<EncoderConfigurationChangedEventArgs> EncoderConfigurationChanged

This event fires when the encoder configuration changes for a particular view and client. Although you can register for this event, its main purpose is to manage views under the hood.

EventHandler FullImageQualityChanged

This event fires when the value for the full (non-interactive) image quality changes.

EventHandler<ImageCompressionEventArgs> ImageEncoding

This event fires when an image is about to be encoded. Although you can register for this event, its main purpose is to manage views under the hood.

EventHandler InteractiveImageQualityChanged

This event fires when the value for the interactive image quality changes.

EventHandler<PureWebKeyboardEventArgs> KeyboardEvent

This event fires when a keyboard event occurs. PureWeb listens to this event under the hood, and when it occurs, it automatically fires the PostKeyEvent method.

EventHandler MaxImageQualityChanged

This event fires when the value for the maximum image quality changes.

EventHandler MinImageQualityChanged

This event fires when the value for the minimum image quality changes.

EventHandler<PureWebMouseEventArgs> MouseEvent

This event fires when a mouse event occurs. PureWeb listens to this event under the hood, and when it occurs, it automatically fires the PostMouseEvent method.

EventHandler<ViewRenderedEventArgs> ViewRendered

This event fires when a view is rendered. Although you can register for this event, its main purpose is to manage views under the hood.