Sample Plug-in

This sample creates a weather app that displays the weather forecast in two ways:

  • Display the 7-day weather forecast for the cities in the current itinerary.
  • Display the weather forecast for London from the terminal entry #WEATHER <city name>.

To create this plug-in from scratch,

  1. Create a new project in Visual Studio. Use a Smartpoint SDK template or create a project from scratch or use the Smartpoint SDK template.

  2. Create and set up a plug-in class.

  3. Add the SmartPointPlugin class attribute to define the developer and GUID (globally unique identifier). The GUID is essential if you plan on distributing your plug-in through Marketplace, as it will be used as the license. The GUID displayed on the classifications page is the value that should be used. If you are building a plug-in for use within your agency or do not plan on distributing your plug-in through Marketplace, we recommend creating a GUID through Microsoft Visual Studio (Tools > Create GUID option in the menu) and embedding the GUID in your code now. We will be adding functionality within Marketplace in early 2016 and will be asking you to ‘register’ your plug-in(s) with Marketplace by entering a few pieces of information. Once we turn on our validation, any plug-in that is not recognized by Smartpoint (via the integration with Smartpoint) will not load.

  4. Within Execute, subscribe to OnSmartpointReady, which guarantees that certain Smartpoint infrastructure is in place. OnSmartpointReady is where you can add business logic.

  5. OnSmartpointReadyHandler defines the events and initializes the weather pop-up. It also subscribes to OnTerminalPresend and OnBookingFileDisplayed events.

    • OnTerminalPresend event occurs anytime a user presses the Enter key.
    • OnBookingFileDisplayed event occurs when the PNR viewer is refreshed (i.e., new booking file, changed booking file, retrieved booking file, booking file refresh, or end transact).
  6. Display weather according to method used.

  7. Activate test harness mode in Smartpoint and attach Visual Studio's debugger to Smartpoint so that you can test your code. Refer to Testing for more information.