예제 #1
0
        private void newComponentMenuItem_Click(object sender, EventArgs e)
        {
            XmlElement selectedNode = tree.SelectedNode.Tag as XmlElement;

            if (selectedNode == null)
            {
                return;
            }

            EnterStringForm frm = new EnterStringForm();

            frm.Text = "Enter component id";
            if (DialogResult.OK == frm.ShowDialog())
            {
                XmlElement newProp = Wizard.WixFiles.WxsDocument.CreateElement("Component", WixFiles.WixNamespaceUri);

                newProp.SetAttribute("Id", frm.SelectedString);
                newProp.SetAttribute("DiskId", "1");
                newProp.SetAttribute("KeyPath", "yes");
                newProp.SetAttribute("Guid", Guid.NewGuid().ToString("D"));

                selectedNode.AppendChild(newProp);
                TreeNode newNode = new TreeNode();
                newNode.Text               = frm.SelectedString;
                newNode.ImageIndex         = ImageListFactory.GetImageIndex("Component");
                newNode.SelectedImageIndex = newNode.ImageIndex;
                newNode.Tag = newProp;
                newNode.EnsureVisible();

                tree.SelectedNode.Nodes.Add(newNode);
                tree.SelectedNode.Expand();
            }
        }
예제 #2
0
        public virtual void OnNewPropertyGridItem(object sender, EventArgs e)
        {
            if (CurrentParent == null)
            {
                MessageBox.Show(String.Format("No location found to add \"{0}\" element, need element like module or product!", CurrentElementName));
                return;
            }

            EnterStringForm frm = new EnterStringForm();

            frm.Text = "Enter Resource Name";
            if (DialogResult.OK == frm.ShowDialog())
            {
                WixFiles.UndoManager.BeginNewCommandRange();
                XmlElement newProp = WixFiles.WxsDocument.CreateElement(CurrentElementName, WixFiles.WixNamespaceUri);

                XmlAttribute newAttr = WixFiles.WxsDocument.CreateAttribute(CurrentKeyName);
                newAttr.Value = frm.SelectedString;
                newProp.Attributes.Append(newAttr);

                if (currentValueName != null)
                {
                    newAttr = WixFiles.WxsDocument.CreateAttribute(currentValueName);
                    newProp.Attributes.Append(newAttr);
                }

                InsertNewXmlNode(CurrentParent, newProp);

                RefreshGrid(frm.SelectedString);
            }
        }
예제 #3
0
        /// <summary>show the form for the multi line text</summary>
        /// <param name="value">the value prior to editing</param>
        /// <returns>the string after editing</returns>
        public string EditValue(string value)
        {
            EnterStringForm dialog = new EnterStringForm();

            dialog.MultiLine      = true;
            dialog.SelectedString = value;
            dialog.ShowDialog();

            return(dialog.SelectedString);
        }
예제 #4
0
        public virtual void OnRenamePropertyGridItem(object sender, EventArgs e)
        {
            XmlNode element = GetSelectedGridObject();

            if (element != null)
            {
                XmlAttribute    att = element.Attributes[CurrentKeyName];
                EnterStringForm frm = new EnterStringForm(att.Value);
                frm.Text = "Enter Name";
                if (DialogResult.OK == frm.ShowDialog())
                {
                    WixFiles.UndoManager.BeginNewCommandRange();
                    att.Value = frm.SelectedString;
                    RefreshGrid();

                    ShowNode(att);
                }
            }
        }
예제 #5
0
        private void NewFolder()
        {
            EnterStringForm frm = new EnterStringForm();

            frm.Text = "Enter Directory Name";
            if (DialogResult.OK == frm.ShowDialog())
            {
                XmlNode    node         = tree.SelectedNode.Tag as XmlNode;
                XmlElement newDirectory = node.OwnerDocument.CreateElement("Directory", WixFiles.WixNamespaceUri);
                newDirectory.SetAttribute("Name", frm.SelectedString);
                newDirectory.SetAttribute("Id", FileImport.GenerateValidIdentifier(frm.SelectedString, newDirectory, Wizard.WixFiles));
                node.AppendChild(newDirectory);

                TreeNode treeNode = new TreeNode();
                treeNode.Text               = frm.SelectedString;
                treeNode.ImageIndex         = ImageListFactory.GetImageIndex("Directory");
                treeNode.SelectedImageIndex = treeNode.ImageIndex;
                treeNode.SelectedImageIndex = treeNode.ImageIndex;
                treeNode.Tag = newDirectory;
                tree.SelectedNode.Nodes.Add(treeNode);
                tree.SelectedNode.Expand();
                treeNode.EnsureVisible();
            }
        }