ManagedUI sequence modify at runtime

Oct 6, 2015 at 12:41 PM
Hi Oleg, I'm just wondering what is the correct way of modifying a sequence of managed dialogs while installation process - should I place all show/hide logic into my custom dialog class or there are some compile time project properties and conditions I can set? For native dialogs there are some examples provided but not for managed setup.
Example: I have a managed project with 2 features, one of them is sql database installation. So there's a custom dialog where user can input sql server settings to connect to. If user chooses not to install the DB, corresponding dialog should not be displayed (skipped).
Coordinator
Oct 7, 2015 at 3:47 AM
You don't have to rely on the MSI Conditions model any more. This is where C# makes it so much easier. In the Load event handler of your custom dialog just navigate to the next dialog if user disabled the DB installation:
if (!<DB-to-be-installed>) //you can detect feature being selected by analyzing MsiRuntime.Session
{
    Shell.GoNext();
}
else
{
    banner.Image = MsiRuntime.Session.GetEmbeddedBitmap("WixUI_Bmp_Banner");
    ...
}
Alternatively, if you customize FeaturesDialog and include its source in the project, you can jump over the custom DBSettingsDialog in the FeatruresDialog.next_Click handler:
void next_Click(object sender, EventArgs e)
{
    int progressDlg = Shell.Dialogs.ToList().IndexOf(typeof(ProgressDialog));
    Shell.Go(progressDlg);
}
BTW the next release will have a single-hit version of Shell.Go and new Session extension IsFeatureEnabled:
if (!MsiRuntime.Session.IsFeatureEnabled("Database"))
{
    Shell.Go<ProgressDialog>();
}
Oct 7, 2015 at 7:58 PM
Thanks a lot for detailed examples! So implementation seems to be pretty straightforward :)