private void toolStripMenuItem3_Click(object sender, EventArgs e) { IsWiXShortCut shortcut = tvDestination.SelectedNode.Tag as IsWiXShortCut; shortcut.Delete(); tvDestination.SelectedNode.Remove(); tvDestination.SelectedNode = tvDestination.Nodes[0]; }
private void UpdatedSelectedNodeText() { IsWiXShortCut shortcut = tvDestination.SelectedNode.Tag as IsWiXShortCut; if (shortcut != null) { tvDestination.SelectedNode.Text = CalculateSelectedNodeText(shortcut); } }
public void Read(IsWiXShortCut shortcut) { _shortcut = shortcut; Name = _shortcut.Name; Description = _shortcut.Description; Show = _shortcut.Show; WorkingDirectory = _shortcut.WorkingDirectory; Arguments = _shortcut.Arguments; }
private void AddShortcutNode(IsWiXShortCut iswixShortcut) { var subTreeNode = tvDestination.SelectedNode.Nodes.Add(string.Format("{0} ({1})", iswixShortcut.Name, iswixShortcut.DestinationFilePath)); subTreeNode.ImageIndex = (int)ImageLibrary.Shortcut; subTreeNode.SelectedImageIndex = (int)ImageLibrary.Shortcut; subTreeNode.Tag = iswixShortcut; tvDestination.ExpandAll(); var parentNode = tvDestination.Nodes[0]; tvDestination.SelectedNode = subTreeNode; tvDestination.Select(); UpdatedSelectedNodeText(); }
private void CreateShortCut() { ComponentPicker picker = new ComponentPicker(_shortcuts); picker.StartPosition = FormStartPosition.CenterParent; DialogResult dr = picker.ShowDialog(); if (dr != DialogResult.Cancel) { string fileKey = picker.FileKey; if (!string.IsNullOrEmpty(fileKey)) { string scDirectory = tvDestination.SelectedNode.Tag as string; string prefix = "NewShortcut"; int index = 0; bool added = false; do { index++; bool exists = false; if (_shortcuts != null) { foreach (var shortcut in _shortcuts) { string name = string.Format("{0}{1}", prefix, index); if (shortcut.Directory.Equals(scDirectory, StringComparison.InvariantCultureIgnoreCase) && shortcut.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { exists = true; break; } } } if (exists == false) { IsWiXShortCut shortCut = _shortcuts.Create(string.Format("{0}{1}", prefix, index), fileKey, scDirectory); AddShortcutNode(shortCut); added = true; } }while (added == false); } } }
private string CalculateSelectedNodeText(IsWiXShortCut shortcut) { return(string.Format("{0} ({1})", shortcut.Name, shortcut.DestinationFilePath)); }