private void trvOptions_AfterSelect(object sender, TreeViewEventArgs e) { OptionsNode optionsNode = this.trvOptions.SelectedNode as OptionsNode; System.Type type = optionsNode.Options.GetType(); this.pnlOptions.Controls.Clear(); if (!this.optionsPanels.ContainsKey(type)) { OptionsPanel optionsPanel = (OptionsPanel)Activator.CreateInstance(optionsNode.Options.PanelType); this.optionsPanels.Add(type, optionsPanel); optionsPanel.Init(optionsNode.Options); } this.pnlOptions.Controls.Add((Control)this.optionsPanels[type]); }
private void AddNodes(TreeNodeCollection nodes, OptionsBase options) { foreach (OptionsBase options1 in (IEnumerable <OptionsBase>)options.SubOptions) { OptionsNode optionsNode = new OptionsNode(options1); nodes.Add((TreeNode)optionsNode); if (!this.optionsNodes.ContainsKey(options1.GetType())) { this.optionsNodes.Add(options1.GetType(), optionsNode); } this.AddNodes(optionsNode.Nodes, options1); } if (nodes.Count <= 0 || options is AppOptions) { return; } GeneralOptionsNode generalOptionsNode = new GeneralOptionsNode(options); nodes.Insert(0, (TreeNode)generalOptionsNode); }
private void AddNodes(TreeNodeCollection nodes, OptionsBase options) { foreach (OptionsBase options1 in (IEnumerable<OptionsBase>) options.SubOptions) { OptionsNode optionsNode = new OptionsNode(options1); nodes.Add((TreeNode) optionsNode); if (!this.optionsNodes.ContainsKey(options1.GetType())) this.optionsNodes.Add(options1.GetType(), optionsNode); this.AddNodes(optionsNode.Nodes, options1); } if (nodes.Count <= 0 || options is AppOptions) return; GeneralOptionsNode generalOptionsNode = new GeneralOptionsNode(options); nodes.Insert(0, (TreeNode) generalOptionsNode); }