From 4fc9d3d8605ee092fbe83c12b74a00b2e4753ce8 Mon Sep 17 00:00:00 2001 From: Neal Callaghan Date: Tue, 12 May 2020 13:25:55 +0100 Subject: [PATCH 1/3] suggested changes to the dialogs after a code anaylsis tool sonarqube scan --- .../WixSharp.UI/ManagedUI/Forms/ExitDialog.cs | 8 +- .../ManagedUI/Forms/FeaturesDialog.cs | 13 +- .../Forms/InstallDirDialog.Designer.cs | 479 +++++++++--------- .../ManagedUI/Forms/InstallDirDialog.cs | 5 - .../ManagedUI/Forms/LicenceDialog.cs | 15 +- .../ManagedUI/Forms/MaintenanceTypeDialog.cs | 6 +- .../ManagedUI/Forms/ProgressDialog.cs | 74 +-- .../ManagedUI/Forms/SetupTypeDialog.cs | 5 +- .../ManagedUI/Forms/WelcomeDialog.cs | 4 +- 9 files changed, 291 insertions(+), 318 deletions(-) diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/ExitDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/ExitDialog.cs index fa081b2e..78790461 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/ExitDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/ExitDialog.cs @@ -1,7 +1,5 @@ -using System; using System.Diagnostics; using System.IO; -using System.Linq; using System.Windows.Forms; namespace WixSharp.UI.Forms @@ -82,7 +80,11 @@ void viewLog_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) System.IO.File.WriteAllText(logFile, Shell.Log); Process.Start(logFile); } - catch { } + catch + { + //Catch all, we don't want the installer to crash in an + //attempt to view the log. + } } } } \ No newline at end of file diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs index e093e8c6..561a6133 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Windows.Forms; @@ -11,7 +9,7 @@ namespace WixSharp.UI.Forms /// different user experience as it has checkboxes bound to the features instead of icons context menu /// as MSI dialog has. /// - public partial class FeaturesDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer + public partial class FeaturesDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer { /*https://msdn.microsoft.com/en-us/library/aa367536(v=vs.85).aspx * ADDLOCAL - list of features to install @@ -33,7 +31,6 @@ public FeaturesDialog() void FeaturesDialog_Load(object sender, System.EventArgs e) { - //Debug.Assert(false); string drawTextOnlyProp = Runtime.Session.Property("WixSharpUI_TreeNode_TexOnlyDrawing"); bool drawTextOnly = true; @@ -45,11 +42,9 @@ void FeaturesDialog_Load(object sender, System.EventArgs e) } else { - float dpi = this.CreateGraphics().DpiY; + float dpi = CreateGraphics().DpiY; if (dpi == 96) // the checkbox custom drawing is only compatible with 96 DPI drawTextOnly = false; - else - drawTextOnly = true; } ReadOnlyTreeNode.Behavior.AttachTo(featuresTree, drawTextOnly); @@ -88,12 +83,12 @@ void ResetLayout() /// /// The collection of the features selected by user as the features to be installed. /// - public static List UserSelectedItems; + public static List UserSelectedItems { get; private set; } /// /// The initial/default set of selected items (features) before user made any selection(s). /// - public static List InitialUserSelectedItems; + public static List InitialUserSelectedItems { get; private set; } void BuildFeaturesHierarchy() { diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.Designer.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.Designer.cs index f61c44a0..fce59057 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.Designer.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.Designer.cs @@ -28,246 +28,245 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.middlePanel = new System.Windows.Forms.Panel(); - this.change = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); - this.installDir = new System.Windows.Forms.TextBox(); - this.topBorder = new System.Windows.Forms.Panel(); - this.topPanel = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.banner = new System.Windows.Forms.PictureBox(); - this.bottomPanel = new System.Windows.Forms.Panel(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.back = new System.Windows.Forms.Button(); - this.next = new System.Windows.Forms.Button(); - this.cancel = new System.Windows.Forms.Button(); - this.border1 = new System.Windows.Forms.Panel(); - this.contextMenuStrip1.SuspendLayout(); - this.middlePanel.SuspendLayout(); - this.topPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.banner)).BeginInit(); - this.bottomPanel.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.copyToolStripMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(103, 26); - // - // copyToolStripMenuItem - // - this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; - this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22); - this.copyToolStripMenuItem.Text = "Copy"; - // - // middlePanel - // - this.middlePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.middlePanel.Controls.Add(this.change); - this.middlePanel.Controls.Add(this.label3); - this.middlePanel.Controls.Add(this.installDir); - this.middlePanel.Location = new System.Drawing.Point(22, 75); - this.middlePanel.Name = "middlePanel"; - this.middlePanel.Size = new System.Drawing.Size(449, 139); - this.middlePanel.TabIndex = 16; - // - // change - // - this.change.AutoSize = true; - this.change.Location = new System.Drawing.Point(3, 88); - this.change.Name = "change"; - this.change.Size = new System.Drawing.Size(119, 23); - this.change.TabIndex = 12; - this.change.Text = "[InstallDirDlgChange]"; - this.change.UseVisualStyleBackColor = true; - this.change.Click += new System.EventHandler(this.change_Click); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Location = new System.Drawing.Point(0, 3); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(124, 13); - this.label3.TabIndex = 11; - this.label3.Text = "[InstallDirDlgFolderLabel]"; - // - // installDir - // - this.installDir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.installDir.Location = new System.Drawing.Point(3, 56); - this.installDir.Name = "installDir"; - this.installDir.Size = new System.Drawing.Size(443, 20); - this.installDir.TabIndex = 13; - // - // topBorder - // - this.topBorder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.topBorder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.topBorder.Location = new System.Drawing.Point(0, 58); - this.topBorder.Name = "topBorder"; - this.topBorder.Size = new System.Drawing.Size(494, 1); - this.topBorder.TabIndex = 15; - // - // topPanel - // - this.topPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.topPanel.BackColor = System.Drawing.SystemColors.Control; - this.topPanel.Controls.Add(this.label2); - this.topPanel.Controls.Add(this.label1); - this.topPanel.Controls.Add(this.banner); - this.topPanel.Location = new System.Drawing.Point(0, 0); - this.topPanel.Name = "topPanel"; - this.topPanel.Size = new System.Drawing.Size(494, 58); - this.topPanel.TabIndex = 10; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Location = new System.Drawing.Point(18, 31); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(122, 13); - this.label2.TabIndex = 1; - this.label2.Text = "[InstallDirDlgDescription]"; - this.label2.Click += new System.EventHandler(this.label2_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(11, 8); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(109, 13); - this.label1.TabIndex = 1; - this.label1.Text = "[InstallDirDlgTitle]"; - // - // banner - // - this.banner.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.banner.BackColor = System.Drawing.Color.White; - this.banner.Location = new System.Drawing.Point(0, 0); - this.banner.Name = "banner"; - this.banner.Size = new System.Drawing.Size(494, 58); - this.banner.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.banner.TabIndex = 0; - this.banner.TabStop = false; - // - // bottomPanel - // - this.bottomPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.bottomPanel.BackColor = System.Drawing.SystemColors.Control; - this.bottomPanel.Controls.Add(this.tableLayoutPanel1); - this.bottomPanel.Controls.Add(this.border1); - this.bottomPanel.Location = new System.Drawing.Point(0, 312); - this.bottomPanel.Name = "bottomPanel"; - this.bottomPanel.Size = new System.Drawing.Size(494, 49); - this.bottomPanel.TabIndex = 9; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 5; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 14F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.back, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.next, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.cancel, 4, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 5); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(493, 43); - this.tableLayoutPanel1.TabIndex = 8; - // - // back - // - this.back.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.back.AutoSize = true; - this.back.Location = new System.Drawing.Point(224, 10); - this.back.MinimumSize = new System.Drawing.Size(75, 0); - this.back.Name = "back"; - this.back.Size = new System.Drawing.Size(77, 23); - this.back.TabIndex = 0; - this.back.Text = "[WixUIBack]"; - this.back.UseVisualStyleBackColor = true; - this.back.Click += new System.EventHandler(this.back_Click); - // - // next - // - this.next.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.next.AutoSize = true; - this.next.Location = new System.Drawing.Point(307, 10); - this.next.MinimumSize = new System.Drawing.Size(75, 0); - this.next.Name = "next"; - this.next.Size = new System.Drawing.Size(77, 23); - this.next.TabIndex = 0; - this.next.Text = "[WixUINext]"; - this.next.UseVisualStyleBackColor = true; - this.next.Click += new System.EventHandler(this.next_Click); - // - // cancel - // - this.cancel.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.cancel.AutoSize = true; - this.cancel.Location = new System.Drawing.Point(404, 10); - this.cancel.MinimumSize = new System.Drawing.Size(75, 0); - this.cancel.Name = "cancel"; - this.cancel.Size = new System.Drawing.Size(86, 23); - this.cancel.TabIndex = 0; - this.cancel.Text = "[WixUICancel]"; - this.cancel.UseVisualStyleBackColor = true; - this.cancel.Click += new System.EventHandler(this.cancel_Click); - // - // border1 - // - this.border1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.border1.Dock = System.Windows.Forms.DockStyle.Top; - this.border1.Location = new System.Drawing.Point(0, 0); - this.border1.Name = "border1"; - this.border1.Size = new System.Drawing.Size(494, 1); - this.border1.TabIndex = 14; - // - // InstallDirDialog - // - this.ClientSize = new System.Drawing.Size(494, 361); - this.Controls.Add(this.middlePanel); - this.Controls.Add(this.topBorder); - this.Controls.Add(this.topPanel); - this.Controls.Add(this.bottomPanel); - this.Name = "InstallDirDialog"; - this.Text = "[InstallDirDlg_Title]"; - this.Load += new System.EventHandler(this.InstallDirDialog_Load); - this.contextMenuStrip1.ResumeLayout(false); - this.middlePanel.ResumeLayout(false); - this.middlePanel.PerformLayout(); - this.topPanel.ResumeLayout(false); - this.topPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.banner)).EndInit(); - this.bottomPanel.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - + this.components = new System.ComponentModel.Container(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.middlePanel = new System.Windows.Forms.Panel(); + this.change = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.installDir = new System.Windows.Forms.TextBox(); + this.topBorder = new System.Windows.Forms.Panel(); + this.topPanel = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.banner = new System.Windows.Forms.PictureBox(); + this.bottomPanel = new System.Windows.Forms.Panel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.back = new System.Windows.Forms.Button(); + this.next = new System.Windows.Forms.Button(); + this.cancel = new System.Windows.Forms.Button(); + this.border1 = new System.Windows.Forms.Panel(); + this.contextMenuStrip1.SuspendLayout(); + this.middlePanel.SuspendLayout(); + this.topPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.banner)).BeginInit(); + this.bottomPanel.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyToolStripMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(103, 26); + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22); + this.copyToolStripMenuItem.Text = "Copy"; + // + // middlePanel + // + this.middlePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.middlePanel.Controls.Add(this.change); + this.middlePanel.Controls.Add(this.label3); + this.middlePanel.Controls.Add(this.installDir); + this.middlePanel.Location = new System.Drawing.Point(22, 75); + this.middlePanel.Name = "middlePanel"; + this.middlePanel.Size = new System.Drawing.Size(449, 139); + this.middlePanel.TabIndex = 16; + // + // change + // + this.change.AutoSize = true; + this.change.Location = new System.Drawing.Point(3, 88); + this.change.Name = "change"; + this.change.Size = new System.Drawing.Size(119, 23); + this.change.TabIndex = 12; + this.change.Text = "[InstallDirDlgChange]"; + this.change.UseVisualStyleBackColor = true; + this.change.Click += new System.EventHandler(this.change_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.Color.Transparent; + this.label3.Location = new System.Drawing.Point(0, 3); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(124, 13); + this.label3.TabIndex = 11; + this.label3.Text = "[InstallDirDlgFolderLabel]"; + // + // installDir + // + this.installDir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.installDir.Location = new System.Drawing.Point(3, 56); + this.installDir.Name = "installDir"; + this.installDir.Size = new System.Drawing.Size(443, 20); + this.installDir.TabIndex = 13; + // + // topBorder + // + this.topBorder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.topBorder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.topBorder.Location = new System.Drawing.Point(0, 58); + this.topBorder.Name = "topBorder"; + this.topBorder.Size = new System.Drawing.Size(494, 1); + this.topBorder.TabIndex = 15; + // + // topPanel + // + this.topPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.topPanel.BackColor = System.Drawing.SystemColors.Control; + this.topPanel.Controls.Add(this.label2); + this.topPanel.Controls.Add(this.label1); + this.topPanel.Controls.Add(this.banner); + this.topPanel.Location = new System.Drawing.Point(0, 0); + this.topPanel.Name = "topPanel"; + this.topPanel.Size = new System.Drawing.Size(494, 58); + this.topPanel.TabIndex = 10; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Transparent; + this.label2.Location = new System.Drawing.Point(18, 31); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(122, 13); + this.label2.TabIndex = 1; + this.label2.Text = "[InstallDirDlgDescription]"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.Color.Transparent; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(11, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(109, 13); + this.label1.TabIndex = 1; + this.label1.Text = "[InstallDirDlgTitle]"; + // + // banner + // + this.banner.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.banner.BackColor = System.Drawing.Color.White; + this.banner.Location = new System.Drawing.Point(0, 0); + this.banner.Name = "banner"; + this.banner.Size = new System.Drawing.Size(494, 58); + this.banner.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.banner.TabIndex = 0; + this.banner.TabStop = false; + // + // bottomPanel + // + this.bottomPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.bottomPanel.BackColor = System.Drawing.SystemColors.Control; + this.bottomPanel.Controls.Add(this.tableLayoutPanel1); + this.bottomPanel.Controls.Add(this.border1); + this.bottomPanel.Location = new System.Drawing.Point(0, 312); + this.bottomPanel.Name = "bottomPanel"; + this.bottomPanel.Size = new System.Drawing.Size(494, 49); + this.bottomPanel.TabIndex = 9; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel1.ColumnCount = 5; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 14F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.back, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.next, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.cancel, 4, 0); + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(493, 43); + this.tableLayoutPanel1.TabIndex = 8; + // + // back + // + this.back.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.back.AutoSize = true; + this.back.Location = new System.Drawing.Point(224, 10); + this.back.MinimumSize = new System.Drawing.Size(75, 0); + this.back.Name = "back"; + this.back.Size = new System.Drawing.Size(77, 23); + this.back.TabIndex = 0; + this.back.Text = "[WixUIBack]"; + this.back.UseVisualStyleBackColor = true; + this.back.Click += new System.EventHandler(this.back_Click); + // + // next + // + this.next.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.next.AutoSize = true; + this.next.Location = new System.Drawing.Point(307, 10); + this.next.MinimumSize = new System.Drawing.Size(75, 0); + this.next.Name = "next"; + this.next.Size = new System.Drawing.Size(77, 23); + this.next.TabIndex = 0; + this.next.Text = "[WixUINext]"; + this.next.UseVisualStyleBackColor = true; + this.next.Click += new System.EventHandler(this.next_Click); + // + // cancel + // + this.cancel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.cancel.AutoSize = true; + this.cancel.Location = new System.Drawing.Point(404, 10); + this.cancel.MinimumSize = new System.Drawing.Size(75, 0); + this.cancel.Name = "cancel"; + this.cancel.Size = new System.Drawing.Size(86, 23); + this.cancel.TabIndex = 0; + this.cancel.Text = "[WixUICancel]"; + this.cancel.UseVisualStyleBackColor = true; + this.cancel.Click += new System.EventHandler(this.cancel_Click); + // + // border1 + // + this.border1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.border1.Dock = System.Windows.Forms.DockStyle.Top; + this.border1.Location = new System.Drawing.Point(0, 0); + this.border1.Name = "border1"; + this.border1.Size = new System.Drawing.Size(494, 1); + this.border1.TabIndex = 14; + // + // InstallDirDialog + // + this.ClientSize = new System.Drawing.Size(494, 361); + this.Controls.Add(this.middlePanel); + this.Controls.Add(this.topBorder); + this.Controls.Add(this.topPanel); + this.Controls.Add(this.bottomPanel); + this.Name = "InstallDirDialog"; + this.Text = "[InstallDirDlg_Title]"; + this.Load += new System.EventHandler(this.InstallDirDialog_Load); + this.contextMenuStrip1.ResumeLayout(false); + this.middlePanel.ResumeLayout(false); + this.middlePanel.PerformLayout(); + this.topPanel.ResumeLayout(false); + this.topPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.banner)).EndInit(); + this.bottomPanel.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + } #endregion diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.cs index 7456e37f..20a56170 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/InstallDirDialog.cs @@ -1,5 +1,4 @@ using System; -using System.Drawing; using System.Windows.Forms; namespace WixSharp.UI.Forms @@ -90,9 +89,5 @@ void change_Click(object sender, EventArgs e) } } } - - private void label2_Click(object sender, EventArgs e) - { - } } } \ No newline at end of file diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs index 1c73d1fb..16072854 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics; -using System.Drawing; using System.IO; using System.Windows.Forms; @@ -11,7 +10,7 @@ namespace WixSharp.UI.Forms /// /// The standard Licence dialog /// - public partial class LicenceDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer + public partial class LicenceDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. @@ -78,7 +77,11 @@ void print_Click(object sender, EventArgs e) io.File.WriteAllText(file, agreement.Rtf); Process.Start(file); } - catch { } + catch + { + //Catch all, we don't want the installer to crash in an + //attempt to write to a file. + } } void copyToolStripMenuItem_Click(object sender, EventArgs e) @@ -100,7 +103,11 @@ void copyToolStripMenuItem_Click(object sender, EventArgs e) Clipboard.SetDataObject(data); } - catch { } + catch + { + //Catch all, we don't want the installer to crash in an + //attempt at setting data on the clipboard. + } } } } \ No newline at end of file diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs index e8f81325..db76786a 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.Linq; namespace WixSharp.UI.Forms @@ -7,7 +6,7 @@ namespace WixSharp.UI.Forms /// /// The standard Maintenance Type dialog /// - public partial class MaintenanceTypeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer + public partial class MaintenanceTypeDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. @@ -24,8 +23,7 @@ Type ProgressDialog get { return Shell.Dialogs - .Where(d => d.GetInterfaces().Contains(typeof(IProgressDialog))) - .FirstOrDefault(); + .FirstOrDefault(d => d.GetInterfaces().Contains(typeof(IProgressDialog))); } } diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs index 9bb1812d..d56c14a6 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs @@ -1,9 +1,6 @@ using System; -using System.Diagnostics; using System.Drawing; using System.Security.Principal; -using System.Threading; -using System.Windows.Forms; using Microsoft.Deployment.WindowsInstaller; using WixSharp.CommonTasks; @@ -12,7 +9,7 @@ namespace WixSharp.UI.Forms /// /// The standard Installation Progress dialog /// - public partial class ProgressDialog : ManagedForm, IManagedDialog, IProgressDialog // change ManagedForm->Form if you want to show it in designer + public partial class ProgressDialog : ManagedForm, IProgressDialog // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. @@ -108,54 +105,37 @@ public override MessageResult ProcessMessage(InstallMessage messageType, Record { try { - //messageRecord[0] - is reserved for FormatString value - - string message = null; - - bool simple = true; - if (simple) - { - /* - messageRecord[2] unconditionally contains the string to display - - Examples: - - messageRecord[0] "Action 23:14:50: [1]. [2]" - messageRecord[1] "InstallFiles" - messageRecord[2] "Copying new files" - messageRecord[3] "File: [1], Directory: [9], Size: [6]" - - messageRecord[0] "Action 23:15:21: [1]. [2]" - messageRecord[1] "RegisterUser" - messageRecord[2] "Registering user" - messageRecord[3] "[1]" - - */ - if (messageRecord.FieldCount >= 3) - { - message = messageRecord[2].ToString(); - } - } - else + /* + messageRecord[0] - is reserved for FormatString value + messageRecord[2] unconditionally contains the string to display + + Examples: + + messageRecord[0] "Action 23:14:50: [1]. [2]" + messageRecord[1] "InstallFiles" + messageRecord[2] "Copying new files" + messageRecord[3] "File: [1], Directory: [9], Size: [6]" + + messageRecord[0] "Action 23:15:21: [1]. [2]" + messageRecord[1] "RegisterUser" + messageRecord[2] "Registering user" + messageRecord[3] "[1]" + + */ + string message = null; + if (messageRecord.FieldCount >= 3) { - message = messageRecord.FormatString; - if (message.IsNotEmpty()) - { - for (int i = 1; i < messageRecord.FieldCount; i++) - { - message = message.Replace("[" + i + "]", messageRecord[i].ToString()); - } - } - else - { - message = messageRecord[messageRecord.FieldCount - 1].ToString(); - } + message = messageRecord[2].ToString(); } if (message.IsNotEmpty()) - currentAction.Text = currentActionLabel.Text + " " + message; + currentAction.Text = string.Format("{0} {1}", currentActionLabel.Text, message); + } + catch + { + //Catch all, we don't want the installer to crash in an + //attempt to process message. } - catch { } } break; } diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs index b0f3c2d4..c8b3c21d 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs @@ -6,7 +6,7 @@ namespace WixSharp.UI.Forms /// /// The standard Setup Type dialog /// - public partial class SetupTypeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer + public partial class SetupTypeDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. @@ -23,8 +23,7 @@ Type ProgressDialog get { return Shell.Dialogs - .Where(d => d.GetInterfaces().Contains(typeof(IProgressDialog))) - .FirstOrDefault(); + .FirstOrDefault(d => d.GetInterfaces().Contains(typeof(IProgressDialog))); } } diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs index 972def2f..bb2fe712 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs @@ -1,13 +1,11 @@ using System; -using System.Diagnostics; -using System.Windows.Forms; namespace WixSharp.UI.Forms { /// /// The standard Welcome dialog /// - public partial class WelcomeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer + public partial class WelcomeDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. From d68dac28882fc0d45c18aedef3c275705573ef97 Mon Sep 17 00:00:00 2001 From: Oleg Shilo Date: Thu, 14 May 2020 00:17:07 +1000 Subject: [PATCH 2/3] Update Compiler.cs --- Source/src/WixSharp/Compiler.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/src/WixSharp/Compiler.cs b/Source/src/WixSharp/Compiler.cs index 7f452041..11d81e12 100644 --- a/Source/src/WixSharp/Compiler.cs +++ b/Source/src/WixSharp/Compiler.cs @@ -39,9 +39,6 @@ THE SOFTWARE. using WixSharp.CommonTasks; using IO = System.IO; -//WIX References: -//http://www.wixwiki.com/index.php?title=Main_Page - namespace WixSharp { From 529f32f115b4a53c327471da1041427caa508487 Mon Sep 17 00:00:00 2001 From: Neal Callaghan Date: Thu, 14 May 2020 11:27:26 +0100 Subject: [PATCH 3/3] re-introduction where necessary of IManagedDialog into template dialogs, and re-introduction of alternative algorithm within the ProgressDialog --- .../ManagedUI/Forms/FeaturesDialog.cs | 2 +- .../ManagedUI/Forms/LicenceDialog.cs | 2 +- .../ManagedUI/Forms/MaintenanceTypeDialog.cs | 2 +- .../ManagedUI/Forms/ProgressDialog.cs | 65 ++++++++++++------- .../ManagedUI/Forms/SetupTypeDialog.cs | 2 +- .../ManagedUI/Forms/WelcomeDialog.cs | 2 +- 6 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs index 561a6133..6edd119b 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/FeaturesDialog.cs @@ -9,7 +9,7 @@ namespace WixSharp.UI.Forms /// different user experience as it has checkboxes bound to the features instead of icons context menu /// as MSI dialog has. /// - public partial class FeaturesDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer + public partial class FeaturesDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer { /*https://msdn.microsoft.com/en-us/library/aa367536(v=vs.85).aspx * ADDLOCAL - list of features to install diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs index 16072854..94e8d607 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/LicenceDialog.cs @@ -10,7 +10,7 @@ namespace WixSharp.UI.Forms /// /// The standard Licence dialog /// - public partial class LicenceDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer + public partial class LicenceDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs index db76786a..a6449e6c 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/MaintenanceTypeDialog.cs @@ -6,7 +6,7 @@ namespace WixSharp.UI.Forms /// /// The standard Maintenance Type dialog /// - public partial class MaintenanceTypeDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer + public partial class MaintenanceTypeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs index d56c14a6..65adcd07 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/ProgressDialog.cs @@ -9,7 +9,7 @@ namespace WixSharp.UI.Forms /// /// The standard Installation Progress dialog /// - public partial class ProgressDialog : ManagedForm, IProgressDialog // change ManagedForm->Form if you want to show it in designer + public partial class ProgressDialog : ManagedForm, IManagedDialog, IProgressDialog // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. @@ -105,31 +105,52 @@ public override MessageResult ProcessMessage(InstallMessage messageType, Record { try { - /* - messageRecord[0] - is reserved for FormatString value - messageRecord[2] unconditionally contains the string to display - - Examples: - - messageRecord[0] "Action 23:14:50: [1]. [2]" - messageRecord[1] "InstallFiles" - messageRecord[2] "Copying new files" - messageRecord[3] "File: [1], Directory: [9], Size: [6]" - - messageRecord[0] "Action 23:15:21: [1]. [2]" - messageRecord[1] "RegisterUser" - messageRecord[2] "Registering user" - messageRecord[3] "[1]" - - */ - string message = null; - if (messageRecord.FieldCount >= 3) + //messageRecord[0] - is reserved for FormatString value + + string message = null; + + bool simple = true; + if (simple) + { + /* + messageRecord[2] unconditionally contains the string to display + + Examples: + + messageRecord[0] "Action 23:14:50: [1]. [2]" + messageRecord[1] "InstallFiles" + messageRecord[2] "Copying new files" + messageRecord[3] "File: [1], Directory: [9], Size: [6]" + + messageRecord[0] "Action 23:15:21: [1]. [2]" + messageRecord[1] "RegisterUser" + messageRecord[2] "Registering user" + messageRecord[3] "[1]" + + */ + if (messageRecord.FieldCount >= 3) + { + message = messageRecord[2].ToString(); + } + } + else { - message = messageRecord[2].ToString(); + message = messageRecord.FormatString; + if (message.IsNotEmpty()) + { + for (int i = 1; i < messageRecord.FieldCount; i++) + { + message = message.Replace("[" + i + "]", messageRecord[i].ToString()); + } + } + else + { + message = messageRecord[messageRecord.FieldCount - 1].ToString(); + } } if (message.IsNotEmpty()) - currentAction.Text = string.Format("{0} {1}", currentActionLabel.Text, message); + currentAction.Text = "{0} {1}".FormatWith(currentActionLabel.Text, message); } catch { diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs index c8b3c21d..824a95d2 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/SetupTypeDialog.cs @@ -6,7 +6,7 @@ namespace WixSharp.UI.Forms /// /// The standard Setup Type dialog /// - public partial class SetupTypeDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer + public partial class SetupTypeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class. diff --git a/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs b/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs index bb2fe712..8d34e56a 100644 --- a/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs +++ b/Source/src/WixSharp.UI/ManagedUI/Forms/WelcomeDialog.cs @@ -5,7 +5,7 @@ namespace WixSharp.UI.Forms /// /// The standard Welcome dialog /// - public partial class WelcomeDialog : ManagedForm // change ManagedForm->Form if you want to show it in designer + public partial class WelcomeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer { /// /// Initializes a new instance of the class.