void tn_SelectFile(object sender, EventArgs e) { WixSourceFileNode f = (WixSourceFileNode)sender; if (SelectFile != null) { SelectFile(f, EventArgs.Empty); } }
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e) { if (_externalPropertyGrid != null) { int n = checkedListBox1.SelectedIndex; if (n >= 0 && n < checkedListBox1.Items.Count) { WixSourceFileNode f = checkedListBox1.Items[n] as WixSourceFileNode; if (f != null) { _externalPropertyGrid.SelectedObject = f; } } } }
void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.Index >= 0) { WixSourceFileNode f = checkedListBox1.Items[e.Index] as WixSourceFileNode; if (f != null) { bool b = (e.NewValue != CheckState.Checked); if (f.IsRemoved != b) { f.IsRemoved = b; OnPropertyChanged(); } } } }
private void buttonOK_Click(object sender, EventArgs e) { int n = listBox1.SelectedIndex; if (n >= 0) { WixSourceFileNode f = listBox1.Items[n] as WixSourceFileNode; if (f != null) { Target = f.Filename; } else { Target = listBox1.Text; } this.DialogResult = System.Windows.Forms.DialogResult.OK; } }
public void mnu_addFiles(object sender, EventArgs e) { TreeViewWix tv = this.TreeView as TreeViewWix; Form f = null; if (this.TreeView != null) { f = this.TreeView.FindForm(); } OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; if (dlg.ShowDialog(f) == DialogResult.OK) { string[] ss = dlg.FileNames; if (ss != null && ss.Length > 0) { bool b = false; WixFolderNode app = Folder; for (int i = 0; i < ss.Length; i++) { WixSourceFileNode existFile = app.GetWixNodeByName(ss[i]); if (existFile == null) { existFile = app.AddFile(ss[i]); b = true; } if (SelectFile != null) { SelectFile(existFile, EventArgs.Empty); } } if (b && tv != null) { tv.OnPropertyValueChanged(); UserControlSetupProperties ucp = getHolder(); if (ucp != null) { ucp.OnSelectTreeNode(this); } } } } }
void treeView1_FilesRemoved(object sender, EventArgs e) { EventArgsFiles ef = (EventArgsFiles)e; for (int k = 0; k < ef.Files.Count; k++) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { WixSourceFileNode f = checkedListBox1.Items[i] as WixSourceFileNode; if (f != null) { if (string.Compare(ef.Files[k].Filename, f.Filename, StringComparison.OrdinalIgnoreCase) == 0) { checkedListBox1.Items.Remove(f); break; } } } } OnPropertyChanged(); }
public void mnu_addSourceFolder(object sender, EventArgs e) { TreeViewWix tv = this.TreeView as TreeViewWix; Form f = null; if (this.TreeView != null) { f = this.TreeView.FindForm(); } FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.Description = "All files in the selected folder will be included in the setup"; if (dlg.ShowDialog(f) == DialogResult.OK) { bool b = true; WixSourceFileNode fn = Folder.GetWixNodeByName(dlg.SelectedPath); if (fn != null) { MessageBox.Show(f, "Source folder is already included", "Add Source Folder", MessageBoxButtons.OK, MessageBoxIcon.Information); b = false; } else { fn = Folder.AddFile(dlg.SelectedPath); } if (SelectFile != null) { SelectFile(fn, EventArgs.Empty); } if (b && tv != null) { tv.OnPropertyValueChanged(); UserControlSetupProperties ucp = getHolder(); if (ucp != null) { ucp.OnSelectTreeNode(this); } } } }
void treeView1_SelectFile(object sender, EventArgs e) { WixSourceFileNode mf = (WixSourceFileNode)sender; if (mf != null) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { WixSourceFileNode f = checkedListBox1.Items[i] as WixSourceFileNode; if (f != null) { if (string.Compare(mf.Filename, f.Filename, StringComparison.OrdinalIgnoreCase) == 0) { checkedListBox1.SelectedIndex = i; return; } } } int n = checkedListBox1.Items.Add(mf); checkedListBox1.SetItemChecked(n, !mf.IsRemoved); checkedListBox1.SelectedIndex = n; } }