Esempio n. 1
0
        /// <summary>
        /// Merges the changes made to the wix document by overwriting the dialog element.
        /// </summary>
        void IWixDialogDesignerGenerator.MergeFormChanges(string dialogId, XmlElement dialogElement)
        {
            // Get the text region we are replacing.
            IDocument document = view.DesignerCodeFileDocument;
            DomRegion region   = WixDocument.GetElementRegion(new StringReader(document.TextContent), "Dialog", dialogId);

            if (region.IsEmpty)
            {
                throw new FormsDesignerLoadException(String.Format(StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}"), dialogId));
            }
            // Get the replacement dialog xml.
            TextEditorControl     textEditorControl = ((ITextEditorControlProvider)view.PrimaryViewContent).TextEditorControl;
            ITextEditorProperties properties        = textEditorControl.TextEditorProperties;
            string replacementXml = WixDocument.GetXml(dialogElement, properties.LineTerminator, properties.ConvertTabsToSpaces, properties.IndentationSize);

            // Replace the xml and select the inserted text.
            WixDocumentEditor editor = new WixDocumentEditor(textEditorControl.ActiveTextAreaControl);

            editor.Replace(region, replacementXml);
        }
        /// <summary>
        /// Gets the Wix xml for the specified element.
        /// </summary>
        string GetWixXml(XmlElement element)
        {
            ITextEditorProperties properties = SharpDevelopTextEditorProperties.Instance;

            return(WixDocument.GetXml(element, properties.LineTerminator, properties.ConvertTabsToSpaces, properties.IndentationSize));
        }