public static DarwinDepartureBoard GetGetEntireBoard(string crs, int offset, int window) { try { LDBServiceSoapClient client = new LDBServiceSoapClient(); StationBoardWithDetails board = null; using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) { MessageHeader authHeader = MessageHeader.CreateHeader("AccessToken", @"http://thalesgroup.com/RTTI/2013-11-28/Token/types", DarwinToken.TheAccessToken); OperationContext.Current.OutgoingMessageHeaders.Add(authHeader); //Note that this is called on a background thread - I don't need to make it async. Doing so causes a range of exciting race hazards further on GetDepBoardWithDetailsResponse response = client.GetDepBoardWithDetailsAsync(0, crs, string.Empty, FilterType.from, offset, window).Result; board = (StationBoardWithDetails)response.GetStationBoardResult; } return(DarwinDepartureBoardFactory.CreateDepartureBoard(board)); } catch (AggregateException ae) { crashDump(ae); return(null); } catch (System.Runtime.InteropServices.SEHException seh) { crashDump(seh); return(null); } }
public static DarwinDepartureBoard CreateDepartureBoard(StationBoardWithDetails webserviceStationBoard) { List <string> nrccMsgs = createMessageList(webserviceStationBoard.nrccMessages); DarwinDepartureBoard departureBoard = new DarwinDepartureBoard(nrccMsgs, webserviceStationBoard.platformAvailable, webserviceStationBoard.areServicesAvailable); List <DarwinService> railServices = createRailServices(webserviceStationBoard.trainServices); foreach (DarwinService service in railServices) { departureBoard.RailServices.Add(service.ServiceID, service); } return(departureBoard); }
public static DarwinDepartureBoard GetGetEntireBoard(string crs, int offset, int window) { try { Darwin.LDBServiceSoapClient client = new LDBServiceSoapClient(); StationBoardWithDetails board = client.GetDepBoardWithDetails(DarwinToken.TheAccessToken, 0, crs, string.Empty, FilterType.from, offset, window); return(DarwinDepartureBoardFactory.CreateDepartureBoard(board)); } catch (Exception ex) { Logging.LogError(ex, "Whilst getting Departure Board", 1); return(null); } }