public void LoadResourceNodes <T>() where T : ResourcePointer { ProjectResources rm = this.ResourceManager; IList <T> rs = rm.GetResourceList <T>(); SortedList <string, TreeNode> s = new SortedList <string, TreeNode>(); foreach (T r in rs) { if (IsForSelection) { TreeNodeResourceCode tn = new TreeNodeResourceCode(r); s.Add(tn.Text, tn); } else { TreeNodeResource tn = r.CreateTreeNode(); s.Add(tn.Text, tn); } } IEnumerator <KeyValuePair <string, TreeNode> > en = s.GetEnumerator(); while (en.MoveNext()) { Nodes.Add(en.Current.Value); } }
private void buttonOK_Click(object sender, EventArgs e) { TreeNodeResourceCode tnr = treeView1.SelectedNode as TreeNodeResourceCode; if (tnr != null) { SelectedResource = tnr.Pointer.Resource; this.DialogResult = DialogResult.OK; } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { TreeNodeResourceCode tnr = e.Node as TreeNodeResourceCode; buttonOK.Enabled = (tnr != null); }