コード例 #1
0
ファイル: CustomUI.cs プロジェクト: denis-peshkov/WixSharp
        /// <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(Dialogs.ExitDialog, Buttons.Finish, new CloseDialog() { Order = 9999 });

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

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

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

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

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

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

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

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

            return customUI;
        }
コード例 #2
0
ファイル: WixForm.cs プロジェクト: denis-peshkov/WixSharp
        /// <summary>
        /// Converts the WixForm (WinForm) instance into WiX custom UI control WixSharp.<see cref="T:WixSharp.Dialog"/>.
        /// </summary>
        /// <returns>WixSharp.<see cref="T:WixSharp.Dialog"/> instance.</returns>
        public Dialog ToWDialog()
        {
            var wDialog = new Dialog
            {
                Height = this.ClientRectangle.Size.Height.WScale(),
                Width = this.ClientRectangle.Size.Width.WScale(),
                AttributesDefinition = this.WixAttributes,
                Title = this.Text
            };

            foreach (var control in this.Controls)
                if (control is IWixControl)
                {
                    if (control is WixButton)
                    {
                        var button = control as WixButton;

                        this.dialogActions.Clear();

                        button.Actions.Clear();

                        button.PerformClick();
                        button.Actions.AddRange(this.dialogActions);
                    }
                }

            wDialog.Name = this.Name.IsNullOrEmpty() ? "Dialog" : this.Name;

            if (!this.Id.IsNullOrEmpty())
                wDialog.Id = this.Id;

            var wControls = new List<WixSharp.Control>();

            foreach (var item in this.Controls)
                if (item is IWixControl)
                    wControls.Add((item as IWixControl).ToWControl());

            wDialog.Controls = wControls.ToArray();

            return wDialog;
        }
コード例 #3
0
ファイル: CustomUI.cs プロジェクト: denis-peshkov/WixSharp
 /// <summary>
 /// Defines the <see cref="T:WixSharp.Dialog" /> UI control Action (event handler).
 /// <code>
 /// customUI.On(activationDialog, Buttons.Cancel, new CloseDialog("Exit"));
 /// </code>
 /// </summary>
 /// <param name="dialog">The dialog.</param>
 /// <param name="control">The control.</param>
 /// <param name="handlers">The handlers.</param>
 /// <returns></returns>
 public CustomUI On(Dialog dialog, string control, params DialogAction[] handlers)
 {
     return On(dialog.Id, control, handlers);
 }