Merge pull request #1065 from mattias-symphony/SDA-2389b

feat: SDA-2389 Added custom dialogs
This commit is contained in:
mattias-symphony 2020-09-07 11:26:43 +02:00 committed by GitHub
commit b66d59d8cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 409 additions and 2 deletions

View File

@ -1,4 +1,4 @@
pushd WixSharpInstaller
set WIXSHARP_WIXDIR=..\WixSharpToolSet\Wix_bin\bin
..\WixSharpToolSet\cscs Symphony.cs
..\WixSharpToolSet\cscs -dbg Symphony.cs
popd

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,20 @@
using WixSharp;
namespace Symphony
{
public partial class ExitDlg : WixSharp.UI.Forms.ManagedForm, IManagedDialog
{
public ExitDlg()
{
InitializeComponent();
}
private void ExitDlg_Load(object sender, System.EventArgs e)
{
// Exit installation on completion (don't wait for user to confirm)
// After installation exits, the app will be auto launched, but that is specified in Symphony.cs
Shell.Exit();
}
}
}

View File

@ -0,0 +1,42 @@
// This file is created and modified from the visual form designer in Visual Studio, so shouldn't need to be modified by hand
namespace Symphony
{
partial class ExitDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// ExitDlg
//
this.Name = "ExitDlg";
this.Load += new System.EventHandler(this.ExitDlg_Load);
}
#endregion
}
}

View File

@ -1,9 +1,15 @@
//css_dir ..\..\..\;
//css_dir ..\WixSharpToolset\;
//css_ref System.Core.dll;
//css_ref System.Windows.Forms.dll;
//css_ref Wix_bin\SDK\Microsoft.Deployment.WindowsInstaller.dll;
//css_ref WixSharp.UI.dll;
//css_imp WelcomeDlg.cs;
//css_imp WelcomeDlg.designer.cs;
//css_imp ExitDlg.cs;
//css_imp ExitDlg.designer.cs;
using WixSharp;
using WixSharp.Forms;
using Microsoft.Deployment.WindowsInstaller;
class Script
@ -161,6 +167,18 @@ class Script
}
};
// Use our own Symphony branded bitmap for installation dialogs
project.BannerImage = "Banner.jpg";
project.BackgroundImage = "Tabloid.jpg";
// Define our own installation flow, using a mix of custom dialogs (defined in their own files) and built-in dialogs
project.ManagedUI = new ManagedUI();
project.ManagedUI.InstallDialogs.Add<Symphony.WelcomeDlg>()
.Add(Dialogs.InstallDir)
.Add(Dialogs.Progress)
.Add<Symphony.ExitDlg>();
// Generate an MSI from all settings done above
Compiler.BuildMsi(project);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,57 @@
using WixSharp;
using System.Drawing;
namespace Symphony
{
public partial class WelcomeDlg : WixSharp.UI.Forms.ManagedForm, IManagedDialog
{
// Helper function to retrive the user name of the current user. The user name returned from
// windows can be on the form DOMAIN\USER or USER@DOMAIN. This function strips away the domain
// name and separator, and returns the undecorated user name only.
private string getUserName()
{
var name = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
var slashIndex = name.IndexOf("\\");
return slashIndex > -1 ? name.Substring(slashIndex + 1) : name.Substring(0, name.IndexOf("@"));
}
public WelcomeDlg()
{
InitializeComponent();
}
void dialog_Load(object sender, System.EventArgs e)
{
// Populate the dynamic UI elements that can't be set at compile time (background image and
// the label containing user name)
this.backgroundPanel.BackgroundImage = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Dialog");
this.radioButtonCurrentUser.Text = "Only for me (" + getUserName() + ")";
}
void next_Click(object sender, System.EventArgs e)
{
// To enable Wix to use the "MSIINSTALLPERUSER" property being set below, ALLUSERS must be set to 2
Runtime.Session["ALLUSERS"] = "2";
if (radioButtonCurrentUser.Checked)
{
// Install for current user
Runtime.Session["MSIINSTALLPERUSER"] = "1"; // per-user
Runtime.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Apps\" + Runtime.ProductName);
} else if (radioButtonAllUsers.Checked)
{
// Install for all users
Runtime.Session["MSIINSTALLPERUSER"] = ""; // per-machine
Runtime.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%PROGRAMFILES%\" + Runtime.ProductName);
}
Shell.GoNext();
}
void cancel_Click(object sender, System.EventArgs e)
{
Shell.Cancel();
}
}
}

