Exemplo n.º 1
0
        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        ///     public class Function

        public List <FactResource> GetResources()
        {
            List <FactResource> resources    = new List <FactResource>();
            FactResource        enUSResource = new FactResource("en-US");

            enUSResource.SkillName      = "American Science Facts";
            enUSResource.GetFactMessage = "Here's your science fact: ";
            enUSResource.HelpMessage    = "You can say tell me a science fact, or, you can say exit... What can I help you with?";
            enUSResource.HelpReprompt   = "You can say tell me a science fact to start";
            enUSResource.StopMessage    = "Goodbye!";
            enUSResource.Facts.Add("A year on Mercury is just 88 days long.");
            enUSResource.Facts.Add("Despite being farther from the Sun, Venus experiences higher temperatures than Mercury.");
            enUSResource.Facts.Add("Venus rotates counter-clockwise, possibly because of a collision in the past with an asteroid.");
            enUSResource.Facts.Add("On Mars, the Sun appears about half the size as it does on Earth.");
            enUSResource.Facts.Add("Earth is the only planet not named after a god.");
            enUSResource.Facts.Add("Jupiter has the shortest day of all the planets.");
            enUSResource.Facts.Add("The Milky Way galaxy will collide with the Andromeda Galaxy in about 5 billion years.");
            enUSResource.Facts.Add("The Sun contains 99.86% of the mass in the Solar System.");
            enUSResource.Facts.Add("The Sun is an almost perfect sphere.");
            enUSResource.Facts.Add("A total solar eclipse can happen once every 1 to 2 years. This makes them a rare event.");
            enUSResource.Facts.Add("Saturn radiates two and a half times more energy into space than it receives from the sun.");
            enUSResource.Facts.Add("The temperature inside the Sun can reach 15 million degrees Celsius.");
            enUSResource.Facts.Add("The Moon is moving approximately 3.8 cm away from our planet every year.");

            resources.Add(enUSResource);
            return(resources);
        }
Exemplo n.º 2
0
        public string emitNewFact(FactResource resource, bool withPreface)
        {
            Random r = new Random();

            if (withPreface)
            {
                return(resource.GetFactMessage + resource.Facts[r.Next(resource.Facts.Count)]);
            }
            return(resource.Facts[r.Next(resource.Facts.Count)]);
        }