C# Class Sharpen.Html.Application

Show file Open project: nikhilk/sharpen

Public Properties

Property Type Description
AutoInit bool
Current Application

Public Methods

Method Description
CompileTemplate ( string type, string content, object>.Dictionary options ) : Template

Compiles a template instance from the specified template type and content.

DeactivateFragment ( Element element, bool contentOnly ) : void

Deactivates the specified element and its children by disposing any behaviors or binding instances attached to the elements.

GetObject ( Type objectType ) : object

Gets an instance of the specified object type. An instance is created if one has not been registered with the container. A factory method is called if a factory has been registered or implemented on the object type.

GetSetting ( string name ) : string

Gets the value of the specified setting.

GetTemplate ( string name ) : Template

Gets a template instance from the specified template name. The specified name is used to lookup a script element with a matching id.

PublishEvent ( EventArgs eventArgs ) : void

Raises the specified event. The type of the event arguments is used to determine which subscribers the event is routed to.

RegisterBehavior ( string name, Type behaviorType, Type serviceType ) : void

Registers a behavior so it can be used declaratively in markup.

RegisterBinder ( string name, BinderFactory factory ) : void

Registers a binder factory. The supplied name prefixed with "data-" is used as the attribute name in markup to create a binder.

RegisterExpression ( string name, ExpressionFactory factory ) : void

Registers an expression factory. The supplied name is used in markup to represent an instance of the associated expression.

RegisterFactory ( Type objectType, Func objectFactory ) : void

Registers an object factory with the container. The factory is called when the particular object type is requested. The factory can decide whether to cache object instances it returns or not, based on its policy.

RegisterObject ( Type objectType, object objectInstance ) : void

Registers an object instance for the specified object type.

RegisterService ( string name, Type serviceImplementationType, Type serviceType ) : void

Registers a service type.

RegisterTemplate ( string name, Template template ) : void

Registers a template with the specified name.

RegisterTemplateEngine ( string name, TemplateEngine engine ) : void

Registers a template engine. The supplied name is used to match against the mime type attribute on a template script element.

SubscribeEvent ( Type eventType, Callback eventHandler ) : object

Subscribes to the specified type of events. The resulting cookie can be used for unsubscribing.

UnsubscribeEvent ( object subscriptionCookie ) : void

Unsubcribes from a previously subscribed-to event type.

Private Methods

Method Description
ActivateFragment ( Element element, bool contentOnly ) : void
ActivateFragment ( Element element, bool contentOnly, object model ) : void
Application ( ) : System
AttachBehaviors ( Element element ) : void

Creates and attaches behaviors specified on the element declaratively.

BindContent ( Element element, string property, Expression expression ) : Binder
BindValue ( Element element, string property, Expression expression ) : Binder
BindVisibility ( Element element, string property, Expression expression ) : Binder
DetachBehaviors ( Element element ) : void

Detaches all behaviors associated with the specified element.

GetTypeKey ( Type type ) : string
ProcessModelExpression ( object model, string expressionType, string value ) : Expression
RegisterBehavior ( string name, Type behaviorType ) : void
SetupBindings ( Element element, object model ) : void
SetupServices ( ) : void

Method Details

CompileTemplate() public method

Compiles a template instance from the specified template type and content.
public CompileTemplate ( string type, string content, object>.Dictionary options ) : Template
type string The template engine to use to compile the template.
content string The template content.
options object>.Dictionary Any options to be passed to the template engine.
return Template

DeactivateFragment() public method

Deactivates the specified element and its children by disposing any behaviors or binding instances attached to the elements.
public DeactivateFragment ( Element element, bool contentOnly ) : void
element System.Html.Element The element to deactivate.
contentOnly bool Whether the element should be deactivated, or only its contained content.
return void

GetObject() public method

Gets an instance of the specified object type. An instance is created if one has not been registered with the container. A factory method is called if a factory has been registered or implemented on the object type.
public GetObject ( Type objectType ) : object
objectType System.Type The type of object to retrieve.
return object

GetSetting() public method

Gets the value of the specified setting.
public GetSetting ( string name ) : string
name string The name of the setting.
return string

GetTemplate() public method

Gets a template instance from the specified template name. The specified name is used to lookup a script element with a matching id.
public GetTemplate ( string name ) : Template
name string The name to lookup a template.
return Template

PublishEvent() public method

Raises the specified event. The type of the event arguments is used to determine which subscribers the event is routed to.
public PublishEvent ( EventArgs eventArgs ) : void
eventArgs System.EventArgs The event arguments containing event-specific data.
return void

RegisterBehavior() public method

Registers a behavior so it can be used declaratively in markup.
public RegisterBehavior ( string name, Type behaviorType, Type serviceType ) : void
name string The unique name of the behavior.
behaviorType System.Type The type of the behavior.
serviceType System.Type An option service type associated with the behavior for auto-registration with the application container.
return void

RegisterBinder() public method

Registers a binder factory. The supplied name prefixed with "data-" is used as the attribute name in markup to create a binder.
public RegisterBinder ( string name, BinderFactory factory ) : void
name string The name of the expression handler.
factory BinderFactory The factory being registered.
return void

RegisterExpression() public method

Registers an expression factory. The supplied name is used in markup to represent an instance of the associated expression.
public RegisterExpression ( string name, ExpressionFactory factory ) : void
name string The name of expression.
factory ExpressionFactory The factory to be used to handle the supplied name.
return void

RegisterFactory() public method

Registers an object factory with the container. The factory is called when the particular object type is requested. The factory can decide whether to cache object instances it returns or not, based on its policy.
public RegisterFactory ( Type objectType, Func objectFactory ) : void
objectType System.Type
objectFactory Func
return void

RegisterObject() public method

Registers an object instance for the specified object type.
public RegisterObject ( Type objectType, object objectInstance ) : void
objectType System.Type The type that can be used to lookup the specified object instance.
objectInstance object The object instance to use.
return void

RegisterService() public method

Registers a service type.
public RegisterService ( string name, Type serviceImplementationType, Type serviceType ) : void
name string The name of the service.
serviceImplementationType System.Type The type providing the implementation of the service.
serviceType System.Type The type of the service.
return void

RegisterTemplate() public method

Registers a template with the specified name.
public RegisterTemplate ( string name, Template template ) : void
name string The name of template.
template Template The template to be used.
return void

RegisterTemplateEngine() public method

Registers a template engine. The supplied name is used to match against the mime type attribute on a template script element.
public RegisterTemplateEngine ( string name, TemplateEngine engine ) : void
name string The name of template engine.
engine TemplateEngine The engine to be used to handle the supplied name.
return void

SubscribeEvent() public method

Subscribes to the specified type of events. The resulting cookie can be used for unsubscribing.
public SubscribeEvent ( Type eventType, Callback eventHandler ) : object
eventType System.Type The type of the event.
eventHandler Callback The event handler to invoke when the specified event type is raised.
return object

UnsubscribeEvent() public method

Unsubcribes from a previously subscribed-to event type.
public UnsubscribeEvent ( object subscriptionCookie ) : void
subscriptionCookie object The subscription cookie.
return void

Property Details

AutoInit public static property

Whether to automatically initialize the application once the page has loaded along with referenced scripts.
public static bool AutoInit
return bool

Current public static property

The current Application instance.
public static Application,Sharpen.Html Current
return Application