示例#1
0
 public static void SetValueIterate(string key, string val)
 {
     Config_UC.setValueIterate(Config_UC.fieldInfos, key, val.ToString(), ConfigVariables.CurrentSettings);
 }
示例#2
0
        private void PopulateConfig()
        {
            if (t != null)    //This condition has been added to dispose the tabcontrol since it was consuming user objects.
            {
                t.Dispose();
                //t = null;
            }

            {
                t = new TabControl();
            }
            t.Multiline = true;
            t.Size      = new System.Drawing.Size(this.Width, this.Height - (int)tableLayoutPanel1.RowStyles[1].Height);
            {
                config = new Config_UC();

                KeyValuePair <string, object> temp = config.rootDict;
                Dictionary <string, object>   dic  = temp.Value as Dictionary <string, object>;
                FieldInfo[] f = Config_UC.fieldInfos;
                foreach (FieldInfo val in f)
                {
                    if (val.Name.Equals("fileName"))
                    {
                        break;
                    }
                    TabPage     tPage         = new TabPage();
                    FieldInfo[] tempFieldInfo = val.FieldType.GetFields(System.Reflection.BindingFlags.Public | BindingFlags.Instance);
                    object      obj           = val.GetValue(ConfigVariables.CurrentSettings);
                    string      output        = "";
                    //This below foreach has been added by Darshan on 08-09-2015 to solve Defect no 0000631: The spaces are not left for the Labels in settings window.
                    foreach (char letter in val.Name)
                    {
                        if (Char.IsUpper(letter) && output.Length > 0)
                        {
                            output += " " + letter;
                        }
                        else
                        {
                            output += letter;
                        }
                    }
                    tPage.Text       = output;
                    tPage.AutoScroll = true;
                    if (tempFieldInfo.Count() != 0)
                    {
                        config.vIndent = 10;
                        config.addBranchL(tempFieldInfo, val.Name, 1, tPage, obj);
                    }
                    else
                    {
                        PropertyInfo[] pinf = val.FieldType.GetProperties(System.Reflection.BindingFlags.Public | BindingFlags.Instance);
                        config.vIndent = 10;
                        config.addBranchL(pinf, val.Name, 1, tPage, obj);
                    }

                    t.Controls.Add(tPage);
                    //tPage.Dispose();
                }
                t.Dock = DockStyle.Fill;
            }
            // this.Controls.Add(t);
            // config.Dock = DockStyle.Fill;

            tableLayoutPanel1.Controls.Add(t, 0, 0);
        }