StatusBar in shell

Topics: CAB & Smart Client Software Factory
Jan 13, 2006 at 12:48 PM
originally posted by: aleung61

Sorry in advance, if this is a stupid newbie question :)

I have this working, but I'm not sure if I'm doing this the way I should.

The statusStrip is on the shell form and it is registered in the rootWorkItem.UIExtentionSites collection. When the module loads, it creates an instance of the ToolStripStatusLabel and adds it to the UIExtentionSites. It shows up on the statusStrip just fine. Now to modify the Text property of that ToolStripStatusLabel throughout my module, I'd like to get my reference to that control back from the UIExtentionSites collection, but I couldn't figure out how to do that. So instead, I also added the object to the rootWorkItem.Items collection (right after I added it to UIExtentionSites). The controllers for each WorkItem in the app can get the control reference out of the Items collection and expose a method to change the text.

Is this OK? or am I missing something?

Like I said, this works, but it seesm odd that I have to store the control reference in two places.
Jan 13, 2006 at 7:48 PM
originally posted by: amishah_2001

Hey,
why you want to module to handle status bar label control? Id your requirement is like you want a statusbar in the shell appln and you want to update the text as per the tasks from the module then you can do event subscribe and publish.
You can just go thru the Bankteller exam ple and what i feel is it is the best way to do. you just need to take care of publishing the event from the module whnever you want to change status lable and at the shell the subscribed event will take care of updating it.
Jan 14, 2006 at 5:47 AM
originally posted by: aleung61

That's not a bad idea. I can see that working for most cases. The only scenario I can see where that might not work is if the module needed to add a label to the status bar (rather than update the text in the existing one) that only that module would manipulate.

I'm also thinking I would have a similar situation with menu items that are added to the Shell's menu by the module. If the module needs to enable/disable or check/uncheck the menu item, it needs a reference to the menu item object.

So my original question still remains. Should I be able to get that reference back from the UIExtensionSite collection OR should I store it somewhere else -- like the Items collection?
Jan 14, 2006 at 6:48 AM
originally posted by: BradWilsonMSFT

If you want it back, you'll need to explicitly store it. The extension sites collection only contains places to extend the UI; it does not store (for your retrieval) the list of things that extended the UI.