1

如果 CustomAction 中显示任何错误,我可以停止设置吗?因为我可以在自定义操作中显示错误消息,它会显示错误消息,但是一旦我点击确定按钮,我的下一个 UI 序列表单就会出现。我将如何强制用户完成按钮?

添加我的源代码:

<Binary Id="BIN_CustomAction" SourceFile="CustomAction.CA.dll" />
        <CustomAction Id="CA_CheckList" BinaryKey="BIN_CustomAction" DllEntry="CA_CheckList" Execute="immediate" Impersonate="yes" Return="ignore" />

       <UI Id="MyWixUI_Mondo">
            <UIRef Id="WixUI_Mondo" />
            <UIRef Id="WixUI_ErrorProgressText" />
            <DialogRef Id="UserRegistrationDlg" />
            <Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">

                <Control Id="ComboBoxMain" Type="ComboBox" X="124" Y="158" Width="241" Height="16" Property="LOCATIONNAME">
                </Control>
                <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
                    <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
                </Control>


                <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
                    <Publish Event="SpawnDialog" Value="SetupTypeDlg">1</Publish>
                </Control>
                <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
                    <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
                </Control>

            </Dialog>

            <Control Id="Next" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;NExt">
              <Publish Event="DoAction" Value="RadioButtonCheck">1</Publish>
            </Control>
          </Dialog>-->
            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="UserRegistrationDlg" Order="3">
        LicenseAccepted = "1" 
      </Publish>
            <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="UserRegistrationDlg">1</Publish>
        </UI>
        <InstallUISequence>
            <Custom Action="CA_CheckList" Before="AppSearch">Not Installed</Custom>
        </InstallUISequence>

         [CustomAction]
        public static ActionResult CA_CheckList(Session session)
        {


            if (installer.ListStatus == false) 
            {

                // dispaly
                Record record = new Record();
                record.FormatString = string.Format("Error!");

                session.Message(
                   InstallMessage.Error | (InstallMessage)(MessageIcon.Error) |
                   (InstallMessage)MessageButtons.OK,record);

                return  ActionResult.Failure;   

            }
            else
            {
              return  ActionResult.Success;
            }



        }

添加屏幕截图也证明一旦我单击图像(1)的确定按钮,我的下一个对话框即图像(2)正在出现:- 当我收到错误时,我需要的是完成对话框。

1)出现错误信息

2)下一个对话框

Any idea??kindly help me.
4

2 回答 2

3

这是一篇旧帖子,但我想回答这个问题,以防其他人发现这个问题。在自定义操作定义中,CustomAction Id="CA_CheckList" BinaryKey="BIN_CustomAction" ..., 'Return' 设置为 'ignore'。它应该设置为“检查”。

于 2015-03-17T20:01:24.873 回答
2

这一切都是为了从自定义操作中返回正确的“错误代码”。如果您想终止安装,ActionResult.Failure请从您的 CA返回。

旁注:从自定义操作内部显示 UI 通常是一个坏主意 - 这种情况不支持应采用的静默安装方式。

于 2013-07-01T10:45:20.773 回答