public TreeNodeWixShortcut(WixShortcut node)
     : base(node)
 {
     ImageIndex         = TreeViewWix.IMG_SHORTCUT;
     SelectedImageIndex = ImageIndex;
     node.IdChanged    += node_IdChanged;
 }
        private void mnu_addShortcut(object sender, EventArgs e)
        {
            this.Expand();
            WixShortcut         st = this.ShortcutNodes.AddShortcut();
            TreeNodeWixShortcut ts = new TreeNodeWixShortcut(st);

            Nodes.Add(ts);
            if (this.TreeView != null)
            {
                this.TreeView.SelectedNode = ts;
            }
            TreeViewWix tv = this.TreeView as TreeViewWix;

            if (tv != null)
            {
                tv.OnPropertyValueChanged();
            }
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             WixShortcut shortcut = context.Instance as WixShortcut;
             if (shortcut != null)
             {
                 DlgShortcutTarget dlg = new DlgShortcutTarget();
                 dlg.LoadData(shortcut.XmlData.OwnerDocument.DocumentElement);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     value = dlg.Target;
                 }
             }
         }
     }
     return(value);
 }
        private void mnu_removeShortcut(object sender, EventArgs e)
        {
            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 shortcut from the setup?", "Remove Shortcut", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                TreeNodeWixShortcutCollection ip = this.Parent as TreeNodeWixShortcutCollection;
                WixShortcut ico = ShortcutNode;
                XmlNode     p   = ico.XmlData.ParentNode;
                p.RemoveChild(ico.XmlData);
                ip.ShortcutNodes.Shortcuts.Remove(ico);
                this.Remove();
                if (tv != null)
                {
                    tv.OnPropertyValueChanged();
                }
            }
        }