Beispiel #1
0
        /// <summary>
        /// Creates a Hero Card Detailing the functions that the Bot can perfom
        /// </summary>
        /// <param name="cardHeading">Heading To Be sent to the card</param>
        /// <returns></returns>
        public static ThumbnailCard CreateBotFunctionsCard(string cardHeading, ActivityBotBase bot)
        {
            var attrib   = bot.GetType().GetCustomAttribute <BotId>();
            var obj      = myAssy.bytFromEmbed(Assembly.GetExecutingAssembly().GetName().Name, "BotPic.png", true);
            var str1     = Convert.ToBase64String(obj);
            var heroCard = new ThumbnailCard(cardHeading, attrib.BotName)
            {
                Buttons = new List <CardAction>
                {
                    //new CardAction(ActionTypes.ImBack, "LogIn", text:"LogIn", displayText: "LogIn", value: "LogIn"),
                    new CardAction(ActionTypes.ImBack, "MyProfile", text: "MyProfile", displayText: "MyProfile", value: "MyProfile"),
                    new CardAction(ActionTypes.ImBack, "MyBadges", text: "MyBadges", displayText: "MyBadges", value: "MyBadges"),
                    new CardAction(ActionTypes.ImBack, "MyActivity", text: "MyActivity", displayText: "MyActivity", value: "MyActivity"),
                    //new CardAction(ActionTypes.ImBack, "Help", text: "Help", displayText: "Help", value:"Help"),
                    new CardAction(ActionTypes.ImBack, "Quit", text: "Quit", displayText: "Quit", value: "Quit")
                },
                Images = new List <CardImage>()
                {
                    new CardImage()
                    {
                        //Url = string.Format(Constants.CardImageUrl, str1)
                        Url = "https://cognitive.risersoft.com/content/fitbit.png"
                    }
                }
            };

            return(heroCard);
        }
Beispiel #2
0
        public static ThumbnailCard CreateErrorCard(ActivityBotBase bot)
        {
            var attrib   = bot.GetType().GetCustomAttribute <BotId>();
            var obj      = myAssy.bytFromEmbed(Assembly.GetExecutingAssembly().GetName().Name, "BrokenBot.png", true);
            var str1     = Convert.ToBase64String(obj);
            var heroCard = new ThumbnailCard($"Sorry, I have run into an issue. Please close the chat and try again", attrib.BotName)
            {
                Images = new List <CardImage>()
                {
                    new CardImage()
                    {
                        //Reading Error Image from Local folders in solutiom
                        Url = string.Format(Constants.CardImageUrl, str1)
                    }
                }
            };

            return(heroCard);
        }
Beispiel #3
0
 public BotController(IBotFrameworkHttpAdapter adapter, ActivityBotBase bot)
 {
     _adapter = adapter;
     _bot     = bot;
 }