Centralized Options page for work items

Topics: CAB & Smart Client Software Factory
Jul 26, 2006 at 8:12 AM
originally posted by: Jauwaad

How do I create an options page like Visual Studio where other work items can added entries and maintain their property settings.
Jul 27, 2006 at 7:31 AM
originally posted by: ChrisHolmes

Not a trivial problem =)

My first thought is to approach this as a service (I say that waaaaay too much on these boards, I know).

There's basically two parts to the Options page: the treeview control and the usercontrol (in this case, a SmartPart). Each TreeView item corresponds to a SmartPart that would be shown. So I can see a Service asking for a couple things:

(1) String to place in the TreeView, and some hierarchical information so it knows where to place it in the TreeView control.

(2) An event to fire when the TreeView item is clicked.

(3) A DeckWorkspace where the SmartParts could be shown.

Then it would be up to the individual Modules to provide the SmartParts that corresponded to their configuration settings. W

hen a Module loads, you'd want to fetch the Service and Add your TreeView Items to it, along with the appropriate EventBroker Events to call when those items are clicked. Then you'd need a WorkItem in each Module responsible for handling those Events; maybe something simple like fetching the service and passing the appropriate SmartPart to it, so that the service can show that SmartPart it its DeckView.

It's a neat little problem to solve... I think we may want to do the same sort of thing in our application.
Jul 29, 2006 at 7:07 AM
originally posted by: JKraft4PIT

I like that approach, I have a start page in our application and it is something like that.

I actually have more like a start Module, that creates/Starts other modules based on what smartpart is activated from the start page. The options are saved in the state of each start page workitem. This is working really well for me and should for you.
Aug 1, 2006 at 12:54 PM
originally posted by: Jauwaad

i think i get the idea. still a lot of details are not clear but it's a start. i'd appreciate any sample code to get started. thanks
Aug 4, 2006 at 4:52 AM
originally posted by: RohanSuperS

Sample code would be lovely!!!
Aug 4, 2006 at 5:35 AM
originally posted by: JKraft4PIT

I read over the posts again and got a little confused. I am not sure if you are looking for a "Settings" page or a spot to save the settings? Or do you mean the Properties tab? I am not sure what youy were looking for. I was thinking like this on my first post but I think we are on differnet tracks.

I have a main start page and I use a common module for settings (a xml file) that everything can see and similar to a winforms settings just call a save (My.Settings.Color = Red).

'setting a color setting, where ever in program
CommonModule.VisualSettings.Color = color.red

Inside the common module it saves the setting to a xml file (commonSettings.xml).
Aug 4, 2006 at 8:00 AM
originally posted by: Jauwaad

I'm trying to design a page that displays the entire applications user modifiable property set.

I was thinking of including this in the application framework.

Work items can add a tree node and display a corresponding property page to modify these settings and the settings are stored and loaded by this frame work in a common data store.. prefereably an XML file.

This is just so the application hosts a centralized service to save and load applications settings including that of all it's modules.
Aug 4, 2006 at 9:01 AM
originally posted by: JKraft4PIT

To me it sounds like you want each WorkItem in your app to have thier own Editable Properties. And depending on which WorkItem is active you want thier corresponding Editable Properites to appear somewhere (most likely a side panel).

Well I think the best way to do this is a seperate workitem for this. This workitem , lets call it "PropertiesWorkitem", has a reference to a service, lets call this service "PropertiesService", and all your workitems have the ablility to start and stop this propertiesWorkitem.

So you have this other workitem, lets call it "GenralWorkitem", and the user clicks a button on one of its views, and the message gets to the GeneralWorkitem (how ever you do it) that it wants to see its properties. This GeneralWorkitem will start the PropertiesWorkitem if it already isn't (if it isn't then it will create it). Then once it knows the propertiesWorkitem is running it either

A. Tells the PropertiesService to show the workitems details (service.get( of propertiesService)..blah blah blah) and this service gets the data from a xmlfile, webservice, databse what ever and fires a event that the proprtiesWorkitem handles. Then shows the data received.

B. The GeneralWorkItem fires off a global event (using the event broker) that it wants to show the properties. The PropertiesWorkItem subscribes to the event and then calls its PropertiesService to get the data. The PropertiesWorkitem then shows the data returned.

C. Some other way that someone can think of (and there are many).

I think both A and B will work fine it just depends on how you like ot do things. I like A since that is how I use my services ( similar to how the Offline Block works). B is great also since it is how CAB likes to communicate to others. It keeps things loosley coupled and many like that.

Hopefully I am on the right track for what you are trying to do, and may I ask what part of Visual Studio does this reperesent, I am thinkging it is like the Properties panel.
Aug 4, 2006 at 9:33 AM
originally posted by: ChrisHolmes

This is what I was imaging the original author was after:


Is that what we're talking about here?
Aug 4, 2006 at 10:12 PM
originally posted by: RohanSuperS

Yes chrisHolmes
That is what I want to do.

Sample code perhaps?
Aug 4, 2006 at 10:28 PM
originally posted by: RohanSuperS

I remembered in the Composite User Interface Application Block Hands on Labs there is quite a detailed description of what to do, when you browse to "07 Advanced CAB". The lab contain 2 excercises, describes as follows:

Exercise 1: Building a Custom Workspace
This exercise covers the advanced topic of creating a custom workspace for use with the Composite UI Application Block (CAB). You will complete all of the tasks needed to build your own tree-based navigation workspace.

Exercise 2: Building a Custom User Interface Element Adapter
In this exercise, you will build a custom UIElementAdapter to manage a hierarchical menu displayed in a tree view.
Aug 5, 2006 at 2:17 PM
originally posted by: Jauwaad

I think so far I'm getting the pieces together.

First there needs to be a service to handle registering options pages from each module/workitem. This service will allow an option page to be registered as a tree node or any other hierarchial structure. When the node is clicked then the corresponding page is displayed.

I would like some input on this. Whether the settings should be stored centrally or individually in different files for workitems. I would prefer it stored centrally and accessed from one central interface.

Just to get it clear, the application supports a service that manages property pages that are displayed in an integrated interface and a central way to access this information. Am I duplicating some effort here or is this something that is needed in the CAB as an extension to the framework.
Aug 5, 2006 at 2:27 PM
originally posted by: ChrisHolmes

(1) I don't think you're duplicating anything that already exists in the CAB :-)

(2) I would store things centrally instead of in separate files. Cuts down on I/O read/writes, and it is just simpler. Fewer files = simplicity. Each Module is free to carve out their own space within that file, but for the purposes of simplicity and the KISS principle I'd only store settings for an application in one place.
Aug 10, 2006 at 12:22 AM
originally posted by: WSeada

Hello Guys
I am new to CAB, and I am intersted in a good start, can anyone direct me to code samples, and I guess a sample to this properity options will be great

Thanks and best regards
Waleed Seada
Aug 12, 2006 at 6:41 AM
originally posted by: JKraft4PIT

The property options page is already referenced "07 Advanced CAB" you can download it "http://www.gotdotnet.com/codegallery/releases/viewuploads.aspx?id=22f72167-af95-44ce-a6ca-f2eafbf2653c">
inside the CAb Hands On Labs.
The implementation of the options page is still in descussion. You should really look at all the walkthrough labs and read the latest documentation. At first it is alot of information but the latest "Composite UI Application Block Introduction" helps alot.

Hopefully in the next couple weeks I will be implementing this options page, but have been getting side tracked, and be albe to opst some sample code. :)
Sep 19, 2006 at 9:10 AM
originally posted by: Jauwaad

Did anyone get any further in implementing this?