Community Server

The platform that enables you to build rich, interactive communities
Welcome to Community Server Sign in | Join | Help
in Search

agile

Event Publication and Subscription on SCFC or CAB

On SCSF and CAB there two things that for me is new. First is Event Publication. Event Publication is the publisher of event where the event if fire. As example i have this kind of code:
 
public void item_clicked(object sender, EventArgs e)
{
    this.Clicked();

and i want publish this event so the other WorkItem can subscribe it. So what i do is i create an Event publication

[EventPublication(EventTopicNames.ItemClicked, PublicationScope.Global)]
public event EventHandler<EventArgs> ItemIsClicked

this is for publish the event and we have to create one protected virtual method to invoke that event as example:

protected virtual void OnItemIsClicked(object item)
{
    if(null != ItemIsClicked)
    {
       ItemIsClicked(this, new EventArgs())
    }
}

but at the item_clicked method we have to put CommandHandler so the CAB know which event have involve. What we have to do is

[CommandHandler(CommandNames.ItemClickedCommand)]
public void item_clicked(object sender, EventArgs e)
{
    this.Clicked();

that on event publication... on other presenter or Module Controller we can subscribe event as example like below;
 
[EventSubscription(EventTopicNames.ItemClicked, ThreadOption.UserInterface)]
public void ItemClicked(object sender, EventArgs e)
{
    item.Clicked();
    panel.Text = "Clicked";
}
 

thats what i've trying to familiar with CAB od SCSF and if there is some thing wrong... please comment it and fix the wrong... i still in learning on this kind of CAB and SCSF 

Published Thursday, November 02, 2006 7:48 AM by hakimin
Filed under:

Comments

No Comments
Anonymous comments are disabled

About hakimin

Software Developer
Powered by Community Server, by Telligent Systems