Скачать проект
Сначала выполнить CustomAction, который что-то сделает и обновит значения некоторых свойств. Далее мы открываем новое окно и там отображаются эти изменённые новые значения.
У меня сейчас работает только одно действие, хоть я и задаю элементам Publish значение свойства Order.
Сейчас у меня выполняется только одной действие. Хоть я и задаю
Попытался я вызвать это дело так (полный код ниже, это часть оттуда):
<Publish Dialog="SettingsDlg" Control="Next" Event="DoAction" Value="DoMethodAction2" Order="1" />
<Publish Dialog="SettingsDlg" Control="Next" Event="NewDialog" Value="SettingsPreviewDlg" Order="2"/>
<Publish Dialog="SettingsDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg"/>
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="84423910-e6e4-4c4c-b67c-2703e0e6f098"
Name="AppForTest_WixInstaller"
Language="1049"
Codepage="1251"
Version="1.1.0.0"
Manufacturer="Home"
UpgradeCode="df124175-ebea-4d00-9469-3b8fc4dd3397">
<Package SummaryCodepage="1251" Description="Пакет установки 1" Manufacturer="Производитель программы установки" Comments="Комментарии к программе установки"
InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<!-- Feature - Именованные наборы компонентов -->
<Feature Id="ProductFeature" Title="SimpleSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<!-- Интерфейс пользователя -->
<UI Id="WixUI_MondoId">
<UIRef Id="WixUI_CustomTest" />
<UIRef Id="WixUI_ErrorProgressText" />
</UI>
<Property Id="ResultFrom_DoMethodAction1" Value="{}"/>
<Property Id="ResultFrom_DoMethodAction2" Value="{}"/>
<!-- Локальные - IP адрес и порт -->
<Property Id="LOCAL_ENDPOINT_IP" Value="127.0.0.1"/>
<Property Id="LOCAL_ENDPOINT_PORT" Value="4013"/>
<CustomAction Id="SetDefferedActionData" Property="DoMethodAction1" Value="parameter=555" />
<CustomAction Id="DoMethodAction1" BinaryKey="CustomActionsDll" DllEntry="Action1" Execute="deferred" />
<CustomAction Id="DoMethodAction2" BinaryKey="CustomActionsDll" DllEntry="Action2" Execute="immediate" />
<InstallExecuteSequence >
<Custom Before="InstallFiles" Action="SetDefferedActionData" >NOT Installed AND NOT PATCH</Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Binary Id="CustomActionsDll"
SourceFile="$(var.CustomActions.TargetDir)CustomActions.CA.dll" />
</Fragment>
<?xml version="1.0" encoding="UTF-8"?>
<!--
First-time install dialog sequence:
- WixUI_WelcomeDlg
- WixUI_LicenseAgreementDlg
- WixUI_CustomizeDlg
- WixUI_VerifyReadyDlg
- WixUI_DiskCostDlg
Maintenance dialog sequence:
- WixUI_MaintenanceWelcomeDlg
- WixUI_MaintenanceTypeDlg
- WixUI_CustomizeDlg
- WixUI_VerifyReadyDlg
Patch dialog sequence:
- WixUI_WelcomeDlg
- WixUI_VerifyReadyDlg
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="WixUI_CustomTest">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="FeatureTree" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish>
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">NOT Installed</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SettingsDlg">1</Publish>
<Publish Dialog="SettingsDlg" Control="Next" Event="DoAction" Value="DoMethodAction2" Order="1" />
<Publish Dialog="SettingsDlg" Control="Next" Event="NewDialog" Value="SettingsPreviewDlg" Order="2"/>
<Publish Dialog="SettingsDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg"/>
<Publish Dialog="SettingsPreviewDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"/>
<Publish Dialog="SettingsPreviewDlg" Control="Back" Event="NewDialog" Value="SettingsDlg"/>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SettingsDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>
using System;
using System.Reflection;
using WixToolset.Dtf.WindowsInstaller;
namespace CustomActions
{
public class CustomActions
{
[CustomAction]
public static ActionResult Action1(Session session)
{
string methodName = MethodBase.GetCurrentMethod().Name;
session.Log("Begin " + methodName);
session["ResultFrom_DoMethodAction1"] = "Результат из CustomActions." + methodName;
session.Log("End " + methodName);
TextFile.Write("CustomActions." + methodName + " выполнен.");
return ActionResult.Success;
}
[CustomAction]
public static ActionResult Action2(Session session)
{
string methodName = MethodBase.GetCurrentMethod().Name;
string text = string.Format("{0}Значение из LOCAL_ENDPOINT_IP: {1};{0}Значение из LOCAL_ENDPOINT_PORT: {2};",
Environment.NewLine, session["LOCAL_ENDPOINT_IP"], session["LOCAL_ENDPOINT_PORT"]);
TextFile.Write(text);
session.Log("Begin " + methodName);
session["ResultFrom_DoMethodAction2"] = "Результат из CustomActions." + methodName;
session["LOCAL_ENDPOINT_IP"] = "192.168.1.1";
session["LOCAL_ENDPOINT_PORT"] = "1234";
session.Log("End " + methodName);
TextFile.Write("CustomActions." + methodName + " выполнен.");
return ActionResult.Success;
}
}
}