public List<Event> GetEvents(string days)
        {
            String apiAddress = "http://api.football-data.org/v1/soccerseasons/398/fixtures";
            string apiAddressWithParams = apiAddress + urlParameters(days);

            ApiCaller api = new ApiCaller();
            String jsonString = api.GET(apiAddressWithParams);

            // calls the API and gets a String

            // convert the string to a list of events – see below for this method
            JSONparser jsonParser = new JSONparser();
            return jsonParser.GetInfoFromWholeFootballDataComJSONstring(jsonString);
        }
        public List <Event> GetEvents(string days)
        {
            String apiAddress           = "http://api.football-data.org/v1/soccerseasons/398/fixtures";
            string apiAddressWithParams = apiAddress + urlParameters(days);

            ApiCaller api        = new ApiCaller();
            String    jsonString = api.GET(apiAddressWithParams);

            // calls the API and gets a String

            // convert the string to a list of events – see below for this method
            JSONparser jsonParser = new JSONparser();

            return(jsonParser.GetInfoFromWholeFootballDataComJSONstring(jsonString));
        }
        //adding in the events to the parameter
        public List<Event> distancefromLocation(List<Event> events, string location, string travelmode)
        {
            ApiCaller api = new ApiCaller();
            JSONparser jsonParser = new JSONparser();

            // calls the API and gets a String
            //String jsonString = api.GET(apiAddress + urlParameters(location)); //PS 2/12/2015: commented this out as it's in the for loop now

            // convert the string to a list of events – see below for this method
            //List<Event> events = jsonParser.GetInfoFromWholeFootballDataComJSONstring(jsonString);

            // right, so: location is the current location of the user
            // so we're going to go through each event in the 'events' list and work out the location from the event to the current location
            foreach(Event currentEvent in events)
            {
                //currentEvent.distance = getDistanceFromAtoB(location, currentEvent.locationLatitude, currentEvent.locationLongitude);
                PopulateEventWithDistances(currentEvent, location, travelmode);
            }

            // returns the events
            return events;
        }
示例#4
0
        public List <Event> distancefromLocation(List <Event> events, string location, string travelmode) //adding in the events to the parameter
        {
            ApiCaller  api        = new ApiCaller();
            JSONparser jsonParser = new JSONparser();

            // calls the API and gets a String
            //String jsonString = api.GET(apiAddress + urlParameters(location)); //PS 2/12/2015: commented this out as it's in the for loop now

            // convert the string to a list of events – see below for this method
            //List<Event> events = jsonParser.GetInfoFromWholeFootballDataComJSONstring(jsonString);



            // right, so: location is the current location of the user
            // so we're going to go through each event in the 'events' list and work out the location from the event to the current location
            foreach (Event currentEvent in events)
            {
                //currentEvent.distance = getDistanceFromAtoB(location, currentEvent.locationLatitude, currentEvent.locationLongitude);
                PopulateEventWithDistances(currentEvent, location, travelmode);
            }

            // returns the events
            return(events);
        }