This project has moved. For the latest updates, please go here.

about changing properties at run time.

Nov 4, 2007 at 7:02 PM
hi I love your workspace (and actualy i was created one for my self and my workspaec is similiar to yours but i think that your's is more professional...)

now I was wanderingif my view (that is a user control) should implement a specific interface ? (i havenot yet see the examples that you provide in the download section)

and the most important think: I have a view that change it's title at run time (my view implement ISmartPartInfoProvider, that return a DockPanelSmartPartInfo that describe the title of my view). how can your workspace capture this change at run time ? (my workspace can't ! :( )
Nov 14, 2007 at 5:25 PM
Sorry for the late answer. My job keeps me quite busy at the moment ;-)

The View concept of CAB does not require that a view class needs to implement an interface. Just apply the [SmartPart] attribute to your view class.
I also change the title of the SmartPart in the Test Suite reference application:

smartPartInfo.Title = SmartPartTitle;
smartPartInfo.Description = SmartPartTitle;
WorkItem.Workspaces[WorkspaceNames.DockPanelWorkspace].ApplySmartPartInfo(editorView, smartPartInfo);
This is done in the DocumentController of the RTFEditor module. The DocumentController is a WorkItemController that instantiates the editorView and the smartPartInfo. Thus, it is the right class to change the title of the EditorView.

The question remains how the DocumentController knows when to update the title of the SmartPart. The EditorView implements the ModifiedChanged event that is raised if the title should be updated. The DocumentController just listens to this event and updates the title of the EditorView.

editorView.ModifiedChanged += new EventHandler(EditorViewModifiedChanged);