Skip to content

AppState Class

Richard Martin edited this page Mar 25, 2024 · 2 revisions

Bootstrapper.Models.State.AppState

This class provides thread safe access to the BA's shared state. While the properties are safe to access and update from any thread, this class doesn't provide atomicity. The solution you're walking through doesn't need to perform atomic operations against the state. However, if you have the need to do so in your bundle, I suggest locking the model's State property when accessing its members like this.

lock (model.State)
{
    // perform atomic operations
}

If you do this, you'd also want to remove the code from the AppState properties because thread safety would no longer be needed.

Bundle property

During the build of a bundle, WiX generates a file containing metadata about the packages included in the bundle. This file is named BootstrapperApplicationData.xml and packed into the bundle.

The BootstrapperApplicationData class reads BootstrapperApplicationData.xml and populates its Bundle property from data found in the file.

Bundle = new BootstrapperApplicationData().Bundle;

We're exposing this data in the model's Bundle property. This property contains information about the packages in the bundle. During the install, you're often supplied with a package ID. You can use the Bundle property to look up info about the package.

Previous: WpfFacade Class || Next: Phases Overview

Clone this wiki locally