SDA-2521 Adding custom dialogs for the whole flow, and confirmation for cancel button

This commit is contained in:
Mattias Gustavsson 2020-10-26 08:46:07 +01:00
parent a60d73f66c
commit b587e1a7d8
10 changed files with 1361 additions and 8 deletions

View File

@ -47,7 +47,11 @@ namespace Symphony
void cancel_Click(object sender, System.EventArgs e)
{
Shell.Cancel();
if( System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel Symphony installation?",
"Symphony Setup", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes )
{
Shell.Cancel();
}
}
}

View File

@ -0,0 +1,295 @@
using WixSharp;
using WixSharp.UI.Forms;
namespace Symphony
{
partial class InstallDirDialog
{
/// <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.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
private System.Windows.Forms.PictureBox banner;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.Panel topPanel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button change;
private System.Windows.Forms.TextBox installDir;
private System.Windows.Forms.Panel border1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button back;
private System.Windows.Forms.Button next;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Panel topBorder;
private System.Windows.Forms.Panel middlePanel;
}
}

View File

@ -0,0 +1,102 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using WixSharp;
using WixSharp.UI.Forms;
namespace Symphony
{
/// <summary>
/// The standard InstallDir dialog
/// </summary>
public partial class InstallDirDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer
{
/// <summary>
/// Initializes a new instance of the <see cref="InstallDirDialog"/> class.
/// </summary>
public InstallDirDialog()
{
InitializeComponent();
label1.MakeTransparentOn(banner);
label2.MakeTransparentOn(banner);
}
string installDirProperty;
void InstallDirDialog_Load(object sender, EventArgs e)
{
banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");
installDirProperty = Runtime.Session.Property("WixSharp_UI_INSTALLDIR");
string installDirPropertyValue = Runtime.Session.Property(installDirProperty);
if (installDirPropertyValue.IsEmpty())
{
//We are executed before any of the MSI actions are invoked so the INSTALLDIR (if set to absolute path)
//is not resolved yet. So we need to do it manually
installDir.Text = Runtime.Session.GetDirectoryPath(installDirProperty);
if (installDir.Text == "ABSOLUTEPATH")
installDir.Text = Runtime.Session.Property("INSTALLDIR_ABSOLUTEPATH");
}
else
{
//INSTALLDIR set either from the command line or by one of the early setup events (e.g. UILoaded)
installDir.Text = installDirPropertyValue;
}
ResetLayout();
}
void ResetLayout()
{
// The form controls are properly anchored and will be correctly resized on parent form
// resizing. However the initial sizing by WinForm runtime doesn't a do good job with DPI
// other than 96. Thus manual resizing is the only reliable option apart from going WPF.
float ratio = (float)banner.Image.Width / (float)banner.Image.Height;
topPanel.Height = (int)(banner.Width / ratio);
topBorder.Top = topPanel.Height + 1;
middlePanel.Top = topBorder.Bottom + 10;
var upShift = (int)(next.Height * 2.3) - bottomPanel.Height;
bottomPanel.Top -= upShift;
bottomPanel.Height += upShift;
}
void back_Click(object sender, EventArgs e)
{
Shell.GoPrev();
}
void next_Click(object sender, EventArgs e)
{
if (!installDirProperty.IsEmpty())
Runtime.Session[installDirProperty] = installDir.Text;
Shell.GoNext();
}
void cancel_Click(object sender, EventArgs e)
{
if( System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel Symphony installation?",
"Symphony Setup", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes )
{
Shell.Cancel();
}
}
void change_Click(object sender, EventArgs e)
{
using (var dialog = new FolderBrowserDialog { SelectedPath = installDir.Text })
{
if (dialog.ShowDialog() == DialogResult.OK)
{
installDir.Text = dialog.SelectedPath;
}
}
}
}
}

View File

@ -23,7 +23,11 @@ namespace Symphony
void cancel_Click(object sender, System.EventArgs e)
{
Shell.Cancel();
if( System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel Symphony installation?",
"Symphony Setup", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes )
{
Shell.Cancel();
}
}
}
}

View File

