/// <summary> /// Register a particular <c>ICommand</c> class as the handler /// for a particular <c>INotification</c>. /// </summary> /// <remarks> /// <para> /// If a <c>ICommand</c> has already been registered to /// handle <c>INotification</c>s with this name, it is no longer /// used, the new <c>Func</c> is used instead. /// </para> /// <para> /// The Observer for the new ICommand is only created if this the /// first time an ICommand has been regisered for this Notification name. /// </para> /// </remarks> /// <param name="notificationName">the name of the <c>INotification</c></param> /// <param name="commandType">the <c>ICommand</c> type</param> public virtual void RegisterCommand(string notificationName, Type commandType) { if (!CommandMap.ContainsKey(notificationName)) { MyView.RegisterObserver(notificationName, new Observer(ExecuteCommand, this)); } CommandMap[notificationName] = commandType; }