Exemplo n.º 1
0
        public EditCustomTableDefinitionPanel(WixFiles wixFiles)
            : base(wixFiles, "/wix:Wix//wix:CustomTable", "Id")
        {
            LoadData();

            CurrentGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(CurrentGrid_PropertyValueChanged);
        }
Exemplo n.º 2
0
        protected TreeNode CreateNewSubElement(string typeName)
        {
            if (currTreeView.SelectedNode == null)
            {
                return(null);
            }

            XmlNode node = currTreeView.SelectedNode.Tag as XmlNode;

            if (node == null)
            {
                return(null);
            }

            WixFiles.UndoManager.BeginNewCommandRange();

            XmlElement newElement = node.OwnerDocument.CreateElement(typeName, WixFiles.GetNamespaceUri(typeName));
            TreeNode   control    = new TreeNode(typeName);

            control.Tag = newElement;

            int imageIndex = ImageListFactory.GetImageIndex(typeName);

            if (imageIndex >= 0)
            {
                control.ImageIndex         = imageIndex;
                control.SelectedImageIndex = imageIndex;
            }

            InsertNewXmlNode(node, newElement);

            currTreeView.SelectedNode.Nodes.Add(control);

            return(control);
        }
Exemplo n.º 3
0
        public SelectionOverlay(Control control, XmlNode xmlNode, WixFiles wixFiles)
        {
            this.control  = control;
            this.xmlNode  = xmlNode;
            this.wixFiles = wixFiles;

            ClientSize = new Size(control.Size.Width, control.Size.Height);
            Left       = control.Left;
            Top        = control.Top;

            control.Left = 0;
            control.Top  = 0;

            control.MouseMove += new MouseEventHandler(OnMouseMoveControl);
            control.MouseDown += new MouseEventHandler(OnMouseDownControl);
            control.MouseUp   += new MouseEventHandler(OnMouseUpControl);
            control.KeyDown   += new KeyEventHandler(OnKeyDownControl);

            Controls.Add(control);

            Cursor = Cursors.SizeAll;

            OnLosesSelection += new EventHandler(onLostSelection);

            SetStyle(ControlStyles.Opaque, false); // optional
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            BackColor = Color.FromArgb(0, 0, 0, 0);
        }
Exemplo n.º 4
0
 public BinaryElementAdapter(XmlNodeList binaryNodes, WixFiles wixFiles) : base(wixFiles)
 {
     foreach (object o in binaryNodes)
     {
         this.binaryNodes.Add(o);
     }
 }
Exemplo n.º 5
0
        public ProductPropertiesForm(XmlNode productNode, WixFiles wixFiles)
        {
            this.productNode = productNode;
            this.wixFiles    = wixFiles;

            InitializeComponent();
        }
Exemplo n.º 6
0
 public UITextElementAdapter(XmlNodeList uiTextNodes, WixFiles wixFiles) : base(wixFiles)
 {
     foreach (object o in uiTextNodes)
     {
         this.uiTextNodes.Add(o);
     }
 }
