The onlineStatusChanged event fires immediately after Fusion goes online or offline. This event fires whether or not the online status was changed deliberately by the user by using the Fusion 'Work Offline' command or because of inadvertent network/Internet connectivity issues. You can get the isOffline property of ApplicationEventArgs to determine whether Fusion has gone Offline or has come back online. The client can add or remove ApplicationEventHandlers from the ApplicationEvent.
-------- Import ---------
-------- Global variables ---------
-------- Connect the handler to the event. ---------
-------- Event handler function definition ---------
|
-------- Global variables ---------
-------- Connect the handler to the event. ---------
-------- Event handler class definition ---------
|
--------- Required include files. ---------
--------- Event handler class definition and global declaration. ---------
class MyOnlineStatusChangedEventHandler : public adsk::core::ApplicationEventHandler { public: void notify(const Ptr<ApplicationEventArgs>& eventArgs) override { // Code to react to the event. ui->messageBox("In MyOnlineStatusChangedEventHandler event handler."); } } _onlineStatusChanged; --------- Connect the handler to the event. ---------
|
Name | Description |
Application Event API Sample | Add-In that demonstrates application events. To use this sample, create a new folder using the name you want to use for the new add-in. Inside the folder, create a new file that is the same name as the folder but has a .py extension. Copy the code below into the .py file. Create another file that is the same name as the folder but has a .manifest extension and copy the JSON data below into that file. { "autodeskProduct": "Fusion360", "type": "addin", "author": "", "description": { "": "" }, "supportedOS": "windows|mac", "editEnabled": true } Run the "Scripts and Add-Ins" command and click the green plus button near the top of the dialog. Browse to the location where you created the folder and select the folder. The add-in should now be displayed in the list of add-ins on the "Add-Ins" tab of the dialog. Select the add-in and click the "Run" button. This will load the add-in and when any of the application events occurr that it is watching for it will report them in the TEXT COMMAND window. |