|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.CompositeUI.Collections;
using Microsoft.Practices.CompositeUI.EventBroker;
using XtensibleSolutions.CompositeUI.Extensions;
using XtensibleSolutions.CompositeUI.Extensions.SmartParts;
using XtensibleSolutions.CompositeUI.Extensions.Utility;
namespace XtensibleSolutions.CompositeUI.Extensions.Services.XSModuleCompMppr
{
internal sealed class XSEventPubCompMppr
{
private Dictionary<XSEventPubComp, XSEventPubComp> eventPubComps =
new Dictionary<XSEventPubComp, XSEventPubComp>();
internal XSEventPubCompMppr() { }
internal Dictionary<XSEventPubComp, XSEventPubComp> EventPubComps
{
get { return eventPubComps; }
}
internal void ApplyCompositeMappings(IXSWorkItem thisWorkItem)
{
// cast to XSWorkItem for property access and publication
XSWorkItem workItem = (XSWorkItem)thisWorkItem;
// events are managed at the same-level WorkItem but
// are broadcast/received according to PublicationScopeEnum
ManagedObjectCollection<EventTopic> events =
workItem.EventTopics;
foreach (XSEventPubComp eventPubComp in eventPubComps.Keys)
{
if (eventPubComp.PublisherTypeEnum == XSEventPubSubType.WorkItem)
{
// accesses an existing Event, or a new one if there is not one
// already present (the Get method does this automatically)
events[eventPubComp.EventTopic].AddPublication(
workItem,
eventPubComp.PublicationHandlerName,
workItem,
eventPubComp.PublicationScopeEnum);
}
}
}
internal void ApplyCompositeMappings(IXSPresenter thisPresenter)
{
XSWorkItem workItem = thisPresenter.WorkItem;
// events are managed at the same-level WorkItem but
// are broadcast/received according to PublicationScopeEnum
ManagedObjectCollection<EventTopic> events =
workItem.EventTopics;
foreach (XSEventPubComp eventPubComp in eventPubComps.Keys)
{
if (eventPubComp.PublisherTypeEnum == XSEventPubSubType.Presenter)
{
// accesses an existing Event, or a new one if there is not one
// already present (the Get method does this automatically)
events[eventPubComp.EventTopic].AddPublication(
thisPresenter,
eventPubComp.PublicationHandlerName,
workItem,
eventPubComp.PublicationScopeEnum);
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.