Defines custom UI (WiX UI element). This class is to be used to define the customization of the standard MSI UI. The usual scenario of the customization is the injection of the custom T:WixSharp.Dialog into the sequence of the standard dialogs. This can be accomplished by defining the custom dialog as T:WixSharp.WixForm. Such a T:WixSharp.WixForm can be edited with the Visual Studio form designer.

When T:WixSharp.WixForm is complete it can be converted into T:WixSharp.Dialog with the T:WixSharp.Dialog.ToWDialog() call. And at compile time Wix# compiler converts T:WixSharp.Dialog into the final WiX UI element XML definition.

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

project.UI = WUI.WixUI_Common; project.CustomUI = CustomUIBuilder.BuildPostLicenseDialogUI(productActivationDialog, onNextActions: new DialogAction[]{ new ExecueteCustomAction ("ValidateLicenceKey"), new ShowDialog(Dialogs.InstallDirDlg, "SERIALNUMBER_VALIDATED = \"TRUE\"")});
Наследование: WixEntity
Пример #1
0
        /// <summary>
        /// Builds <see cref="T:WixSharp.CustomUI"/> instance and injects <see cref="T:WixSharp.Dialog"/> into the standard UI sequence
        /// just after <c>LicenceDialog</c> step.
        /// </summary>
        /// <param name="customDialog">The <see cref="T:WixSharp.Dialog"/> dialog to be injected.</param>
        /// <param name="onNextActions">The on next actions.</param>
        /// <param name="onBackActions">The on back actions.</param>
        /// <param name="onCancelActions">The on cancel actions.</param>
        /// <returns><see cref="T:WixSharp.CustomUI"/> instance.</returns>
        public static CustomUI BuildPostLicenseDialogUI(Dialog customDialog,
                                                        DialogAction[] onNextActions   = null,
                                                        DialogAction[] onBackActions   = null,
                                                        DialogAction[] onCancelActions = null)
        {
            var customUI = new CustomUI();

            customUI.CustomDialogs.Add(customDialog);

            customUI.On(NativeDialogs.ExitDialog, Buttons.Finish, new CloseDialog()
            {
                Order = 9999
            });

            customUI.On(NativeDialogs.WelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.LicenseAgreementDlg));

            customUI.On(NativeDialogs.LicenseAgreementDlg, Buttons.Back, new ShowDialog(NativeDialogs.WelcomeDlg));
            customUI.On(NativeDialogs.LicenseAgreementDlg, Buttons.Next, new ShowDialog(customDialog, "LicenseAccepted = \"1\""));

            customUI.On(customDialog, Buttons.Back, onBackActions ?? new DialogAction[] { new ShowDialog(NativeDialogs.LicenseAgreementDlg) });
            customUI.On(customDialog, Buttons.Next, onNextActions ?? new DialogAction[] { new ShowDialog(NativeDialogs.InstallDirDlg) });
            customUI.On(customDialog, Buttons.Cancel, onCancelActions ?? new DialogAction[] { new CloseDialog("Exit") });

            customUI.On(NativeDialogs.InstallDirDlg, Buttons.Back, new ShowDialog(customDialog));
            customUI.On(NativeDialogs.InstallDirDlg, Buttons.Next, new SetTargetPath(),
                        new ShowDialog(NativeDialogs.VerifyReadyDlg));

            customUI.On(NativeDialogs.InstallDirDlg, Buttons.ChangeFolder,
                        new SetProperty("_BrowseProperty", "[WIXUI_INSTALLDIR]"),
                        new ShowDialog(CommonDialogs.BrowseDlg));

            customUI.On(NativeDialogs.VerifyReadyDlg, Buttons.Back, new ShowDialog(NativeDialogs.InstallDirDlg, Condition.NOT_Installed),
                        new ShowDialog(NativeDialogs.MaintenanceTypeDlg, Condition.Installed));

            customUI.On(NativeDialogs.MaintenanceWelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.MaintenanceTypeDlg));

            customUI.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Back, new ShowDialog(NativeDialogs.MaintenanceWelcomeDlg));
            customUI.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Repair, new ShowDialog(NativeDialogs.VerifyReadyDlg));
            customUI.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Remove, new ShowDialog(NativeDialogs.VerifyReadyDlg));

            return(customUI);
        }
Пример #2
0
        /// <summary>
        /// Builds <see cref="T:WixSharp.CustomUI"/> instance and injects <see cref="T:WixSharp.Dialog"/> into the standard UI sequence 
        /// just after <c>LicenceDialog</c> step. 
        /// </summary>
        /// <param name="customDialog">The <see cref="T:WixSharp.Dialog"/> dialog to be injected.</param>
        /// <param name="onNextActions">The on next actions.</param>
        /// <param name="onBackActions">The on back actions.</param>
        /// <param name="onCancelActions">The on cancel actions.</param>
        /// <returns><see cref="T:WixSharp.CustomUI"/> instance.</returns>
        public static CustomUI BuildPostLicenseDialogUI(Dialog customDialog,
            DialogAction[] onNextActions = null,
            DialogAction[] onBackActions = null,
            DialogAction[] onCancelActions = null)
        {
            var customUI = new CustomUI();

            customUI.CustomDialogs.Add(customDialog);

            customUI.On(NativeDialogs.ExitDialog, Buttons.Finish, new CloseDialog() { Order = 9999 });

            customUI.On(NativeDialogs.WelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.LicenseAgreementDlg));

            customUI.On(NativeDialogs.LicenseAgreementDlg, Buttons.Back, new ShowDialog(NativeDialogs.WelcomeDlg));
            customUI.On(NativeDialogs.LicenseAgreementDlg, Buttons.Next, new ShowDialog(customDialog, "LicenseAccepted = \"1\""));

            customUI.On(customDialog, Buttons.Back, onBackActions ?? new DialogAction[] { new ShowDialog(NativeDialogs.LicenseAgreementDlg) });
            customUI.On(customDialog, Buttons.Next, onNextActions ?? new DialogAction[] { new ShowDialog(NativeDialogs.InstallDirDlg) });
            customUI.On(customDialog, Buttons.Cancel, onCancelActions ?? new DialogAction[] { new CloseDialog("Exit") });

            customUI.On(NativeDialogs.InstallDirDlg, Buttons.Back, new ShowDialog(customDialog));
            customUI.On(NativeDialogs.InstallDirDlg, Buttons.Next, new SetTargetPath(),
                                                             new ShowDialog(NativeDialogs.VerifyReadyDlg));

            customUI.On(NativeDialogs.InstallDirDlg, Buttons.ChangeFolder,
                                                             new SetProperty("_BrowseProperty", "[WIXUI_INSTALLDIR]"),
                                                             new ShowDialog(CommonDialogs.BrowseDlg));

            customUI.On(NativeDialogs.VerifyReadyDlg, Buttons.Back, new ShowDialog(NativeDialogs.InstallDirDlg, Condition.NOT_Installed),
                                                              new ShowDialog(NativeDialogs.MaintenanceTypeDlg, Condition.Installed));

            customUI.On(NativeDialogs.MaintenanceWelcomeDlg, Buttons.Next, new ShowDialog(NativeDialogs.MaintenanceTypeDlg));

            customUI.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Back, new ShowDialog(NativeDialogs.MaintenanceWelcomeDlg));
            customUI.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Repair, new ShowDialog(NativeDialogs.VerifyReadyDlg));
            customUI.On(NativeDialogs.MaintenanceTypeDlg, Buttons.Remove, new ShowDialog(NativeDialogs.VerifyReadyDlg));

            return customUI;
        }