51k
51k

Reputation: 1443

Wix Progress bar in UI sequence

Can I have a modeless progress bar in UI sequence and get it updated with the custom actions in the UI sequence?

This is the page I have created, the dialog is not getting displayed nor the custom actions are getting called. Is it possible to do this?

    <Fragment>
        <UI>
            <!-- Progress Text To dispaly Progress Message -->
            <ProgressText Action="CA_1">Doing task 1</ProgressText>
            <ProgressText Action="CA_2">Doing task 2</ProgressText>
            <ProgressText Action="CA_3">Doing task 3</ProgressText>

            <Dialog Id="MysqlInstProgressDlg" Width="447" Height="362" Title="Mysql Progress Dialog" NoMinimize="no" Modeless="yes">

                <Control Id="InstPrsTxt" Type="Text" X="67" Y="116" Width="372" Height="12" Transparent="yes">
                    <Text>{\FONT_DESC}</Text>
                    <Subscribe Event="ActionText" Attribute="Text"></Subscribe>
                </Control>
                <Control Id="InstPrgs" Type="ProgressBar" X="30" Y="136" Width="397" Height="17" ProgressBlocks="yes" Text="Progress done">
                    <Subscribe Event="SetProgress" Attribute="Progress" />
                </Control>
                <Control Id="DownloadBtn" Type="PushButton" X="292" Y="330" Width="66" Height="21" Default="yes">
                    <Text>{\FONT_DESC}Download</Text>
                    <Publish Event="DoAction" Value="CA_1" Order="1"><![CDATA[IS_SUCCEED = "true"]]></Publish>
                    <Publish Event="DoAction" Value="CA_2" Order="2"><![CDATA[IS_SUCCEED = "true"]]></Publish>
                    <Publish Event="DoAction" Value="CA_3" Order="3"><![CDATA[IS_SUCCEED = "true"]]></Publish>
                    <Publish Event="EndDialog" Value="Return" Order="4"><![CDATA[IS_SUCCEED = "true"]]></Publish>

                    <Publish Event="NewDialog" Value="ErrorDlg" Order="5"><![CDATA[(NOT Installed) AND IS_SUCCEED <> "true"]]></Publish>
                </Control>
                <Control Id="CancelBtn" Type="PushButton" Height="21" Width="66" X="368" Y="330" Cancel="yes" Default="yes">
                    <Text>{\FONT_DESC}Exit</Text>
                    <Publish Event="DoAction" Value="InstCancelConfirm_CA" Order="1"><![CDATA[1]]></Publish>
                    <Publish Event="NewDialog" Value="ErrorDlg" Order="2"><![CDATA[(NOT Installed) AND IS_INTERRUPTED = "true"]]></Publish>
                </Control>
            </Dialog>
        </UI>
    </Fragment>
</Wix>

UI Sequence:

    <InstallUISequence>
        <Show Dialog="InstWelcomeDlg2" Before="MysqlInstProgressDlg"><![CDATA[NOT Installed]]></Show>
        <Show Dialog="MysqlInstProgressDlg" Before="ExecuteAction"><![CDATA[NOT Installed]]></Show>
    </InstallUISequence>

Upvotes: 0

Views: 1722

Answers (1)

PhilDW
PhilDW

Reputation: 20780

Managing progress in a Windows Installer install is done in the InstallExecuteSequence, and that's where you can hook into it with this kind of MsiProcessMessage () activity:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa367525(v=vs.85).aspx

where you send INSTALLMESSAGE_PROGRESS messages.

It works this way because there is generally no need for progress or long running custom actions in the UI sequence:

  1. The system should not be changed during the UI sequence because the install can later fail or be canceled, leaving the system changed.
  2. A silent install does not call the UI sequence.
  3. Prerequisites should be installed with a bootstrapper (one of your custom actions seems to be installing SQL).
  4. Actions like populating a database or other configuration are often best done when the app first runs after the install where you are free from the constraints of custom actions, can run in a normal user environment, and more easily re-run if there are issues or more configuration later.

So if you have prerequisites use a bootstrapper, and if you are changing the system put those changes in the execute sequence as deferred custom actions where they can report progress and be undone (with rollback custom actions) if the install fails or is canceled. The short answer is that you can'r get a progress bar like that in the UI sequence.

Upvotes: 1

Related Questions