RE: Unload or replace view in a Zone workspace

Topics: CAB & Smart Client Software Factory
Dec 7, 2006 at 2:28 PM
originally posted by: hpcd

I have a SCSF application. In the main module, I have a MainView, which uses a ZoneWorkspace with two panels, organized so that one panel occupies the top half and the other panel; the bottom half.

I loaded a View into the bottom zone, using an event in the ModuleController class (fires from a menu in the shellform). This default view (in the bottom zone) has a datagrid with a list of items, and a button for editing each item. When I click the button for an item, I want to unload this view from the bottom zone, and load an edit/details view into the same zone. The problem, is that nothing is happening.

This is what I used to load the views into the top and bottom zone panels respectively:

ZoneSmartPartInfo svcZoneInfo = new ZoneSmartPartInfo("ServiceInformationZone");
svcZoneInfo.Dock = DockStyle.Fill;

IDocumentStatisticsView docStatView = WorkItem.SmartParts.AddNew<DocumentStatisticsView>();
ZoneSmartPartInfo docZoneInfo = new ZoneSmartPartInfo("ProcessInformationZone");
docZoneInfo.Dock = DockStyle.Fill;

_masterView.WorkSpace.Show(svcInfoView, svcZoneInfo);
_masterView.WorkSpace.Show(docStatView, docZoneInfo);

If I try


IPluginConfigurationView view = WorkItem.SmartParts.AddNew<PluginConfigurationView>();
ZoneSmartPartInfo info = new ZoneSmartPartInfo("ProcessInformationZone");

_masterView.WorkSpace.Show(view, info);

it doesn't replace the view in the zone. It seems to add it to the control collection; but my old view is still showing (not the newly added one). If there a way to unload a view from the zone?

Currently, the only way I can do this is to:

// add this first line
_masterView.WorkSpace.Zones"ProcessInformationZone".Controls.Clear();

IPluginConfigurationView view = WorkItem.SmartParts.AddNew<PluginConfigurationView>();
ZoneSmartPartInfo info = new ZoneSmartPartInfo("ProcessInformationZone");

_masterView.WorkSpace.Show(view, info);

Thanks.

Are there any plans to move SCSF to codeplex?
Dec 9, 2006 at 11:21 AM
originally posted by: SKVIC20

I have to admit I am fairly new to the SCSF so I am not sure if this will help. I don't really follow what your doing in code but...

I am using a DeckWorkspace, to add another view or hide a View on it I go to the workItem.Workspace and show or hide the view...

I either add it if it's not there or get a reference to it by...

IMailboxView MailBoxView = null;

if (WorkItem.SmartParts.Contains(MailBoxViewKey) == false)
{
MailBoxView = WorkItem.SmartParts.AddNew<MailboxView>(MailBoxViewKey);
}
else
{
MailBoxView = WorkItem.SmartParts.Get<MailboxView>(MailBoxViewKey);
}
WorkItem.WorkspacesInfrastructure.Interface.Constants.WorkspaceNames.LayoutWorkspace.Show(MailBoxView);
}

or

WorkItem.WorkspacesInfrastructure.Interface.Constants.WorkspaceNames.LayoutWorkspace.Hide(MailBoxView);



hope this help...

Thanks
Steve