private void mnu_removeCulture(object sender, EventArgs e) { TreeNode pn = this.Parent; if (pn.Nodes.Count > 1) { TreeViewWix tv = this.TreeView as TreeViewWix; Form f = null; if (this.TreeView != null) { f = this.TreeView.FindForm(); } if (MessageBox.Show(f, "Do you want to remove this culture from the setup?", "Remove Culture", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { WixCultureNode cn = this.CultureNode; TreeNodeWixCultureList tcl = pn as TreeNodeWixCultureList; if (tcl != null) { tcl.Cultures.CultureList.Remove(cn); } XmlNode wp = cn.XmlData.ParentNode; wp.RemoveChild(cn.XmlData); this.Remove(); if (tv != null) { tv.OnPropertyValueChanged(); } } } }
public TreeNodeWixCulture(WixCultureNode node, int imageIndex) : base(node) { if (imageIndex > 0) { ImageIndex = imageIndex; } else { ImageIndex = TreeViewWix.IMG_LANG; } SelectedImageIndex = ImageIndex; }
public void OnSelectTreeNode(TreeNode node) { ITreeNodeFolder folder = node as ITreeNodeFolder; if (folder != null) { folder.OnSelected(); checkedListBox1.Visible = true; propertyGrid1.Visible = false; checkedListBox1.Items.Clear(); IList <WixSourceFileNode> files = folder.Files; if (files != null && files.Count > 0) { SortedList <string, WixSourceFileNode> ss = new SortedList <string, WixSourceFileNode>(); foreach (WixSourceFileNode f in files) { ss.Add(f.ToString(), f); } IEnumerator <KeyValuePair <string, WixSourceFileNode> > ie = ss.GetEnumerator(); while (ie.MoveNext()) { int n = checkedListBox1.Items.Add(ie.Current.Value); checkedListBox1.SetItemChecked(n, !ie.Current.Value.IsRemoved); } } } else { TreeNodeWix mn = node as TreeNodeWix; if (mn != null) { object o; WixCultureNode c = mn.WixNode as WixCultureNode; if (c != null) { o = c.CultureNode; } else { o = mn.WixNode; } propertyGrid1.SelectedObject = o; propertyGrid1.Visible = true; checkedListBox1.Visible = false; } } }
private void mnu_addCulture(object sender, EventArgs e) { TreeViewWix tv = this.TreeView as TreeViewWix; if (tv != null) { WixCultureCollection cc = this.Cultures; StringCollection ss = new StringCollection(); foreach (WixCultureNode cn in cc.CultureList) { ss.Add(cn.CultureNode.Culture); } DlgLanguages dlg = new DlgLanguages(); dlg.SetUseSpecificCulture(); dlg.LoadData(ss); Form f = null; if (this.TreeView != null) { f = this.TreeView.FindForm(); } if (dlg.ShowDialog(f) == DialogResult.OK) { ss = dlg.SelectedLanguages; if (ss.Count > 0) { this.Expand(); bool added = false; ImageList imgs = null; if (this.TreeView != null) { imgs = this.TreeView.ImageList; } foreach (string s in ss) { if (!cc.CultureExists(s)) { int idx = -1; if (imgs != null) { Image img = VPLUtil.GetLanguageImageByName(s); if (img != null) { idx = imgs.Images.Add(img, Color.White); } } XmlNode xn = tv.createCultureXmlNode(s, false); WixCultureNode wcn = new WixCultureNode(xn); cc.CultureList.Add(wcn); TreeNodeWixCulture twc = new TreeNodeWixCulture(wcn, idx); this.Nodes.Add(twc); added = true; } } if (added) { tv.OnPropertyValueChanged(); } } } } }