IController implementation.
More...

Public Member Functions | |
| virtual void | ExecuteCommand (INotification note) |
If an ICommand has previously been registered to handle a the given INotification, then it is executed. | |
| virtual void | RegisterCommand (string notificationName, Type commandType) |
Register a particular ICommand class as the handler for a particular INotification. | |
| virtual bool | HasCommand (string notificationName) |
| Check if a Command is registered for a given Notification. | |
| virtual void | RemoveCommand (string notificationName) |
Remove a previously registered ICommand to INotification mapping. | |
Protected Member Functions | |
| Controller () | |
| virtual void | InitializeController () |
Initialize the Singleton Controller instance. | |
Protected Attributes | |
| IView | m_view |
| IDictionary< string, Type > | m_commandMap |
| Mapping of Notification names to Command Class references. | |
| readonly object | m_syncRoot = new object() |
| Used for locking. | |
Static Protected Attributes | |
| static volatile IController | m_instance |
| Singleton instance, can be sublcassed though.... | |
| static readonly object | m_staticSyncRoot = new object() |
| Used for locking the instance calls. | |
Properties | |
| static IController | Instance [get] |
| Singleton Factory method. This method is thread safe. | |
IController implementation.
In PureMVC, the Controller class follows the 'Command and Controller' strategy, and assumes these responsibilities:
ICommands are intended to handle which INotifications. IObserver with the View for each INotification that it has an ICommand mapping for. ICommand to handle a given INotification when notified by the View. ICommand's execute method, passing in the INotification.
Your application must register ICommands with the Controller.
The simplest way is to subclass Facade, and use its initializeController method to add your registrations.
PureMVC.Core.View PureMVC.Patterns.Observer PureMVC.Patterns.Notification PureMVC.Patterns.SimpleCommand PureMVC.Patterns.MacroCommand
| PureMVC.Core.Controller.Controller | ( | ) | [protected] |
Constructs and initializes a new controller
This IController implementation is a Singleton, so you should not call the constructor directly, but instead call the static Singleton Factory method Controller.getInstance()
| virtual void PureMVC.Core.Controller.ExecuteCommand | ( | INotification | note | ) | [virtual] |
If an ICommand has previously been registered to handle a the given INotification, then it is executed.
| note | An INotification |
Implements PureMVC.Interfaces.IController.
| virtual bool PureMVC.Core.Controller.HasCommand | ( | string | notificationName | ) | [virtual] |
Check if a Command is registered for a given Notification.
| notificationName |
notificationName.Implements PureMVC.Interfaces.IController.
| virtual void PureMVC.Core.Controller.InitializeController | ( | ) | [protected, virtual] |
Initialize the Singleton Controller instance.
Called automatically by the constructor
Note that if you are using a subclass of View in your application, you should also subclass Controller and override the initializeController method in the following way:
ensure that the Controller is talking to my IView implementation public override void initializeController() { view = MyView.Instance; }
| virtual void PureMVC.Core.Controller.RegisterCommand | ( | string | notificationName, | |
| Type | commandType | |||
| ) | [virtual] |
Register a particular ICommand class as the handler for a particular INotification.
| notificationName | The name of the INotification | |
| commandType | The Type of the ICommand |
If an ICommand has already been registered to handle INotifications with this name, it is no longer used, the new ICommand is used instead.
This method is thread safe and needs to be thread safe in all implementations.
Implements PureMVC.Interfaces.IController.
| virtual void PureMVC.Core.Controller.RemoveCommand | ( | string | notificationName | ) | [virtual] |
Remove a previously registered ICommand to INotification mapping.
| notificationName | The name of the INotification to remove the ICommand mapping for |
Implements PureMVC.Interfaces.IController.
IDictionary<string, Type> PureMVC.Core.Controller.m_commandMap [protected] |
Mapping of Notification names to Command Class references.
volatile IController PureMVC.Core.Controller.m_instance [static, protected] |
Singleton instance, can be sublcassed though....
readonly object PureMVC.Core.Controller.m_staticSyncRoot = new object() [static, protected] |
Used for locking the instance calls.
readonly object PureMVC.Core.Controller.m_syncRoot = new object() [protected] |
Used for locking.
IView PureMVC.Core.Controller.m_view [protected] |
Local reference to View
IController PureMVC.Core.Controller.Instance [static, get] |
Singleton Factory method. This method is thread safe.
1.5.8