Update MainStatus

Sep 21, 2007 at 11:27 AM
This is probably very easy, but I don't know how to update the mainStatusStripLabel with a new text label. All it says now is "Ready", but I would like to update this from a view's presenter class. How do I do that?
Sep 21, 2007 at 3:54 PM
Edited Sep 21, 2007 at 3:55 PM

When you create a new project of SCSF, the shell already brings by default the subscription to a event called EventTopicNames.StatusUpdate.

What you must to do to update the _statusLabel in your _mianStatusStripLabel from some module is to publish that event and raise it.
To do this, add the following code in your presenter's view:

[EventPublication(EventTopicNames.StatusUpdate, PublicationScope.Global)]
public event EventHandler<EventArgs<string>> StatusUpdate;
public virtual void OnStatusUpdate(string eventArgs)
    if (StatusUpdate != null)
        StatusUpdate(this, new EventArgs<string>(eventArgs));
Finally, from your view you will have to call the method OnStatusUpdate and pass it the string that you want to show.

Some interesting topics you can read from the SCSF's Help are:
  • Smart Client Software Factory -> Development Activities -> How to: Publish Events.
  • Smart Client Software Factory -> Development Activities -> How to: Subscribe to Events.
Please let me know if this helps!

Mariano Converti
Sep 24, 2007 at 11:31 AM
Yepp...! Now it works...