@ -0,0 +1,337 @@
using WixSharp;
using WixSharp.UI.Forms;
namespace Symphony
{
partial class MaintenanceTypeDialog
{
/// <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.topBorder = new System.Windows.Forms.Panel();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.remove = new System.Windows.Forms.Button();
this.repair = new System.Windows.Forms.Button();
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.middlePanel = new System.Windows.Forms.TableLayoutPanel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.topPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.banner)).BeginInit();
this.bottomPanel.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.middlePanel.SuspendLayout();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
this.SuspendLayout();
//
// 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 = 18;
//
// label5
//
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label5.AutoEllipsis = true;
this.label5.BackColor = System.Drawing.Color.Transparent;
this.label5.Location = new System.Drawing.Point(28, 40);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(442, 38);
this.label5.TabIndex = 1;
this.label5.Text = "[MaintenanceTypeDlgRemoveText]";
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoEllipsis = true;
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.Location = new System.Drawing.Point(28, 40);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(440, 34);
this.label4.TabIndex = 1;
this.label4.Text = "[MaintenanceTypeDlgRepairText]";
//
// remove
//
this.remove.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.remove.AutoSize = true;
this.remove.Location = new System.Drawing.Point(0, 5);
this.remove.MaximumSize = new System.Drawing.Size(113, 0);
this.remove.MinimumSize = new System.Drawing.Size(113, 0);
this.remove.Name = "remove";
this.remove.Size = new System.Drawing.Size(113, 23);
this.remove.TabIndex = 16;
this.remove.Text = "[MaintenanceTypeDlgRemoveButton]";
this.remove.UseVisualStyleBackColor = true;
this.remove.Click += new System.EventHandler(this.remove_Click);
//
// repair
//
this.repair.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.repair.AutoSize = true;
this.repair.Location = new System.Drawing.Point(0, 5);
this.repair.MaximumSize = new System.Drawing.Size(113, 0);
this.repair.MinimumSize = new System.Drawing.Size(113, 0);
this.repair.Name = "repair";
this.repair.Size = new System.Drawing.Size(113, 23);
this.repair.TabIndex = 15;
this.repair.Text = "[MaintenanceTypeDlgRepairButton]";
this.repair.UseVisualStyleBackColor = true;
this.repair.Click += new System.EventHandler(this.repair_Click);
//
// 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 = 13;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Location = new System.Drawing.Point(19, 31);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(168, 13);
this.label2.TabIndex = 1;
this.label2.Text = "[MaintenanceTypeDlgDescription]";
//
// 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(160, 13);
this.label1.TabIndex = 1;
this.label1.Text = "[MaintenanceTypeDlgTitle]";
//
// 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.BackColor = System.Drawing.SystemColors.Control;
this.bottomPanel.Controls.Add(this.tableLayoutPanel1);
this.bottomPanel.Controls.Add(this.border1);
this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
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 = 12;
//
// 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, 3);
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(491, 43);
this.tableLayoutPanel1.TabIndex = 7;
//
// back
//
this.back.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.back.AutoSize = true;
this.back.Enabled = false;
this.back.Location = new System.Drawing.Point(222, 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.Enabled = false;
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);
//
// border1
//
this.border1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.border1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
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 = 17;
//
// 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.ColumnCount = 1;
this.middlePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.middlePanel.Controls.Add(this.panel4, 0, 0);
this.middlePanel.Controls.Add(this.panel5, 0, 1);
this.middlePanel.Location = new System.Drawing.Point(15, 61);
this.middlePanel.Name = "middlePanel";
this.middlePanel.RowCount = 3;
this.middlePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.middlePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.middlePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.middlePanel.Size = new System.Drawing.Size(479, 248);
this.middlePanel.TabIndex = 20;
//
// panel4
//
this.panel4.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.panel4.Controls.Add(this.repair);
this.panel4.Controls.Add(this.label4);
this.panel4.Location = new System.Drawing.Point(3, 85);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(473, 76);
this.panel4.TabIndex = 1;
//
// panel5
//
this.panel5.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.panel5.Controls.Add(this.remove);
this.panel5.Controls.Add(this.label5);
this.panel5.Location = new System.Drawing.Point(3, 167);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(473, 78);
this.panel5.TabIndex = 2;
//
// MaintenanceTypeDialog
//
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 = "MaintenanceTypeDialog";
this.Text = "[MaintenanceTypeDlg_Title]";
this.Load += new System.EventHandler(this.MaintenanceTypeDialog_Load);
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.middlePanel.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox banner;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel topPanel;
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.Button repair;
private System.Windows.Forms.Button remove;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Panel border1;
private System.Windows.Forms.Panel topBorder;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button back;
private System.Windows.Forms.Button next;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.TableLayoutPanel middlePanel;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel5;
}
}

View File