Exemplo n.º 7
0
        public void DrawSelection(Control ctrl, Graphics formGraphics)
        {
            int   size           = 6;
            Brush horBorderBrush = new TextureBrush(new Bitmap(WixFiles.GetResourceStream("hcontrolborder.bmp")));
            Brush verBorderBrush = new TextureBrush(new Bitmap(WixFiles.GetResourceStream("vcontrolborder.bmp")));

            Rectangle topBorder    = new Rectangle(ctrl.Left, ctrl.Top - size - 1, ctrl.Width, size + 1);
            Rectangle bottomBorder = new Rectangle(ctrl.Left, ctrl.Bottom, ctrl.Width, size + 1);

            formGraphics.FillRectangles(horBorderBrush, new Rectangle[] { topBorder, bottomBorder });

            Rectangle rightBorder = new Rectangle(ctrl.Right, ctrl.Top, size + 1, ctrl.Height);
            Rectangle leftBorder  = new Rectangle(ctrl.Left - size - 1, ctrl.Top, size + 1, ctrl.Height);

            formGraphics.FillRectangles(verBorderBrush, new Rectangle[] { rightBorder, leftBorder });


            Rectangle leftTop  = new Rectangle(ctrl.Left - size - 1, ctrl.Top - size - 1, size, size);
            Rectangle rightTop = new Rectangle(ctrl.Right, ctrl.Top - size - 1, size, size);

            Rectangle leftBottom  = new Rectangle(ctrl.Left - size - 1, ctrl.Bottom, size, size);
            Rectangle rightBottom = new Rectangle(ctrl.Right, ctrl.Bottom, size, size);

            Rectangle leftMid  = new Rectangle(ctrl.Left - size - 1, ctrl.Top + (ctrl.Height - size) / 2, size, size);
            Rectangle rightMid = new Rectangle(ctrl.Right, ctrl.Top + (ctrl.Height - size) / 2, size, size);

            Rectangle midBottom = new Rectangle(ctrl.Left + (ctrl.Width - size) / 2, ctrl.Bottom, size, size);
            Rectangle midTop    = new Rectangle(ctrl.Left + (ctrl.Width - size) / 2, ctrl.Top - size - 1, size, size);


            formGraphics.FillRectangles(Brushes.White, new Rectangle[] { leftTop, rightTop, leftBottom, rightBottom, leftMid, rightMid, midBottom, midTop });
            formGraphics.DrawRectangles(Pens.Black, new Rectangle[] { leftTop, rightTop, leftBottom, rightBottom, leftMid, rightMid, midBottom, midTop });
        }
Exemplo n.º 8
0
 public ErrorElementAdapter(XmlNodeList errorNodes, WixFiles wixFiles) : base(wixFiles)
 {
     foreach (object o in errorNodes)
     {
         this.errorNodes.Add(o);
     }
 }
Exemplo n.º 9
0
        public virtual void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
        {
            if (CurrentGrid.SelectedObject == null)
            {
                return;
            }

            MenuItem menuItemSeparator = new IconMenuItem("-");
            MenuItem menuItem1         = new IconMenuItem("Add &New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            MenuItem menuItem3         = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
            MenuItem menuItem4         = new IconMenuItem("&Rename");
            MenuItem menuItem5         = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));

            menuItem1.Click += new EventHandler(OnNewPropertyGridItem);
            menuItem3.Click += new EventHandler(OnDeletePropertyGridItem);
            menuItem4.Click += new EventHandler(OnRenamePropertyGridItem);
            menuItem5.Click += new EventHandler(OnImportPropertyGridItem);

            CurrentGridContextMenu.MenuItems.Clear();
            CurrentGridContextMenu.MenuItems.Add(menuItem1);
            if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null)
            {
                CurrentGridContextMenu.MenuItems.Add(menuItem3);
                CurrentGridContextMenu.MenuItems.Add(menuItem4);
            }

            CurrentGridContextMenu.MenuItems.Add(menuItem5);
        }
Exemplo n.º 10
0
 public PropertyElementAdapter(XmlNodeList propertyNodes, WixFiles wixFiles) : base(wixFiles)
 {
     foreach (object o in propertyNodes)
     {
         this.propertyNodes.Add(o);
     }
 }
Exemplo n.º 11
0
 public DesignerForm(WixFiles wixFiles, XmlNode dialog)
 {
     dialogElement    = dialog;
     controlMap       = new Hashtable();
     this.wixFiles    = wixFiles;
     this.MouseClick += new MouseEventHandler(DesignerForm_MouseClick);
 }
Exemplo n.º 12
0
        public ElementEditForm(XmlNode elementNode, WixFiles wixFiles)
        {
            this.elementNode = elementNode;
            this.wixFiles    = wixFiles;

            InitializeComponent();
        }
Exemplo n.º 13
0
        public DisplayBasePanel(WixFiles wixFiles)
            : base(wixFiles)
        {
            Reload += new ReloadHandler(ReloadData);

            CreateControl();
        }
