PNR Viewer Content
Note: The information in this topic does not add content to the actual PNR. Rather, this topic describes how to add content to the PNR viewer area of the Smartpoint screen.
Using the PNRHelper, you can add content to the PNR viewer area of the Smartpoint screen using your own custom sections.
In the following example, when a booking file is displayed, a button is added to the PNR viewer. This button injects a PNRSection into the PNR viewer and displays a browser window open to a specific page.
- Hook to the PNRHelper "OnBookingFileDisplayed" event.
-
In the event handler, create the button to add content to the PNR viewer.
Code for Travelport Smartpoint version 7.2 and abovevoid Instance_OnBookingFileDisplayed(object sender, BookingFileDisplayedEventArgs e) { if (e.BookingFile != null) { if (e.BookingFile.Segments.Count > 0) { try { //Travelport.Smartpoint.Properties.Settings.Default.showSingleViewMode = false; var Btn = new NPnrButton(Travelport.TravelData.Gds.Galileo, "SampleID", "SampleCommand", "SampleToolTip", 40); var vm = new PnrSectionModel(Btn, PnrHelper.Instance.CurrentPnrViewerControl.BookingFile, Travelport.TravelData.Gds.Galileo); var inline = new InlineUIContainer(); var SampleView = new Views.RetrievePNRView(); var SampleViewModel = new ViewModels.RetrievePNRViewModel(); SampleView.DataContext = SampleViewModel; var sp = new Span(); sp.Inlines.Add(SampleView); vm.PnrSpanControl = sp; vm.PnrButtonIsChecked = true; PnrHelper.Instance.AddPnrSectionButton(vm, UIHelper.Instance.CurrentTEControl.Connection); } catch (Exception Err) { UIHelper.Instance.ShowMessageBox(Err.Message); } } } }
For Travelport Smartpoint version 7.2 and above, a control inheriting from PnrButtonBase is required to create a PnrSection.
class NPnrButton :PnrButtonBase { public NPnrButton(Gds gds, string id, string command, string tooltip, int position) : base(gds,id,command,tooltip,position) { } public NPnrButton(Gds gds, string id, string command, string tooltip, int position, ICommandTranslator translator) : base(gds, id, command, tooltip,position,translator) { } public override void Submit(BookingFile bookingFileProperty, Span span) { //UIHelper.Instance.ShowMessageBox("Test"); } public override bool CanBeShown(BookingFile bookingFileProperty, Gds gds) { return true; } /// Display by default public override bool? IsDetailShownByDefault() { return true; } }
Code for Travelport Smartpoint version 7.1 and belowvoid Instance_OnBookingFileDisplayed(object sender, BookingFileDisplayedEventArgs e) { if (e.BookingFile != null) { if (e.BookingFile.Segments.Count > 0) { PnrSectionModel vm; string desc; string tooltip; desc = "#UI"; tooltip = "User Interface with View"; vm = new PnrSectionModel(); vm.CommandButtonText = desc; vm.CommandButtonTooltip = tooltip; vm.CommandButtonId = desc; vm.PnrControlVisible = true; /// Display by default vm.PnrSpanControl = new Span(); vm.CurrentPnrVM = e.ViewModel; var OurAppWindow = new Views.RetrievePNRView(); // This view can be found in the Travelport Smartpoint template var OurAppViewModel = new ViewModels.RetrievePNRViewModel(); // This viewmodel can be found in the Travelport Samtpoint template OurAppWindow.DataContext = OurAppViewModel; var inline = new InlineUIContainer(); inline.Child = OurAppWindow; var sp = new Span(); sp.Inlines.Add(inline); vm.PnrSpanControl = sp; PnrHelper.Instance.AddPnrSectionButton(vm, e.Connection); } } }