@ -0,0 +1,100 @@
using System;
using System.Diagnostics;
using System.Linq;
using WixSharp;
using WixSharp.UI.Forms;
namespace Symphony
{
/// <summary>
/// The standard Maintenance Type dialog
/// </summary>
public partial class MaintenanceTypeDialog : ManagedForm, IManagedDialog // change ManagedForm->Form if you want to show it in designer
{
/// <summary>
/// Initializes a new instance of the <see cref="MaintenanceTypeDialog"/> class.
/// </summary>
public MaintenanceTypeDialog()
{
InitializeComponent();
label1.MakeTransparentOn(banner);
label2.MakeTransparentOn(banner);
}
Type ProgressDialog
{
get
{
return Shell.Dialogs
.Where(d => d.GetInterfaces().Contains(typeof(IProgressDialog)))
.FirstOrDefault();
}
}
void repair_Click(object sender, System.EventArgs e)
{
Runtime.Session["MODIFY_ACTION"] = "Repair";
int index = Shell.Dialogs.IndexOf(ProgressDialog);
if (index != -1)
Shell.GoTo(index);
else
Shell.GoNext();
}
void remove_Click(object sender, System.EventArgs e)
{
Runtime.Session["REMOVE"] = "ALL";
Runtime.Session["MODIFY_ACTION"] = "Remove";
int index = Shell.Dialogs.IndexOf(ProgressDialog);
if (index != -1)
Shell.GoTo(index);
else
Shell.GoNext();
}
void back_Click(object sender, System.EventArgs e)
{
Shell.GoPrev();
}
void next_Click(object sender, System.EventArgs e)
{
Shell.GoNext();
}
void cancel_Click(object sender, System.EventArgs e)
{
if( System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel Symphony installation?",
"Symphony Setup", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes )
{
Shell.Cancel();
}
}
void MaintenanceTypeDialog_Load(object sender, System.EventArgs e)
{
banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");
ResetLayout();
}
void ResetLayout()
{
// The form controls are properly anchored and will be correctly resized on parent form
// resizing. However the initial sizing by WinForm runtime doesn't a do good job with DPI
// other than 96. Thus manual resizing is the only reliable option apart from going WPF.
float ratio = (float)banner.Image.Width / (float)banner.Image.Height;
topPanel.Height = (int)(banner.Width / ratio);
topBorder.Top = topPanel.Height + 1;
var upShift = (int)(next.Height * 2.3) - bottomPanel.Height;
bottomPanel.Top -= upShift;
bottomPanel.Height += upShift;
middlePanel.Top = topBorder.Bottom + 5;
middlePanel.Height = (bottomPanel.Top - 5) - middlePanel.Top;
}
}
}

View File