Exemplo n.º 14
0
        public EditGlobalDataPanel(WixFiles wixFiles, VoidVoidDelegate reloadAll)
            : base(wixFiles, "/wix:Wix/*", "Id")
        {
            reloadAllPanels = reloadAll;

            LoadData();
        }
Exemplo n.º 15
0
        public void Run(ProcessStartInfo processStartInfo, WixFiles theWixFiles, OnCompleteDelegate onComplete)
        {
            if (IsBusy)
            {
                throw new WixEditException("OutputPanel is already busy.");
            }

            wixFiles          = theWixFiles;
            onCompletedOutput = onComplete;

            invokeClearRTF    = new DelegateClearRtf(ClearRtf);
            invokeOutput      = new DelegateOutput(Output);
            invokeOutputLine  = new DelegateOutputLine(OutputLine);
            invokeOutputStart = new DelegateOutputStart(OutputStart);
            invokeOutputDone  = new DelegateOutputDone(OutputDone);
            invokeProcessDone = new DelegateProcessDone(ProcessDone);

            isCancelled = false;

            buildMenu.MenuItems.Add(cancelMenuItem);
            outputTextBox.Cursor = Cursors.WaitCursor;

            currentProcessStartInfo = processStartInfo;

            currentProcessThread = new Thread(new ThreadStart(InternalThreadRunSingle));
            currentProcessThread.Start();
        }
Exemplo n.º 16
0
        public WizardForm(WixFiles editWixFiles)
        {
            wixFiles        = editWixFiles;
            undoCountBefore = wixFiles.UndoManager.UndoCount;

            InitializeComponent();

            string welcomeMessage = "The WixEdit wizard helps you to create or edit MSI files. The wizard allows you to easily add files and functionality to your MSI file.\r\n\r\nFor example:\r\nAdd files, Create shortcuts, Create virual directories, etc.\r\n\r\n\r\nClick \"Next\" to continue or \"Cancel\" to exit the WixEdit wizard.";

            if (!editWixFiles.IsNew)
            {
                welcomeMessage += "\r\n\r\nNote: Existing complex installers may give problems with the wizard.";
            }

            IntroductionSheet welcome = new IntroductionSheet("WixEdit wizard", welcomeMessage, this);

            AddSheet(welcome);

            FileSheet files = new FileSheet(this);

            AddSheet(files);

            SelectTemplatesSheet selectTemplates = new SelectTemplatesSheet(this);

            AddSheet(selectTemplates);

            endSheet      = new FinishSheet(this);
            endSheet.Dock = DockStyle.Fill;
            contentPanel.Controls.Add(endSheet);
            endSheet.Visible = false;
        }
Exemplo n.º 17
0
        public DialogGenerator(WixFiles wixFiles, Control parent)
        {
            this.definedFonts = new Hashtable();
            this.wixFiles     = wixFiles;
            this.parent       = parent;

            ReadFonts();
        }
Exemplo n.º 18
0
        public DisplayTreeBasePanel(WixFiles wixFiles, string xpath, string keyName, bool fullExpandTreeAtStart)
            : base(wixFiles, xpath, keyName)
        {
            InitializeComponent();
            CreateControl();

            _fullExpandTreeAtStart = fullExpandTreeAtStart;
        }
Exemplo n.º 19
0
        public DisplaySimpleBasePanel(WixFiles wixFiles, string xpath, string elementName, string keyName)
            : base(wixFiles, xpath, elementName, keyName)
        {
            Reload += new ReloadHandler(ReloadData);

            InitializeComponent();
            CreateControl();
        }
Exemplo n.º 20
0
        public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
        {
            base.OnPropertyGridPopupContextMenu(sender, e);
            MenuItem menuItem2 = new IconMenuItem("Add &File", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));

            menuItem2.Click += new EventHandler(OnAddFilePropertyGridItem);
            CurrentGridContextMenu.MenuItems.Add(1, menuItem2);
        }
        public PropertySearchElementPropertyDescriptor(WixFiles wixFiles, XmlNode propertyElement, string name, Attribute[] attrs) :
            base(wixFiles, propertyElement, name, attrs)
        {
            XmlNodeList subNodes = propertyElement.SelectNodes("*", wixFiles.WxsNsmgr);

            searchElements = subNodes;
            searchElement  = subNodes[0];
        }
