Switching modules - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

If necessary, you can raise an event so that you can automatically jump to a different module. This is done by using the SPFSwitchModules event.

Me.EventAggregator.GetEvent(Of SPFSwitchModules).Publish(New SPFSwitchModules() With {.ModuleName = "SPFClientModule", .CallingModuleName = "SPFCustomModule", .Arguments = Nothing})

This example code shows a jump from the SPFCustomModule to the SPFClientModule. The arguments allow you to pass commands from the calling module to the destination module.

You must have implemented the code on the other destination module to act on these arguments.

To receive these arguments, as well as the name of the calling module so that you can jump back, you must subscribe to the SPFSwitchedModule event in the client view model of the destination module.

Me.EventAggregator.GetEvent(Of SPFSwitchedModules).Subscribe(Sub(e) SwitchedModuleHandler(e.ReturnModuleName, e.Arguments), False)

The delegate method of the switched module is fired when you switch to this module and returns the module name and any arguments.