@ -0,0 +1,277 @@
using WixSharp;
using WixSharp.UI.Forms;
namespace Symphony
{
partial class ProgressDialog
{
/// <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.topBorder = new System.Windows.Forms.Panel();
this.progress = new System.Windows.Forms.ProgressBar();
this.currentAction = new System.Windows.Forms.Label();
this.topPanel = new System.Windows.Forms.Panel();
this.dialogText = 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.bottomBorder = new System.Windows.Forms.Panel();
this.description = new System.Windows.Forms.Label();
this.currentActionLabel = new System.Windows.Forms.Label();
this.waitPrompt = new System.Windows.Forms.Label();
this.topPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.banner)).BeginInit();
this.bottomPanel.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// 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 = 22;
//
// progress
//
this.progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progress.Location = new System.Drawing.Point(32, 165);
this.progress.Name = "progress";
this.progress.Size = new System.Drawing.Size(434, 13);
this.progress.Step = 1;
this.progress.TabIndex = 20;
//
// currentAction
//
this.currentAction.AutoSize = true;
this.currentAction.Location = new System.Drawing.Point(34, 144);
this.currentAction.Name = "currentAction";
this.currentAction.Size = new System.Drawing.Size(0, 13);
this.currentAction.TabIndex = 19;
//
// 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.dialogText);
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 = 15;
//
// dialogText
//
this.dialogText.AutoSize = true;
this.dialogText.BackColor = System.Drawing.Color.Transparent;
this.dialogText.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dialogText.Location = new System.Drawing.Point(11, 22);
this.dialogText.Name = "dialogText";
this.dialogText.Size = new System.Drawing.Size(159, 13);
this.dialogText.TabIndex = 1;
this.dialogText.Text = "[ProgressDlgTitleInstalling]";
//
// 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.bottomBorder);
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 = 14;
//
// 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, 3);
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(491, 43);
this.tableLayoutPanel1.TabIndex = 7;
//
// back
//
this.back.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.back.AutoSize = true;
this.back.Enabled = false;
this.back.Location = new System.Drawing.Point(222, 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;
//
// next
//
this.next.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.next.AutoSize = true;
this.next.Enabled = false;
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;
//
// 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);
//
// bottomBorder
//
this.bottomBorder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.bottomBorder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.bottomBorder.Location = new System.Drawing.Point(0, 0);
this.bottomBorder.Name = "bottomBorder";
this.bottomBorder.Size = new System.Drawing.Size(494, 1);
this.bottomBorder.TabIndex = 21;
//
// description
//
this.description.AutoSize = true;
this.description.BackColor = System.Drawing.Color.Transparent;
this.description.Location = new System.Drawing.Point(29, 95);
this.description.Name = "description";
this.description.Size = new System.Drawing.Size(132, 13);
this.description.TabIndex = 16;
this.description.Text = "[ProgressDlgTextInstalling]";
//
// currentActionLabel
//
this.currentActionLabel.BackColor = System.Drawing.Color.Transparent;
this.currentActionLabel.Location = new System.Drawing.Point(29, 144);
this.currentActionLabel.Name = "currentActionLabel";
this.currentActionLabel.Size = new System.Drawing.Size(132, 13);
this.currentActionLabel.TabIndex = 19;
this.currentActionLabel.Text = "[ProgressDlgStatusLabel]";
this.currentActionLabel.Visible = false;
//
// waitPrompt
//
this.waitPrompt.AutoSize = true;
this.waitPrompt.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.waitPrompt.ForeColor = System.Drawing.Color.Blue;
this.waitPrompt.Location = new System.Drawing.Point(85, 209);
this.waitPrompt.Name = "waitPrompt";
this.waitPrompt.Size = new System.Drawing.Size(265, 39);
this.waitPrompt.TabIndex = 23;
this.waitPrompt.TabStop = true;
this.waitPrompt.Text = "Please wait for UAC prompt to appear.\r\n\r\nIf it appears minimized then activate it" +
" from the taskbar.";
this.waitPrompt.Visible = false;
//
// ProgressDialog
//
this.ClientSize = new System.Drawing.Size(494, 361);
this.ControlBox = false;
this.Controls.Add(this.waitPrompt);
this.Controls.Add(this.topBorder);
this.Controls.Add(this.progress);
this.Controls.Add(this.currentAction);
this.Controls.Add(this.topPanel);
this.Controls.Add(this.bottomPanel);
this.Controls.Add(this.description);
this.Controls.Add(this.currentActionLabel);
this.Name = "ProgressDialog";
this.Text = "[ProgressDlg_Title]";
this.Load += new System.EventHandler(this.ProgressDialog_Load);
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.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox banner;
private System.Windows.Forms.Panel topPanel;
private System.Windows.Forms.Label dialogText;
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.Label description;
private System.Windows.Forms.ProgressBar progress;
private System.Windows.Forms.Label currentAction;
private System.Windows.Forms.Label currentActionLabel;
private System.Windows.Forms.Panel bottomBorder;
private System.Windows.Forms.Panel topBorder;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button back;
private System.Windows.Forms.Button next;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Label waitPrompt;
}
}

View File