Exemplo n.º 22
0
        private static ImageList CreateImageList(StringCollection types)
        {
            ImageList images = new ImageList();

            Bitmap unknownBmp = new Bitmap(WixFiles.GetResourceStream("elements.unknown.bmp"));

            unknownBmp.MakeTransparent();

            Bitmap typeBmp;

            foreach (string type in types)
            {
                try
                {
                    typeBmp = null;

                    if (type.StartsWith("deprecated"))
                    {
                        if (WixFiles.HasResource(String.Format("elements.{0}.bmp", type.Remove(0, 11).ToLower())))
                        {
                            typeBmp = new Bitmap(WixFiles.GetResourceStream(String.Format("elements.{0}.bmp", type.Remove(0, 11).ToLower())));
                            Bitmap tmpBmp = OverlayWarning(typeBmp);
                            typeBmp.Dispose();
                            typeBmp = tmpBmp;
                        }
                    }
                    else
                    {
                        if (WixFiles.HasResource(String.Format("elements.{0}.bmp", type.ToLower())))
                        {
                            typeBmp = new Bitmap(WixFiles.GetResourceStream(String.Format("elements.{0}.bmp", type.ToLower())));
                        }
                    }
                    if (typeBmp != null)
                    {
                        typeBmp.MakeTransparent();
                    }
                    else
                    {
                        typeBmp = unknownBmp;
                    }
                }
                catch
                {
                    typeBmp = unknownBmp;
                }

                images.Images.Add(typeBmp);
            }

            Bitmap unsupportedBmp = new Bitmap(WixFiles.GetResourceStream("elements.unsupported.bmp"));

            unsupportedBmp.MakeTransparent();

            images.Images.Add(unsupportedBmp);

            return(images);
        }
Exemplo n.º 23
0
        public BasePanel(WixFiles wixFiles)
        {
            if (wixFiles == null)
            {
                throw new ArgumentException("Cannot construct base panel without wixFiles", "wixFiles");
            }

            this.wixFiles = wixFiles;
        }
Exemplo n.º 24
0
        public static string GetShortFileName(FileInfo fileInfo, WixFiles wixFiles, XmlNode componentElement)
        {
            string ShortName = "ShortName";

            if (WixEditSettings.Instance.IsUsingWix2())
            {
                ShortName = "Name";
            }

            string nameStart = Path.GetFileNameWithoutExtension(fileInfo.Name).ToUpper().Replace(" ", "");
            int    tooShort  = 0;

            if (nameStart.Length > 7)
            {
                nameStart = nameStart.Substring(0, 7);
            }
            else
            {
                tooShort = 7 - nameStart.Length;
            }

            string nameExtension = fileInfo.Extension.ToUpper();

            if (nameExtension.Length > 4)
            {
                nameExtension = nameExtension.Substring(0, 4);
            }

            int    i             = 0;
            string shortFileName = String.Format("{0}{1}", nameStart, nameExtension);

            while (componentElement.SelectSingleNode(String.Format("wix:File[@{0}={1}]", ShortName, XPathHelper.EscapeXPathInputString(shortFileName)), wixFiles.WxsNsmgr) != null)
            {
                if (i % 10 == 0 && Math.Log10(i) % 1 == 0.00)
                {
                    if (tooShort > 0)
                    {
                        tooShort--;
                    }
                    else
                    {
                        if (nameStart.Length <= 1)
                        {
                            throw new WixEditException("Cannot determine unique short name for " + fileInfo.Name);
                        }
                        nameStart = nameStart.Substring(0, nameStart.Length - 1);
                    }
                }

                shortFileName = String.Format("{0}{1}{2}", nameStart, i, nameExtension);

                i++;
            }

            return(shortFileName);
        }
