1

I'm looking for something like:

WorkItem item = CompositeUI...GiveMeTheWorkItem(this);

The code I've inherited is injecting the root workitem into everything which seems a bit long winded.

Ian
  • 4,885
  • 4
  • 43
  • 65

1 Answers1

2

figured I might as well try answering this as well for you. Based on my experience, I would have to say that what you are describing above is not available in the base CAB/SCSF framework.

The RootWorkItem contains a collection of child WorkItems which are created by your application to handle specific use case scenario. Each WorkItem contains a collection of smart parts and you can check if a WorkItem contains a specific SmartPart using the Get or Contains methods exposed by the WorkItem.SmartPart collection.

While I agree with you that injecting the RootWorkItem into everything is a bit "long winded", if you use the WorkItemController base class for your WorkItems (which you should) then this is done for you in the base class.

As a possible solution, you could extend the WorkItemController base class with some sort of a FindSmartPart method which could traverse through the WorkItem collection of the RootWorkItem class and search for the SmartPart using the above mentioned methods.

Hope that helps.

neverseenjack
  • 316
  • 2
  • 13
  • That does make sense and helps. A few months ago I finally lost patience with it (actually it was more to do with the control suite's dodgy SCSF support) and wrote an SCSF replacement that did things my way. Note I didn't say the right way, but life has been a whole lot simpler since :) – Ian Sep 05 '12 at 22:27
  • Which suite were you using for SCSF? I am using a modified version of the DevExpress suite and so far I have very little complaints. Can you elaborate on the issues you were having? – neverseenjack Sep 06 '12 at 17:01
  • Syncfusion, albeit a two (almost three now) year old version. There are a lot of really good bits in the suite, but they are all held together with really rotten glue. I'm moving to DevExpress now too. I'm sure I'll be swearing at it soon enough, but I've really really had enough of syncfusion. To me it feels built on rotten foundations. – Ian Sep 06 '12 at 23:13