Insert a CLR Dialog after Featuretree in WixFeatureTree UI set?

Apr 21, 2015 at 4:36 PM
I'm trying to insert a CLR Dialog after the feature tree in WixFeatureTree. I think the dialog's name is CustomizeDlg based on (http://wixtoolset.org/documentation/manual/v3/wixui/dialog_reference/wixui_dialogs.html).

so what i did is:
UI = WUI.Wix_FeatureTree;
project.InjectClrDialog("ShowDialogBox", "CustomizeDlg", Dialogs.VerifyReadyDlg);

However i'm getting an ICE17, Back is undefined or something for CustomizeDlg.

In any case, i just wanted to ask if this is even possible to inject?

Thanks

PS:
There is also a FeaturesDlg so i tried that but i get the same results
Apr 21, 2015 at 4:59 PM
BTW i can achieve this effect on Wix by doing the following: (I'm not a Wix expert so if this has something wrong in it, then i'm not sure but this works based on my testing)
<UIRef Id="WixUI_FeatureTree" />
    <UI >
      <Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="Action9_ShowDialogBox" Order="1">1</Publish>
      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2"> Custom_UI_Command = "next" </Publish>
      <Publish Dialog="CustomizeDlg" Control="Next" Event="EndDialog" Value="Exit" Order="2"> Custom_UI_Command = "abort" </Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="DoAction" Value="Action9_ShowDialogBox" Order="1">1</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="2"> Custom_UI_Command = "back" </Publish>
    </UI>
Of course the goal is for wix# to be able to perform this without resorting to editing the wxs file so i'm wondering if there is a simple way to do this for wix?

Thanks.
Coordinator
Apr 24, 2015 at 6:23 AM
Unfortunately you cannot use WixUI_FeatureTree. It seems like you have solved the problem with the code from your last email but is has very severe limitation: you cannot go Back correctly from your custom dialog. The reason is that WiX does not allow you to override the original Publish elements. You can only add another one. You can read more here. Thus you must use WixUI_Common as other UI type have predefined dialogs already linked between each other and you cannot break this link.

The InjectClrDialog is based on WixUI_Common with the all dialogs sequence defined from scratch. Though your problem was caused by the existing implementation not incuding the CustomDlg at all. The problem is corrected and in the next release you will be able to use the following code:
project.InjectClrDialog("ShowCustomDialog", Dialogs.CustomizeDlg, Dialogs.VerifyReadyDlg);
BTW in many cases you may find that it is more natural to define an explicit WixUI_Common sequence by yourself instead of injecting one. For example InjectClrDialog is defining the initial sequence (starting point for the injection) as follows:
public CommomDialogsUI()
{
    On(Dialogs.WelcomeDlg, Buttons.Next, new ShowDialog(Dialogs.LicenseAgreementDlg));

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

    On(Dialogs.InstallDirDlg, Buttons.Back, new ShowDialog(Dialogs.LicenseAgreementDlg));
    On(Dialogs.InstallDirDlg, Buttons.Next, new SetTargetPath(),
                                            new ShowDialog(Dialogs.CustomizeDlg));

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

    On(Dialogs.CustomizeDlg, Buttons.Back, new ShowDialog(Dialogs.InstallDirDlg));
    On(Dialogs.CustomizeDlg, Buttons.Next, new ShowDialog(Dialogs.VerifyReadyDlg));

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

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

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

    On(Dialogs.ExitDialog, Buttons.Finish, new CloseDialog() { Order = 9999 });
}
Apr 24, 2015 at 7:14 AM
Again i'm not an expert but my solution i was able to test my solution in post02 and i tested the buttons and they work as expected (i can push back on my custom form and go back and forth).

In any case, it would seem that i would need to simply just learn to make the entire UI chain for this
Coordinator
Apr 24, 2015 at 7:49 AM
Can you please test it again. Specifically:
  • Start the msi
  • When you have the custom dialog displayed for the first time click Back button.
  • I expect it to not to go back but to allow proceeding to the next dialog.
If indeed you it works perfectly then can you please simplify your sample (so I can run it) and share it with me. May be I am missing something and the whole dialog injection can be improved.
Txs
Apr 28, 2015 at 6:12 AM
Hi Oleg,

You are right there in your assessment. I may have missed that when testing when i reported the code above. in any case, i've already resolved my issues by creating a custom UI sequence instead of relying on the standard set.

Regards to your help and assistance!