Shell Form is coming on to top while loading

Topics: CAB & Smart Client Software Factory
Apr 5, 2007 at 5:17 PM
Shell Form is coming on to top while loading

I have a shell form with deck workspace. I am initializing it with several smart parts. It takes a while to load these smart parts. While it is loading, if I click on other applications (IE, word etc), shell form comes to top every time I call deckworkspace.show(smartpart). I was okay with it but our customers do not like it. I am wondering if I can suppress it somehow.
Apr 6, 2007 at 7:13 PM
Edited Apr 6, 2007 at 7:13 PM
You are having some lenthy operations on loading the smart parts. Do those lenghty operations in background thread. You can use EventSubsription attribute with background thread option as below. So, that your shell doesn't show up if you are in some other windows.

EventPublication("event://BackgroundUIOperation", PublicationScope.WorkItem)
public event EventHandler<EventArgs> UpdatesAvailable;

private void AddViews()
{
//TODO: create the Module views, add them to the WorkItem and show them in
// a Workspace. See: ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.scsf.2006jun/SCSF/html/03-300-Adding%20a%20View.htm
UpdatesAvailable(this, new EventArgs());

}


EventSubscription("event://BackgroundUIOperation", Thread=ThreadOption.Background)
public void DoInBackground(object sender, EventArgs args)
{

//Create smart parts
BusinessModule1View1 smartPart = this.WorkItem.SmartParts.AddNew<BusinessModule1View1>();
ISmartPartInfo smartPartInfo = new SmartPartInfo();
smartPartInfo.Title = "BusinessModule1WorkItem";

//Show your smarts parts on your form
this.WorkItem.Workspaces"TabWorkspace".Show(smartPart, smartPartInfo);
}
Apr 10, 2007 at 7:41 PM
Thanks Venkat. I tried to run AddViews methods in background thread but I am getting thread exception. I think threads can not access form or form controls directly.
Apr 10, 2007 at 9:10 PM
The actual source for DeckWorkspace.Show() has like this:

smartPart.BringToFront();
smartPart.Show();

because of Control.BringToFront() method call, your shell window comes at top??!? I am not sure about this. Can you show all your workspaces together once you finish all the init process?

Can you also describe how you are showing smart parts, how many workspaces do you have, what kind of operations you are doing during shell launch?