Navigation with SmartParts

Topics: CAB & Smart Client Software Factory
Jan 10, 2006 at 4:02 AM
originally posted by: nribeiro

I would like to add some kind of automatic navigation toolbar (browsers like) for back functionality.
Supose that I have smartpart A in workitem 1 then go to smartpart b in workitem 2 and then to c in workitem 2 again. If I press back toolbar button (toobar on shell), I would like to destroy smartpart c; if I press again back button I would like to destroy smart b and workitem 2.
Which is the best way to accomplish that. I think I need some kind of observer of all smart parts created, all smartparts shown (workspaces) and all workitem created.
Jan 10, 2006 at 6:09 AM
originally posted by: DLorenz

My guess is that you would call .Dispose on the Smartpart you want destroyed. Then you would probably need to remove the reference from the SmartPart collection on the WorkItem. Though, .Dispose may actually do that for you. I'm not really sure.
Jan 10, 2006 at 6:01 PM
originally posted by: RolandLi

As a SmartPart is just an object (UserControl) ,I don't think it can remove itself from a list.
But a WorkItem can move itself from its parent workitem's item list by using the Terminate() method.
In fact you can't explicite remove a workitem.

I think maybe you could reference to the acitve objects in a local field and remove them using the EventBroker mechanism when you need.