Reputation: 1
I made a configurator in C#, the program show differents winforms according to each step.
Imagine a form with three options, you can choose "Door", "Window" and also "Car" or "Bycicle. Door and Window is in the same group with radio button control, the user choose one or other but he can't choose both. Car and bycicle are checkboxes, he can choose both.
Ok, my idea now is that the user can configure his own rules for his configurators, the idea it's that he can add rules for add materials depending the options he will choose in the form of the configurator.
For example:
Rule 1: If i choose window, i put 2 glasses
Rule 2: If i choose a bycicle, i put two wheels
Rule 3: If i choose a car, i put 4 wheelsand 6 glasses.
The rules will be created using a form with some checkboxes that he can mark, for example:
Line 1:
Window (checkbox) Bycicle (checkbox) Car (checkbox) Materials to add(textbox) Uds to add (numericupdown)
The problem here is when i try to filter his choice. He can create a rule for window and car where he can put 1 glass. He can create a rule for car and bycicle where he can put 2 wheels. Also he can create another rule for only windows, only bycicle or only car...
My problem is : how i can filter his options? i tried with
if(windowFORM.checked == windowCARTRULE
|| bycicleFORM.checked == bycicleCARTRULE.checked
|| carFORM.checked == carCARTRULE.checked)
{
// add material
}
But didn't work. I tried also creating a binary filter for form like 1001 and other filter for CARTRULE 1010 and try AND operation = 1001 & 1010 = 1000, but didn't work also.
Someone have any ideas?
Upvotes: 0
Views: 166
Reputation: 9782
You have to rethink your overall design.
Draw the "design" on paper, find out all possibilities for all choices. This will likely be a hierarchical tree with several elements at each node.
Then build an XML file from this tree. This XML file is your "configuration"
Then create code around the XML file structure which will create your window layout.
Upvotes: 1