Is an Array of Dictionaries the solution here?
-
Hi all, First some context to my question: I am working on a utility that queries the Windows registry for a large number of keys set by a particular application. I am using multiple DataGridView (DGV) controls to display the information (Reg Key and Value) on my form. Each DGV is tied to a Dictionary using a BindingSource. This has worked out fine for all sets of keys except for one. - This application has provision for 10 different user-profiles. - Associated with each user-profile are 7 SETS of feature keys. - At any given time, the user needs to see the settings for only ONE of the 10 profiles. - On my form, I have a collection of radiobuttons that I use to select a profile. PROBLEM: 1. Should I use an array of dictionaries (dimension 1: profile; dimension 2: feature)? If so, how do I do this? If not, what is a better solution? 2. Can I have only 1 set of DGVs (representing the feature keys), so when I click between profiles, the DGVs are updated with the values for that profile? Thanks for your help!
-
Hi all, First some context to my question: I am working on a utility that queries the Windows registry for a large number of keys set by a particular application. I am using multiple DataGridView (DGV) controls to display the information (Reg Key and Value) on my form. Each DGV is tied to a Dictionary using a BindingSource. This has worked out fine for all sets of keys except for one. - This application has provision for 10 different user-profiles. - Associated with each user-profile are 7 SETS of feature keys. - At any given time, the user needs to see the settings for only ONE of the 10 profiles. - On my form, I have a collection of radiobuttons that I use to select a profile. PROBLEM: 1. Should I use an array of dictionaries (dimension 1: profile; dimension 2: feature)? If so, how do I do this? If not, what is a better solution? 2. Can I have only 1 set of DGVs (representing the feature keys), so when I click between profiles, the DGVs are updated with the values for that profile? Thanks for your help!
- The registry is evil, don't use it. 1) DataGridView is evil and likely an inappropriate control for your purpose. 2) The registry is a tree, why not use a TreeView?
-
Hi all, First some context to my question: I am working on a utility that queries the Windows registry for a large number of keys set by a particular application. I am using multiple DataGridView (DGV) controls to display the information (Reg Key and Value) on my form. Each DGV is tied to a Dictionary using a BindingSource. This has worked out fine for all sets of keys except for one. - This application has provision for 10 different user-profiles. - Associated with each user-profile are 7 SETS of feature keys. - At any given time, the user needs to see the settings for only ONE of the 10 profiles. - On my form, I have a collection of radiobuttons that I use to select a profile. PROBLEM: 1. Should I use an array of dictionaries (dimension 1: profile; dimension 2: feature)? If so, how do I do this? If not, what is a better solution? 2. Can I have only 1 set of DGVs (representing the feature keys), so when I click between profiles, the DGVs are updated with the values for that profile? Thanks for your help!
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities. A list of dictionaries is probably appropriate. You can only have one set of controls, and switch their data sources when the profile changes.
-
- The registry is evil, don't use it. 1) DataGridView is evil and likely an inappropriate control for your purpose. 2) The registry is a tree, why not use a TreeView?
PIEBALDconsult wrote:
The registry is evil, don't use it.
Unfortunately, I have to :)
class="FQA">PIEBALDconsult wrote:
- DataGridView is evil and likely an inappropriate control for your purpose.
Not sure why the DGV is so evil but it does work quite nicely for the purpose of my project.
PIEBALDconsult wrote:
- The registry is a tree, why not use a TreeView?
I will look into using a TreeView... I did not know about this when I started working on my utility and I have the information displayed the way it is required. However, it might not be too late to rethink this design... thanks for the tip! :)
-
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities. A list of dictionaries is probably appropriate. You can only have one set of controls, and switch their data sources when the profile changes.
BobJanova wrote:
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities.
Yes, they are.
BobJanova wrote:
A list of dictionaries is probably appropriate.
You can only have one set of controls, and switch their data sources when the profile changes.Thank you! I will look into the list of dictionaries.
-
The keys you are looking up (for each dictionary) are just within one registry node, right? Otherwise the above advice is correct, you should use a control with tree capabilities. A list of dictionaries is probably appropriate. You can only have one set of controls, and switch their data sources when the profile changes.
Hi Bob, I have a follow-up question. Is there a way for me to avoid declaring 10 * 7 = 70 dictionaries? 10 is the number of use-cases and 7 is the number of dictionaries I would require for each use case. I have a group of radio controls (gb_profiles) on the GUI and have been able to edit its CheckedChanged function to derive the index of the control that has been checked.
private void rb_prof_CheckedChanged(object sender, EventArgs e)
{
/* We are doing the following here:
* 1. Identifying the radio button selected
* 2. Setting the profile_selected variable using the radio button index
*/foreach (Control ctl in gb\_profiles.Controls) { if (sender.Equals(ctl)) { profile\_selected = gb\_profiles.Controls.IndexOf(ctl); } } }
How do I use this to load the dictionary with only the values for this profile? Thanks for your help!
-
Hi Bob, I have a follow-up question. Is there a way for me to avoid declaring 10 * 7 = 70 dictionaries? 10 is the number of use-cases and 7 is the number of dictionaries I would require for each use case. I have a group of radio controls (gb_profiles) on the GUI and have been able to edit its CheckedChanged function to derive the index of the control that has been checked.
private void rb_prof_CheckedChanged(object sender, EventArgs e)
{
/* We are doing the following here:
* 1. Identifying the radio button selected
* 2. Setting the profile_selected variable using the radio button index
*/foreach (Control ctl in gb\_profiles.Controls) { if (sender.Equals(ctl)) { profile\_selected = gb\_profiles.Controls.IndexOf(ctl); } } }
How do I use this to load the dictionary with only the values for this profile? Thanks for your help!
Would you ever have more than one use case open at once? If so, I don't see how you can avoid declaring dictionaries for each use case, and within each one you would have a dictionary for each option. (You could do some lazy loading and caching but honestly for a reasonable sized registry key it is nit worth it.)
-
Would you ever have more than one use case open at once? If so, I don't see how you can avoid declaring dictionaries for each use case, and within each one you would have a dictionary for each option. (You could do some lazy loading and caching but honestly for a reasonable sized registry key it is nit worth it.)
I will not be displaying more than one use case at once. However, the user will have the option to save the results of the registry key to a file (I think I am going to go with XML for that). Given this, it appears that I might have to declare dictionaries for all these use cases...