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
파일 보기 프로젝트 열기: Eun/WixSharp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
session Microsoft.Deployment.WindowsInstaller.Session

보호된 프로퍼티들

프로퍼티 타입 설명
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