Exemplo n.º 25
0
        public EditFilesPanel(WixFiles wixFiles)
            : base(wixFiles, "/wix:Wix/*/wix:Directory|/wix:Wix/*/wix:DirectoryRef", "Id", false)
        {
            LoadData();

            CurrentTreeView.DragEnter += new DragEventHandler(treeView_DragEnter);
            CurrentTreeView.DragLeave += new EventHandler(treeView_DragLeave);
            CurrentTreeView.DragOver  += new DragEventHandler(treeView_DragOver);
            CurrentTreeView.DragDrop  += new DragEventHandler(treeView_DragDrop);
            CurrentTreeView.AllowDrop  = true;
        }
Exemplo n.º 26
0
        protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e)
        {
            // clear menu and add import menu
            base.PopupPanelContextMenu(sender, e);

            // add custom menu, index has to be used!!!
            IconMenuItem subMenuItem = new IconMenuItem("New Feature", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));

            subMenuItem.Click += new EventHandler(NewCustomElement_Click);
            PanelContextMenu.MenuItems.Add(0, subMenuItem);
        }
Exemplo n.º 27
0
        private static StringCollection GetTypes()
        {
            StringCollection types = new StringCollection();

            ArrayList xmlElements = WixFiles.GetXsdAllElementNames();

            foreach (XmlNode xmlElement in xmlElements)
            {
                XmlAttribute nameAtt = xmlElement.Attributes["name"];
                if (nameAtt != null)
                {
                    if (nameAtt.Value != null && nameAtt.Value.Length > 0)
                    {
                        XmlNode deprecated = xmlElement.SelectSingleNode("xs:annotation/xs:appinfo/xse:deprecated", WixFiles.GetXsdNsmgr());
                        if (deprecated != null)
                        {
                            if (types.Contains("deprecated_" + nameAtt.Value) == false)
                            {
                                types.Add("deprecated_" + nameAtt.Value);
                            }
                        }
                        else if (types.Contains(nameAtt.Value) == false)
                        {
                            types.Add(nameAtt.Value);
                        }
                    }
                }
            }

            types.AddRange(new string[] { "Billboard",
                                          "Bitmap",
                                          "CheckBox",
                                          "ComboBox",
                                          "DirectoryCombo",
                                          "DirectoryList",
                                          "Edit",
                                          "GroupBox",
                                          "Icon",
                                          "Line",
                                          "ListBox",
                                          "ListView",
                                          "MaskedEdit",
                                          "PathEdit",
                                          "ProgressBar",
                                          "PushButton",
                                          "RadioButtonGroup",
                                          "ScrollableText",
                                          "SelectionTree",
                                          "Text",
                                          "VolumeCostList",
                                          "VolumeSelectCombo" });

            return(types);
        }
Exemplo n.º 28
0
 protected static string GetValueAttributeName(WixFiles wixFiles)
 {
     if (wixFiles.XsdDocument.SelectSingleNode("/xs:schema/xs:element[@name='Property']/xs:complexType/xs:attribute[@name='Value']", wixFiles.XsdNsmgr) != null)
     {
         return("Value");
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 29
0
        public DisplaySimpleBasePanel(WixFiles wixFiles, string xpath, string elementName, string keyName, string valueName)
            : base(wixFiles, xpath, elementName, keyName)
        {
            // when valueName is null, the inner text is used.

            Reload += new ReloadHandler(ReloadData);

            currentValueName = valueName;

            InitializeComponent();
            CreateControl();
        }
Exemplo n.º 30
0
        protected static string GetValueAttributeName(WixFiles wixFiles)
        {
            if (wixFiles.XsdDocument.SelectSingleNode("/xs:schema/xs:element[@name='Icon']/xs:complexType/xs:attribute[@name='SourceFile']", wixFiles.XsdNsmgr) != null)
            {
                return("SourceFile");
            }
            else if (wixFiles.XsdDocument.SelectSingleNode("/xs:schema/xs:element[@name='Icon']/xs:complexType/xs:attribute[@name='src']", wixFiles.XsdNsmgr) != null)
            {
                return("src");
            }

            throw new ApplicationException("WiX xsd should define src or SourceFile attribute on Icon element");
        }