How to get the workspace in which a view is executing?

Topics: CAB & Smart Client Software Factory
Feb 12, 2007 at 3:25 PM

Feb 12, 2007 at 9:25 PM
So you are trying to get the Workspace that a particular view is being shown in?

If you are using SCSF I believe there is a WorkspaceFinder Service that you send a particular smart part to like this:

//code free handed from memory C#
IWorkspaceLocatorService FindService = Services.Get<IWorkspaceLocatorService>();
IWorkSpace FoundWorkspace;
FoundWorkspace = FindService.FindContainingWorkspace(RootWorkitem,SmartPartLookingFor);

All I do is get the locater service, then call the FindContainingWorkspace method.
I send the workitem to search and the smartpart to find.

I searched the bankBranch project and found this.
C:\Program Files\Microsoft SCSF\BankTellerWorkbench\Source\Src\BranchSystems\Module\Views\FindCustomerResultsViewPresenter.cs - (86, 35) : IWorkspace workspace = locator.FindContainingWorkspace(WorkItem, View);

Hope this answers your question,
Feb 28, 2007 at 8:11 PM
This is what I did:

protected override void OnRunStarted()

srAppView = this.Items.AddNew<srAppEntry>();
srViewPresenter = new srAppPresenter(srAppView);
srAppView.thisPresenter = srViewPresenter;
srAppView.thisWorkItem = this;

Of course, while the above code works, I still haven't completed the entire program and do not yet know if I am doing anything right here, but I can reference the work item from within both the view and the presenter.
Mar 12, 2007 at 3:24 PM
Sorry, you were asking about workspaces and I answered for WorkItems. Please excuse the cranial crepitation.