When Pressed

Runs whenever the button is pressed

Any modules should be loaded when the button is loaded


When Released

Runs whenever the button is released


When Loaded

Runs whenever the button is loaded.

This is where any PowerShell modules should be imported, and any state should be set up (for instance, discovering devices)


When Unloaded

Runs whenever the button is loaded.

This is where any state should be cleaned up. Unloading modules is not recommended due to the potential of another button using the same module.