C# Класс WixSharp.WixCLRDialog

Defines System.Windows.Forms.T:System.Windows.Forms.Form, which is to be used as the for custom MSI dialog.

As opposite to the WixSharp.T:WixSharp.WixForm based custom dialogs WixCLRDialog is instantiated not at compile but at run time. Thus it is possible to implement comprehensive deployment algorithms in any of the available Form event handlers.

The usual usability scenario is the injection of the managed Custom Action (for displaying the WixCLRDialog) into the sequence of the standard dialogs (WixSharp.T:WixSharp.CustomUI).

While it is possible to construct T:WixSharp.CustomUI instance manually it is preferred to use Factory methods of T:WixSharp.CustomUIBuilder (e.g. InjectPostLicenseClrDialog) for this.

static public void Main() { ManagedAction showDialog; var project = new Project("CustomDialogTest", showDialog = new ShowClrDialogAction("ShowProductActivationDialog")); project.UI = WUI.WixUI_Common; project.CustomUI = CustomUIBuilder.InjectPostLicenseClrDialog(showDialog.Id, " LicenseAccepted = \"1\""); Compiler.BuildMsi(project); } ... public class CustomActions { [CustomAction] public static ActionResult ShowProductActivationDialog(Session session) { return WixCLRDialog.ShowAsMsiDialog(new CustomDialog(session)); } } ... public partial class CustomDialog : WixCLRDialog { private GroupBox groupBox1; private Button cancelBtn; ...

The all communications with the installation in progress are to be done by modifying the MSI properties or executing MSI actions via Session object.

When closing the dialog make sure you set the DeialogResul properly. WixCLRDialog offers three predefined routines for setting the DialogResult:

- MSINext

- MSIBack

- MSICancel

By invoking these routines from the corresponding event handlers you can control your MSI UI sequence: void cancelBtn_Click(object sender, EventArgs e) { MSICancel(); } void nextBtn_Click(object sender, EventArgs e) { MSINext(); } void backBtn_Click(object sender, EventArgs e) { MSIBack(); }

Наследование: System.Windows.Forms.Form
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
session Microsoft.Deployment.WindowsInstaller.Session

Защищенные свойства (Protected)

Свойство Тип Описание
delta int
hostWindow System.IntPtr

Открытые методы

Метод Описание
GetMSIBinaryStream ( string binaryId ) : Stream

Gets the embedded MSI binary stream.

InitializeComponent ( ) : void
MSIBack ( ) : void

Closes the dialog and sets the this.DialogResult to the 'DialogResult.Retry' value ensuring the setup is resumed with the previous UI sequence dialog is displayed.

MSICancel ( ) : void

Closes the dialog and sets the this.DialogResult to the 'DialogResult.Cancel' value ensuring the setup is cancelled.

MSINext ( ) : void

Closes the dialog and sets the this.DialogResult to the 'DialogResult.OK' value ensuring the setup is resumed and the UI sequence advanced to the next step.

ShowAsMsiDialog ( WixCLRDialog dialog ) : ActionResult

Shows as specified managed dialog.

It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog at the same desktop location and with the same size as the parent.

It also ensures that after the managed dialog is closed the proper ActionResult is returned.

WixCLRDialog ( ) : System

Initializes a new instance of the WixCLRDialog class. This constructor is to be used by the Visual Studio Form designer only. You should always use WixCLRDialog(Session session) constructor instead.

WixCLRDialog ( Microsoft.Deployment.WindowsInstaller.Session session ) : System

Initializes a new instance of the WixCLRDialog class.

WixDialog_Load ( object sender, EventArgs e ) : void

Защищенные методы

Метод Описание
Init ( ) : void

Inits this instance.

ReplaceHost ( ) : void

'Replaces' the current step dialog with the "itself".

It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog (itself) at the same desktop location and with the same size as the parent.

RestoreHost ( ) : void

Restores parent native MSI dialog after the previous ReplaceHost call.

Приватные методы

Метод Описание
GetMsiForegroundWindow ( ) : IntPtr
WixPanel_FormClosed ( object sender, System.Windows.Forms.FormClosedEventArgs e ) : void
form_VisibleChanged ( object sender, EventArgs e ) : void

Описание методов

GetMSIBinaryStream() публичный Метод

Gets the embedded MSI binary stream.
public GetMSIBinaryStream ( string binaryId ) : Stream
binaryId string The binary id.
Результат Stream

Init() защищенный Метод

Inits this instance.
protected Init ( ) : void
Результат void

InitializeComponent() публичный Метод

public InitializeComponent ( ) : void
Результат void

MSIBack() публичный Метод

Closes the dialog and sets the this.DialogResult to the 'DialogResult.Retry' value ensuring the setup is resumed with the previous UI sequence dialog is displayed.
public MSIBack ( ) : void
Результат void

MSICancel() публичный Метод

Closes the dialog and sets the this.DialogResult to the 'DialogResult.Cancel' value ensuring the setup is cancelled.
public MSICancel ( ) : void
Результат void

MSINext() публичный Метод

Closes the dialog and sets the this.DialogResult to the 'DialogResult.OK' value ensuring the setup is resumed and the UI sequence advanced to the next step.
public MSINext ( ) : void
Результат void

ReplaceHost() защищенный Метод

'Replaces' the current step dialog with the "itself".

It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog (itself) at the same desktop location and with the same size as the parent.

protected ReplaceHost ( ) : void
Результат void

RestoreHost() защищенный Метод

Restores parent native MSI dialog after the previous ReplaceHost call.
protected RestoreHost ( ) : void
Результат void

ShowAsMsiDialog() публичный статический Метод

Shows as specified managed dialog.

It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog at the same desktop location and with the same size as the parent.

It also ensures that after the managed dialog is closed the proper ActionResult is returned.

public static ShowAsMsiDialog ( WixCLRDialog dialog ) : ActionResult
dialog WixCLRDialog The dialog.
Результат ActionResult

WixCLRDialog() публичный Метод

Initializes a new instance of the WixCLRDialog class. This constructor is to be used by the Visual Studio Form designer only. You should always use WixCLRDialog(Session session) constructor instead.
public WixCLRDialog ( ) : System
Результат System

WixCLRDialog() публичный Метод

Initializes a new instance of the WixCLRDialog class.
public WixCLRDialog ( Microsoft.Deployment.WindowsInstaller.Session session ) : System
session Microsoft.Deployment.WindowsInstaller.Session The session.
Результат System

WixDialog_Load() публичный Метод

public WixDialog_Load ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void

Описание свойств

delta защищенное свойство

There is some strange resizing artefact (at least on Win7) when MoveWindow does not resize the window accurately. Thus special adjustment ('delta') is needed to fix the problem.

The delta value is used in the ReplaceHost method.

protected int delta
Результат int

hostWindow защищенное свойство

The WIN32 handle to the host window (parent MSI dialog).
protected IntPtr,System hostWindow
Результат System.IntPtr

session публичное свойство

The MSI session
public Session,Microsoft.Deployment.WindowsInstaller session
Результат Microsoft.Deployment.WindowsInstaller.Session