public void OnLoadNextLevel(NodeLoader loader) { if (!_nextLevelLoaded) { _nextLevelLoaded = true; WixIconCollection icons = this.IconNodes; if (icons != null && icons.Icons.Count > 0) { ImageList imgs = null; if (this.TreeView != null) { imgs = this.TreeView.ImageList; } foreach (WixIconNode ico in icons.Icons) { int idx = -1; if (imgs != null) { if (!string.IsNullOrEmpty(ico.SourceFile)) { if (File.Exists(ico.SourceFile)) { Image img = Image.FromFile(ico.SourceFile); imgs.Images.Add(img); idx = imgs.Images.Count - 1; } } } TreeNodeWixIcon iconNode = new TreeNodeWixIcon(ico, idx); Nodes.Add(iconNode); } } } }
private void mnu_addIcon(object sender, EventArgs e) { WixIconNode ico = this.IconNodes.AddIcon(); if (_nextLevelLoaded) { TreeNodeWixIcon iconNode = new TreeNodeWixIcon(ico, -1); Nodes.Add(iconNode); this.TreeView.SelectedNode = iconNode; } else { this.Expand(); if (this.TreeView != null) { for (int i = 0; i < this.Nodes.Count; i++) { TreeNodeWixIcon iconNode = this.Nodes[i] as TreeNodeWixIcon; if (iconNode != null) { if (string.CompareOrdinal(iconNode.IconNode.Id, ico.Id) == 0) { this.TreeView.SelectedNode = iconNode; break; } } } } } TreeViewWix tv = this.TreeView as TreeViewWix; if (tv != null) { tv.OnPropertyValueChanged(); } }