Esempio n. 1
0
        /// <summary>
        /// Set some basic variables and fetch our places data
        /// </summary>
        /// <param name="miles"></param>
        /// <param name="baseLocation"></param>
        /// <param name="placeType"></param>
        /// <param name="apiKey"></param>
        /// <returns></returns>
        public static List <CoolPlaceResource> InitCoolPlaces(int miles, string baseLocation, PlaceType placeType, string apiKey)
        {
            List <CoolPlaceResource> resources = new List <CoolPlaceResource>();
            // TODO - i feel like this should be in our main function instead of this utility class
            CoolPlaceResource enUSResource = new CoolPlaceResource("en-US");

            enUSResource.SkillName = "Cool Places";
            enUSResource.GetCoolPlaceOpenMessage = "Here's your Cool Place: ";
            enUSResource.HelpMessage             = "You can say tell me a cool place, or, you can say exit... What can I help you with?";
            enUSResource.HelpReprompt            = "You can say tell me a cool place to start";
            enUSResource.StopMessage             = "Goodbye!";

            // Fetch the data
            enUSResource.CoolPlaces = GetCoolPlacesFromGoogle(miles, baseLocation, placeType, apiKey);

            resources.Add(enUSResource);

            return(resources);
        }
Esempio n. 2
0
        /// <summary>
        /// This does the randomization of the places we have fetched
        /// </summary>
        /// <param name="resource"></param>
        /// <returns></returns>
        public static CoolPlace EmitCoolPlace(CoolPlaceResource resource)
        {
            Random r = new Random();

            return(resource.CoolPlaces[r.Next(resource.CoolPlaces.Count)]);
        }