Can One SmartPart be shown in different places

Topics: CAB & Smart Client Software Factory
Apr 12, 2006 at 1:58 AM
originally posted by: mojsony


Is there a way to do this?

Let's say I have SmartPart which conatains comboBox for choosing Account.

I need that Smart part in AccountInfo center module (in some place), in Order Managament (on some other place) etc....

Can this be acomplished using SmartParts, and How?

Apr 13, 2006 at 5:43 AM
originally posted by: ChrisHolmes

Sure, you can do that. You just need your modules to include a reference to the .dll that contains the SmartPart/Presenter. Then you can create it and use it wherever you need it.

I could be wrong here, but I think it's probably standard practice to put commonly used UI elements in a Common project and reference it where needed. I have a Common.dll myself and it includes all sorts of things, from EventNames to small GUI controls that are commonly shared and re-used among modules.
Apr 15, 2006 at 2:09 AM
originally posted by: turmelma

I do use "common" modules as well - I believe they are a good way of factoring reusable views and presenters, service interfaces (and sometimes implementations as well), constants of all sort of types (event topics, command names, workspace names, etc.).

Apr 18, 2006 at 10:53 AM
originally posted by: DLorenz

You would probably be better off just recreating it. The controller the view references is dependant upon one type of WorkItem. If you don't make any specific calls to the workitem, then you could reuse it.
Apr 19, 2006 at 5:16 AM
originally posted by: ChrisHolmes

"The controller the view references is dependant upon one type of WorkItem."

Only if you design it that way, which IMO would be bad (highly coupled) design. It would be better to design the controller so it is not dependent on a specific WorkItem, but instead dependent on the base class WorkItem. What the controller should really be dependent on are the services the WorkItem provides and the State bag, which would be Dependency Injected to it in the first place.

With proper decoupling applied you could reuse a View in multiple WorkItems, each WorkItem providing the controller with different implementations of the Services it requires.
Apr 25, 2006 at 9:24 PM
originally posted by: mojsony

Thanks all for your answers,

I was on holiday so I didn't replyed....

here is exactly what I need to do.

I have customer which can be subscribed to 0,1, .... n bank accounts. If I want to use a smartpart which has: combobox for choosing active account, few labels describing account and stuf...
I want to use that smart part in deferent workitems, and modules like on: OrderEntry workitem, Statement workitem (from statementmanagament module), reports workitem from (report center module) etc...

One more thing is that all this modules will not be loaded and the smart part will not be shown if user has 0 bank accoutns he is subscribed to.

Thanks a lot.