[wix-users] Creating a Multi-page Custom Bootstrapper UI

Bryan Dam bryand at recastsoftware.com
Mon Aug 16 18:21:21 PDT 2021

Our UI event handlers are all in the current page's VM.  The BootstrapperApplication event handlers are hooked up in our Run() call.

From: B Rizzy <liquidair156 at yahoo.com>
Sent: Monday, August 16, 2021 4:31 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>; Bryan Dam <bryand at recastsoftware.com>
Subject: Re: [wix-users] Creating a Multi-page Custom Bootstrapper UI

Thank you for the response, Bryan! I figured out that part of my confusion was that I had mocked up the UI and it's view models while set as the startup project(to test the UI logic), so any attempt to make the bootstrapper view model global was failing because the Run() method was never the entry point of the application like it would normally be. Whoops!! I declared the model as 'static' like the Dispatcher so it could be accessed anywhere and it looks like that might work. The only issue so far is that I can't seem to access the State's propertyChanged event, which would be relevant while installing. But since the whole installation process should occur on a single page, I think I can handle this locally and update the global State when the event handlers change the local state (instead of vice-versa).

It's good to know that option B is viable! Is the 'bootstrapper view model' where you put the event handlers in yours? I think that was tripping me up originally; if we wire up and handle the events in the boot VM, then for the currentPage VM to know when things fired, we'd need to subscribe to the events locally? Or would we wire up the events in boot VM, then handle them locally? My concern was the potential to miss an event if it occurred while a page was active that didn't handle it, but I don't think that will happen here. If I understand this right, DetectPackageComplete will occur before the View is shown (so it can decide whether to show the install or uninstall dialog), and the Plan, Apply and Progress should all occur on the actual install/uninstall page. Is that correct?

Thanks again, I appreciate it!!!

On Monday, August 16, 2021, 08:49:37 AM CDT, Bryan Dam <bryand at recastsoftware.com<mailto:bryand at recastsoftware.com>> wrote:

FWIW: I went with option B in mine. Each wizard pane has its own view model to handle any UI logic but there's a shared bootstrapper view model that is sent in the constructor to each.  That shared view model doesn't hold any data; it just acts as a wrapper around Bootstrapper.Engine's variable and logging calls.

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>> On Behalf Of B Rizzy via wix-users
Sent: Friday, August 13, 2021 10:00 PM
To: wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>
Cc: B Rizzy <liquidair156 at yahoo.com<mailto:liquidair156 at yahoo.com>>
Subject: [wix-users] Creating a Multi-page Custom Bootstrapper UI

Hi All,

I've spent the better part of a month now learning WiX to create a custom installer with WPF. I've been using these wonderful tutorials as a guide:

Custom WiX Managed Bootstrapper Application Part 1 of Writing Your Own .Net-based Installer with WiX - Overview - Musing, Rants & Jumbled Thoughts of John M. Wright

Grow from a Newbie to Pro in Creating Installers | Syncfusion Blogs

However, I've ground to a halt in my progress and exhausted Google. These tutorials all use a single view and viewModel whereas I want to create something more traditional: Intro page -> License -> Install Location -> Install with progress, etc. And that seems to be the big trick. This seemingly requires the single viewModel to be split up into page-specific viewModels. For instance, the uninstall command belongs in the uninstall VM, the progress properties and event handlers belong on the Install VM, etc. But then certain data (the model and InstallState) appear to need to be passed from VM to VM. Or, we can have the single viewModel be global so each page can get the data it needs at the time.
I'm really struggling on how to actually make this work (self-taught C#/WPF) and was wondering if anyone had some pointers as to a/the correct approach? The only things I can think to do are:

a) Keep everything on a single page like the tuts and simulate multiple pages by having all views on a single page and showing/hiding the relevant elements as needed.
b) just keep passing the "WixViewModel" via the constructors from view1 to view2, to viewModel2, then from view2 to view3 to viewModel3, etc.
I'm confident I could get both the above working but that would be smelly, smelly code. Any better suggestions?

And my apologies if I'm not clear; I don't always have the language to describe the problem but I am happy to clarify.

Thank you all for your help!!


WiX Toolset Users Mailing List provided by FireGiant https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.firegiant.com%2F&data=04%7C01%7Cbryand%40recastsoftware.com%7Ce45d48201b8b487a7daa08d95ec74ccb%7C9315bb44634846c6bd378880b87e774e%7C0%7C0%7C637645032361448463%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2FtIertPjKPaHO%2BGG4Vi%2BAYKoK%2BDgYxGyNLhDnUDX4cg%3D&reserved=0<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.firegiant.com%2F&data=04%7C01%7Cbryand%40recastsoftware.com%7C3ed8e0deb67b4d362bc308d960f5048d%7C9315bb44634846c6bd378880b87e774e%7C0%7C0%7C637647427733547038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MLr%2B7hMJo3tFyUGqC4WKWGvUuIrp2E74vL3KFB3DZYc%3D&reserved=0>

More information about the wix-users mailing list