@ -0,0 +1,221 @@
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;
using WixSharp;
using WixSharp.UI.Forms;
namespace Symphony
{
/// <summary>
/// The standard Installation Progress dialog
/// </summary>
public partial class ProgressDialog : ManagedForm, IManagedDialog, IProgressDialog // change ManagedForm->Form if you want to show it in designer
{
private bool showingCancelConfirmation = false;
private bool complete = false;
/// <summary>
/// Initializes a new instance of the <see cref="ProgressDialog"/> class.
/// </summary>
public ProgressDialog()
{
InitializeComponent();
dialogText.MakeTransparentOn(banner);
}
void ProgressDialog_Load(object sender, EventArgs e)
{
banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");
if (!WindowsIdentity.GetCurrent().IsAdmin() && Uac.IsEnabled())
{
this.waitPrompt.Text = Runtime.Session.Property("UAC_WARNING");
this.waitPrompt.Visible = true;
}
ResetLayout();
Shell.StartExecute();
}
void ResetLayout()
{
// The form controls are properly anchored and will be correctly resized on parent form
// resizing. However the initial sizing by WinForm runtime doesn't a do good job with DPI
// other than 96. Thus manual resizing is the only reliable option apart from going WPF.
float ratio = (float)banner.Image.Width / (float)banner.Image.Height;
topPanel.Height = (int)(banner.Width / ratio);
topBorder.Top = topPanel.Height + 1;
var upShift = (int)(next.Height * 2.3) - bottomPanel.Height;
bottomPanel.Top -= upShift;
bottomPanel.Height += upShift;
var fontSize = waitPrompt.Font.Size;
float scaling = 1;
waitPrompt.Font = new Font(waitPrompt.Font.Name, fontSize * scaling, FontStyle.Italic);
}
/// <summary>
/// Called when Shell is changed. It is a good place to initialize the dialog to reflect the MSI session
/// (e.g. localize the view).
/// </summary>
protected override void OnShellChanged()
{
if (Runtime.Session.IsUninstalling())
{
dialogText.Text =
Text = "[ProgressDlgTitleRemoving]";
description.Text = "[ProgressDlgTextRemoving]";
}
else if (Runtime.Session.IsRepairing())
{
dialogText.Text =
Text = "[ProgressDlgTextRepairing]";
description.Text = "[ProgressDlgTitleRepairing]";
}
else if (Runtime.Session.IsInstalling())
{
dialogText.Text =
Text = "[ProgressDlgTitleInstalling]";
description.Text = "[ProgressDlgTextInstalling]";
}
this.Localize();
}
/// <summary>
/// Processes the message.
/// </summary>
/// <param name="messageType">Type of the message.</param>
/// <param name="messageRecord">The message record.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param>
/// <returns></returns>
public override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton)
{
switch (messageType)
{
case InstallMessage.InstallStart:
case InstallMessage.InstallEnd:
{
waitPrompt.Visible = false;
}
break;
case InstallMessage.ActionStart:
{
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
{
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 = currentActionLabel.Text + " " + message;
}
catch { }
}
break;
}
return MessageResult.OK;
}
/// <summary>
/// Called when MSI execution progress is changed.
/// </summary>
/// <param name="progressPercentage">The progress percentage.</param>
public override void OnProgress(int progressPercentage)
{
progress.Value = progressPercentage;
if (progressPercentage > 0)
{
waitPrompt.Visible = false;
}
}
/// <summary>
/// Called when MSI execution is complete.
/// </summary>
public override void OnExecuteComplete()
{
currentAction.Text = null;
if (showingCancelConfirmation)
{
complete = true;
}
else
{
Shell.GoNext();
}
}
/// <summary>
/// Handles the Click event of the cancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param>
void cancel_Click(object sender, EventArgs e)
{
showingCancelConfirmation = true;
if (System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel Symphony installation?",
"Symphony Setup", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
{
Shell.Cancel();
}
else if (complete)
{
Shell.GoNext();
}
showingCancelConfirmation = false;
}
}
}

View File

@ -7,10 +7,16 @@
//css_imp WelcomeDlg.designer.cs;
//css_imp CloseDlg.cs;
//css_imp CloseDlg.designer.cs;
//css_imp InstallDirDialog.cs
//css_imp InstallDirDialog.Designer.cs
//css_imp ExitDlg.cs;
//css_imp ExitDlg.designer.cs;
//css_imp MaintenanceDlg.cs;
//css_imp MaintenanceDlg.designer.cs;
//css_imp ProgressDialog.cs
//css_imp ProgressDialog.Designer.cs
//css_imp MaintenanceTypeDialog.cs;
//css_imp MaintenanceTypeDialog.designer.cs;
using WixSharp;
using WixSharp.Forms;
@ -205,18 +211,21 @@ class Script
// 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.InstallDirDialog>()
.Add<Symphony.ProgressDialog>()
.Add<Symphony.ExitDlg>()
.Add<Symphony.CloseDlg>();
project.ManagedUI.ModifyDialogs.Add<Symphony.MaintenanceDlg>()
.Add(Dialogs.MaintenanceType)
.Add(Dialogs.Progress)
.Add<Symphony.MaintenanceTypeDialog>()
.Add<Symphony.ProgressDialog>()
.Add<Symphony.ExitDlg>();
project.Load += project_Load;
project.BeforeInstall += project_BeforeInstall;
project.ControlPanelInfo.NoRepair = true;
project.ControlPanelInfo.NoModify = true;
project.Platform = Platform.x64;
// Generate an MSI from all settings done above
@ -259,7 +268,7 @@ class Script
{
try
{
if (e.IsUninstalling)
if (e.IsUninstalling && e.Session["REMOVE"] == "ALL")
{
var result = System.Windows.Forms.MessageBox.Show("Are you sure you want to uninstall this product?",
"Windows Installer", System.Windows.Forms.MessageBoxButtons.YesNo);

View File

@ -70,7 +70,11 @@ namespace Symphony
void cancel_Click(object sender, System.EventArgs e)
{
Shell.Cancel();
if( System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel Symphony installation?",
"Symphony Setup", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes )
{
Shell.Cancel();
}
}
}
}