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

The StateManager class manages the service application using a collection of plugins.

Public Functions

XmlStateLock LockAppState ()
 
void Start ()
 
void Stop ()
 
bool TryLockAppState (TimeSpan timeout, out XmlStateLock stateLock)
 
Constructors and Destructors
 StateManager (string applicationName, Dispatcher uiDispatcher)
 

Data Fields

EventHandler< RequestReceivedEventArgsRequestReceived
 
EventHandler< ResponsesReadyEventArgs > ResponsesReady
 

Properties

Guid ApplicationId [get, set]
 
string ApplicationName [get]
 
ICommandManager CommandManager [get]
 
IFlowControlManager FlowControlManager [get]
 
static StateManager Instance [get]
 
bool IsStarted [get]
 
bool IsStopping [get]
 
IRequestManager RequestManager [get]
 
IResourceManager ResourceManager [get]
 
ISessionManager SessionManager [get]
 
ISessionStorageManager SessionStorageManager [get]
 
string this[string path] [get, set]
 
IViewManager ViewManager [get]
 
XmlStateManager XmlStateManager [get]
 

Events

EventHandler Initialized
 
EventHandler Uninitialized
 

Usage Description

XmlStateLock LockAppState ( )
inline

Acquires a lock on the application state.

In multi-client environments, the application state shouldn't be assumed to be perfectly synchronized, due to network latency or other factors. For this reason, it is possible to request a lock on StateManager, which ensures that no changes to the application state take place while the lock is held. This is needed, for example, if you want to perform atomic changes to multiple paths of the application state tree.

void Start ( )
inline

Starts this instance of the StateManager. This connects your service application to the PureWeb server, and makes it ready to receive client connections.

void Stop ( )
inline

Stops this instance of StateManager. This disconnects your service application from the PureWeb server, and makes it unavailable to receive client connections. The Uninitialized event will fire when the process is complete.

bool TryLockAppState ( TimeSpan  timeout,
out XmlStateLock  stateLock 
)
inline

Attempts to acquire a lock on application state before the specified timeout elapses. Returns true if the lock is acquired, or false otherwise.

Parameters
timeoutThe maximum amount of time that StateManager will wait to acquire the lock.
stateLockThe lock to be acquired.

Field Documentation

EventHandler<RequestReceivedEventArgs> RequestReceived

This event is fired when StateManager receives a request.

EventHandler<ResponsesReadyEventArgs> ResponsesReady

This event is fired when StateManager has session responses ready to send.

Property Documentation

Guid ApplicationId
getset

Gets the unique identifier of this instance of StateManager. This method is for information purposes only. The ID is automatically assigned by PureWeb.

string ApplicationName
get

Gets the name of this instance of StateManager. This method is for information purposes only.

Gets a reference to the CommandManager class.

Gets a reference to the FlowControlManager class.

StateManager Instance
staticget

Gets the one and only StateManager instance. Will be null if the StateManager is not yet constructed.

bool IsStarted
get

Gets a Boolean value indicating whether this instance of StateManager is started. This method is for information purposes only, and can be useful when testing or troubleshooting the application.

bool IsStopping
get

Gets a Boolean value indicating whether this instance of StateManager is stopping. This method is for information purposes only, and can be useful when testing or troubleshooting the application.

Gets a reference to the RequestManager class.

Gets a reference to the ResourceManager class.

Gets a reference to the SessionManager class.

Gets a reference to the SessionStorageManager class.

string this[string path]
getset

Gets or sets the application state value at the specified path.

Gets a reference to the ViewManager class.

Gets a reference to the XmlStateManager class.

Event Documentation

EventHandler Initialized

This event is fired once StateManager is initialized.

EventHandler Uninitialized

This event is fired once StateManager is uninitialized.