View File

@ -0,0 +1,212 @@
// This file is created and modified from the visual form designer in Visual Studio, so shouldn't need to be modified by hand
namespace Symphony
{
partial class WelcomeDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.bottomPanel = new System.Windows.Forms.Panel();
this.tableLayoutbackgroundPanel = new System.Windows.Forms.TableLayoutPanel();
this.next = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
this.backgroundPanel = new System.Windows.Forms.Panel();
this.panelInstallType = new System.Windows.Forms.Panel();
this.radioButtonAllUsers = new System.Windows.Forms.RadioButton();
this.radioButtonCurrentUser = new System.Windows.Forms.RadioButton();
this.labelInstallType = new System.Windows.Forms.Label();
this.labelBody = new System.Windows.Forms.Label();
this.labelHeader = new System.Windows.Forms.Label();
this.bottomPanel.SuspendLayout();
this.tableLayoutbackgroundPanel.SuspendLayout();
this.backgroundPanel.SuspendLayout();
this.panelInstallType.SuspendLayout();
this.SuspendLayout();
//
// 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.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.bottomPanel.Controls.Add(this.tableLayoutbackgroundPanel);
this.bottomPanel.Location = new System.Drawing.Point(-3, 308);
this.bottomPanel.Name = "bottomPanel";
this.bottomPanel.Size = new System.Drawing.Size(503, 57);
this.bottomPanel.TabIndex = 9;
//
// tableLayoutbackgroundPanel
//
this.tableLayoutbackgroundPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutbackgroundPanel.ColumnCount = 5;
this.tableLayoutbackgroundPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutbackgroundPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutbackgroundPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutbackgroundPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 14F));
this.tableLayoutbackgroundPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutbackgroundPanel.Controls.Add(this.next, 2, 0);
this.tableLayoutbackgroundPanel.Controls.Add(this.cancel, 4, 0);
this.tableLayoutbackgroundPanel.Location = new System.Drawing.Point(0, 3);
this.tableLayoutbackgroundPanel.Name = "tableLayoutbackgroundPanel";
this.tableLayoutbackgroundPanel.RowCount = 1;
this.tableLayoutbackgroundPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutbackgroundPanel.Size = new System.Drawing.Size(491, 43);
this.tableLayoutbackgroundPanel.TabIndex = 7;
//
// next
//
this.next.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.next.AutoSize = true;
this.next.Location = new System.Drawing.Point(305, 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(402, 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);
//
// backgroundPanel
//
this.backgroundPanel.BackColor = System.Drawing.Color.White;
this.backgroundPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.backgroundPanel.Controls.Add(this.panelInstallType);
this.backgroundPanel.Controls.Add(this.labelInstallType);
this.backgroundPanel.Controls.Add(this.labelBody);
this.backgroundPanel.Controls.Add(this.labelHeader);
this.backgroundPanel.Location = new System.Drawing.Point(-3, -1);
this.backgroundPanel.Name = "backgroundPanel";
this.backgroundPanel.Size = new System.Drawing.Size(502, 309);
this.backgroundPanel.TabIndex = 10;
//
// panelInstallType
//
this.panelInstallType.BackColor = System.Drawing.SystemColors.ButtonFace;
this.panelInstallType.Controls.Add(this.radioButtonAllUsers);
this.panelInstallType.Controls.Add(this.radioButtonCurrentUser);
this.panelInstallType.Location = new System.Drawing.Point(192, 174);
this.panelInstallType.Name = "panelInstallType";
this.panelInstallType.Size = new System.Drawing.Size(241, 69);
this.panelInstallType.TabIndex = 4;
//
// radioButtonAllUsers
//
this.radioButtonAllUsers.AutoSize = true;
this.radioButtonAllUsers.Location = new System.Drawing.Point(26, 38);
this.radioButtonAllUsers.Name = "radioButtonAllUsers";
this.radioButtonAllUsers.Size = new System.Drawing.Size(159, 17);
this.radioButtonAllUsers.TabIndex = 3;
this.radioButtonAllUsers.Text = "For all users (admin required)";
this.radioButtonAllUsers.UseVisualStyleBackColor = true;
//
// radioButtonCurrentUser
//
this.radioButtonCurrentUser.AutoSize = true;
this.radioButtonCurrentUser.Checked = true;
this.radioButtonCurrentUser.Location = new System.Drawing.Point(26, 15);
this.radioButtonCurrentUser.Name = "radioButtonCurrentUser";
this.radioButtonCurrentUser.Size = new System.Drawing.Size(87, 17);
this.radioButtonCurrentUser.TabIndex = 2;
this.radioButtonCurrentUser.TabStop = true;
this.radioButtonCurrentUser.Text = "Only for me ()";
this.radioButtonCurrentUser.UseVisualStyleBackColor = true;
//
// labelInstallType
//
this.labelInstallType.AutoSize = true;
this.labelInstallType.Location = new System.Drawing.Point(188, 158);
this.labelInstallType.Name = "labelInstallType";
this.labelInstallType.Size = new System.Drawing.Size(133, 13);
this.labelInstallType.TabIndex = 3;
this.labelInstallType.Text = "Select the installation type:";
//
// labelBody
//
this.labelBody.AutoSize = true;
this.labelBody.Location = new System.Drawing.Point(188, 71);
this.labelBody.Name = "labelBody";
this.labelBody.Size = new System.Drawing.Size(232, 52);
this.labelBody.TabIndex = 1;
this.labelBody.Text = "Symphony allows you to:\r\n - Collaborate securely\r\n - Communicate via messages, vo" +
"ice, and video\r\n - Connect with colleagues and coworkers\r\n";
//
// labelHeader
//
this.labelHeader.AutoSize = true;
this.labelHeader.Font = new System.Drawing.Font("Verdana", 12.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelHeader.Location = new System.Drawing.Point(187, 20);
this.labelHeader.MaximumSize = new System.Drawing.Size(500, 0);
this.labelHeader.Name = "labelHeader";
this.labelHeader.Size = new System.Drawing.Size(246, 40);
this.labelHeader.TabIndex = 0;
this.labelHeader.Text = "Thanks for downloading \r\nSymphony";
//
// WelcomeDlg
//
this.ClientSize = new System.Drawing.Size(494, 361);
this.Controls.Add(this.backgroundPanel);
this.Controls.Add(this.bottomPanel);
this.Name = "WelcomeDlg";
this.Text = "Symphony Setup";
this.Load += new System.EventHandler(this.dialog_Load);
this.bottomPanel.ResumeLayout(false);
this.tableLayoutbackgroundPanel.ResumeLayout(false);
this.tableLayoutbackgroundPanel.PerformLayout();
this.backgroundPanel.ResumeLayout(false);
this.backgroundPanel.PerformLayout();
this.panelInstallType.ResumeLayout(false);
this.panelInstallType.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.TableLayoutPanel tableLayoutbackgroundPanel;
private System.Windows.Forms.Button next;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Panel backgroundPanel;
private System.Windows.Forms.Label labelHeader;
private System.Windows.Forms.Label labelBody;
private System.Windows.Forms.Label labelInstallType;
private System.Windows.Forms.Panel panelInstallType;
private System.Windows.Forms.RadioButton radioButtonAllUsers;
private System.Windows.Forms.RadioButton radioButtonCurrentUser;
}
}

