C# Класс DotNetify.VMController

This class manages instantiations and updates of view models as requested by browser clients.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_activeVMs VMInfo>.ConcurrentDictionary
_registeredAssemblies List
_vmResponse VMResponseDelegate
_vmTypes List

Открытые методы

Метод Описание
Dispose ( ) : void

Disposes active view models.

OnDisposeVM ( string connectionId, string vmId ) : void

Handles request from a browser client to remove a view model.

OnRequestVM ( string connectionId, string vmId, object vmArg = null ) : void

Handles a request for a view model from a browser client.

OnUpdateVM ( string connectionId, string vmId, object>.Dictionary data ) : void

Handles view model update from a browser client.

RegisterAssembly ( Assembly vmAssembly ) : void

Registers all view model types in an assembly.

VMController ( VMResponseDelegate vmResponse ) : System

Constructor.

Защищенные методы

Метод Описание
CreateVM ( string vmId, object vmArg = null ) : BaseVM

Creates a view model.

IsAuthorized ( BaseVM vmInstance ) : bool

Returns whether current security context is authorized to access a view model.

PushUpdates ( ) : void

Push property changed updates on all view models back to the client.

Serialize ( object data ) : string

Serializes an object.

UpdateVM ( BaseVM vmInstance, string vmPath, string newValue ) : void

Updates a value of a view model.

Приватные методы

Метод Описание
VmInstance_RequestPushUpdates ( object sender, EventArgs e ) : void

Handles push updates request from a view model.

Описание методов

CreateVM() защищенный Метод

Creates a view model.
protected CreateVM ( string vmId, object vmArg = null ) : BaseVM
vmId string Identifies the view model.
vmArg object Optional view model's initialization argument.
Результат BaseVM

Dispose() публичный Метод

Disposes active view models.
public Dispose ( ) : void
Результат void

IsAuthorized() защищенный Метод

Returns whether current security context is authorized to access a view model.
protected IsAuthorized ( BaseVM vmInstance ) : bool
vmInstance BaseVM View model instance.
Результат bool

OnDisposeVM() публичный Метод

Handles request from a browser client to remove a view model.
public OnDisposeVM ( string connectionId, string vmId ) : void
connectionId string Identifies the client connection.
vmId string Identifies the view model.
Результат void

OnRequestVM() публичный Метод

Handles a request for a view model from a browser client.
public OnRequestVM ( string connectionId, string vmId, object vmArg = null ) : void
connectionId string Identifies the client connection.
vmId string Identifies the view model.
vmArg object Optional view model's initialization argument.
Результат void

OnUpdateVM() публичный Метод

Handles view model update from a browser client.
public OnUpdateVM ( string connectionId, string vmId, object>.Dictionary data ) : void
connectionId string Identifies the client connection.
vmId string Identifies the view model.
data object>.Dictionary
Результат void

PushUpdates() защищенный Метод

Push property changed updates on all view models back to the client.
protected PushUpdates ( ) : void
Результат void

RegisterAssembly() публичный статический Метод

Registers all view model types in an assembly.
public static RegisterAssembly ( Assembly vmAssembly ) : void
vmAssembly System.Reflection.Assembly Assembly.
Результат void

Serialize() защищенный Метод

Serializes an object.
protected Serialize ( object data ) : string
data object Data to serialize.
Результат string

UpdateVM() защищенный Метод

Updates a value of a view model.
protected UpdateVM ( BaseVM vmInstance, string vmPath, string newValue ) : void
vmInstance BaseVM View model instance.
vmPath string View model property path.
newValue string New value.
Результат void

VMController() публичный Метод

Constructor.
public VMController ( VMResponseDelegate vmResponse ) : System
vmResponse VMResponseDelegate Function invoked by the view model to provide response back to the client.
Результат System

Описание свойств

_activeVMs защищенное свойство

Active instances of view models.
protected ConcurrentDictionary _activeVMs
Результат VMInfo>.ConcurrentDictionary

_registeredAssemblies защищенное статическое свойство

List of registered assemblies.
protected static List _registeredAssemblies
Результат List

_vmResponse защищенное свойство

Function invoked by the view model to provide response back to the client.
protected VMResponseDelegate _vmResponse
Результат VMResponseDelegate

_vmTypes защищенное статическое свойство

List of known view model classes.
protected static List _vmTypes
Результат List