private void LoadData2() { _refresh = false; IsWiXFeatures features = new IsWiXFeatures(); treeViewFeatures.Nodes.Clear(); ClearPropertyGrid(); toolStripMenuItemDelete.Enabled = false; toolStripMenuItemRename.Enabled = false; toolStripMenuItemNewSubFeature.Enabled = false; foreach (var feature in features) { var treeNode = treeViewFeatures.Nodes.Add(feature.Id, string.Format("{0}", feature.Id)); treeNode.Tag = feature; LoadDataRecurse(treeNode, feature.Id); } UpdateMergeModules(); if (treeViewFeatures.Nodes.Count > 0) { _refresh = true; treeViewFeatures.Select(); treeViewFeatures.SelectedNode = treeViewFeatures.Nodes[0]; treeViewFeatures.ExpandAll(); } }
private void toolStripMenuItemNewFeature_Click(object sender, EventArgs e) { if (treeViewFeatures.SelectedNode == null)//|| treeViewFeatures.SelectedNode.Parent == null) { IsWiXFeatures features = new IsWiXFeatures(); string featureName = IsWiXFeatures.SuggestNextFeatureName(); IsWiXFeature feature = features.Create(featureName); TreeNode node = treeViewFeatures.Nodes.Add(feature.Id); node.Tag = feature; _refresh = true; treeViewFeatures.SelectedNode = node; } else { IsWiXFeatures features = new IsWiXFeatures(); string featureName = IsWiXFeatures.SuggestNextFeatureName(); var iswixFeature = treeViewFeatures.SelectedNode.Tag as IsWiXFeature; IsWiXFeature feature = features.Create(iswixFeature.Id, featureName); TreeNode node = treeViewFeatures.Nodes.Insert(treeViewFeatures.SelectedNode.Index + 1, feature.Id); node.Tag = feature; _refresh = true; treeViewFeatures.SelectedNode = node; } treeViewFeatures.SelectedNode.BeginEdit(); }
private void LoadDataRecurse(TreeNode parentNode, string parentId) { IsWiXFeatures features = new IsWiXFeatures(parentId); foreach (var feature in features) { var treeNode = parentNode.Nodes.Add(feature.Id, string.Format("{0}", feature.Id)); treeNode.Tag = feature; LoadDataRecurse(treeNode, feature.Id); } }
private void toolStripMenuItemNewSubFeature_Click(object sender, EventArgs e) { IsWiXFeatures features = new IsWiXFeatures(); string featureName = IsWiXFeatures.SuggestNextFeatureName(); var iswixFeature = treeViewFeatures.SelectedNode.Tag as IsWiXFeature; IsWiXFeature feature = features.CreateSubFeature(iswixFeature.Id, featureName); TreeNode node = treeViewFeatures.SelectedNode.Nodes.Add(featureName); node.Tag = feature; _refresh = true; treeViewFeatures.SelectedNode = node; treeViewFeatures.SelectedNode.BeginEdit(); }