View File

@ -336,6 +336,16 @@
<param name="msiParams">The MSI parameters.</param>
<exception cref="T:System.ApplicationException"></exception>
</member>
<member name="M:WixSharp.UI.MsiSession.OnMessage(System.String,System.UInt32)">
<summary>
Called when MSI message is received. It is actual the MSI <c>Message Loop</c>.
</summary>
<param name="message">The message data.</param>
<param name="messageType">Type of the message. This value get's combined with MessageIcon and a MessageButtons values. Use
<see cref="F:WindowsInstaller.MsiInterop.MessageTypeMask"/> to extract the <see cref="T:WindowsInstaller.MsiInstallMessage"/> value.
</param>
<returns>The integer as per MSI documentation.</returns>
</member>
<member name="M:WixSharp.UI.MsiSession.OnMessage(System.String,WindowsInstaller.MsiInstallMessage)">
<summary>
Called when MSI message is received. It is actual the MSI <c>Message Loop</c>.

View File

@ -14243,6 +14243,11 @@
The .NET4.7.2 installed. This condition is to be used in Project.SetNetFxPrerequisite.
</summary>
</member>
<member name="F:WixSharp.Condition.Net48_Installed">
<summary>
The .NET4.8 installed. This condition is to be used in Project.SetNetFxPrerequisite.
</summary>
</member>
<member name="F:WixSharp.Condition.Net30_SP_Installed">
<summary>
The .NET3.0 SP installed. This condition is to be used in Project.SetNetFxPrerequisite.
@ -15008,6 +15013,36 @@
The namespace.
</value>
</member>
<member name="T:WixSharp.ProcessExtensions">
<summary>
Extension methods for <see cref="T:System.Diagnostics.Process"/>
</summary>
</member>
<member name="M:WixSharp.ProcessExtensions.StartElevated(System.String,System.String)">
<summary>
Starts a process resource by specifying the name of an application and a set of command-line arguments,
and associates the resource with a new System.Diagnostics.Process component.
</summary>
<param name="fileName">Gets or sets the application or document to start.</param>
<param name="args">Gets or sets the set of command-line arguments to use when starting the application.</param>
<returns>A new <see cref="T:System.Diagnostics.Process"/> component that is associated with the process, or null, if no process resource is started (for example, if an existing process is reused).</returns>
</member>
<member name="M:WixSharp.ProcessExtensions.Start(System.String,System.String)">
<summary>
Starts a process resource by specifying the name of an application and a set of command-line arguments,
and associates the resource with a new System.Diagnostics.Process component.
</summary>
<param name="fileName">Gets or sets the application or document to start.</param>
<param name="args">Gets or sets the set of command-line arguments to use when starting the application.</param>
<returns>A new <see cref="T:System.Diagnostics.Process"/> component that is associated with the process, or null, if no process resource is started (for example, if an existing process is reused).</returns>
</member>
<member name="M:WixSharp.ProcessExtensions.Wait(System.Diagnostics.Process)">
<summary>
Instructs the <see cref="T:System.Diagnostics.Process"/> component to wait indefinitely for the associated process to exit.
</summary>
<param name="process">An instance of <see cref="T:System.Diagnostics.Process"/> component that is running.</param>
<returns>An instance of <see cref="T:System.Diagnostics.Process"/> component that is running.</returns>
</member>
<member name="T:WixSharp.FeatureSet">
<summary>
@ -18762,10 +18797,23 @@
<param name="message">The error message that explains the reason for the exception.</param>
<param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param>
</member>
<member name="T:WixSharp.WixSharpException">
<summary>
Generic WixSharp exception class.
</summary>
<seealso cref="T:System.ApplicationException" />
</member>
<member name="M:WixSharp.WixSharpException.#ctor(System.String)">
<summary>
Initializes a new instance of the <see cref="T:WixSharp.WixSharpException"/> class.
</summary>
<param name="message">The message.</param>
</member>
<member name="T:WixSharp.ValidationException">
<summary>
Generic validation exception class.
</summary>
<seealso cref="T:System.ApplicationException" />
</member>
<member name="M:WixSharp.ValidationException.#ctor(System.String)">
<summary>