private static Attachment PizzaOrderMethod() { try { var herocard = new Microsoft.Bot.Connector.HeroCard { Title = "Pizza", Subtitle = "Experience The Savage", Text = "Choose The Pizza", Images = new List <CardImage> { new CardImage("https://images5.alphacoders.com/396/thumb-1920-396575.jpg") }, Buttons = new List <CardAction> { new CardAction(ActionTypes.ImBack, "Regular", value: "Regular"), new CardAction(ActionTypes.OpenUrl, "Medium", value: "Medium") } }; return(herocard.ToAttachment()); } catch (Exception ex) { throw ex; } }
private static Attachment BiryaniOrder() { try { var herocard = new Microsoft.Bot.Connector.HeroCard { Title = "BIRYANI", Subtitle = "Experience The Savage", Text = "Choose The Biryani", Images = new List <CardImage> { new CardImage("http://res.cloudinary.com/prayuta/image/upload/v1500964175/Chicken-Biryani-1_fudjk7.jpg") }, Buttons = new List <CardAction> { new CardAction(ActionTypes.ImBack, "NonVeg", value: "NonVeg"), new CardAction(ActionTypes.OpenUrl, "Veg", value: "Veg") } }; return(herocard.ToAttachment()); } catch (Exception ex) { throw ex; } }
private static Attachment BeveragesOrder() { try { var herocard = new Microsoft.Bot.Connector.HeroCard { Title = "Beverages", Subtitle = "Experience The Savage", Text = "Feel The End", Images = new List <CardImage> { new CardImage("https://st.depositphotos.com/1044737/4943/i/950/depositphotos_49431317-stock-photo-colorful-soda-drinks-with-cola.jpg") }, Buttons = new List <CardAction> { new CardAction(ActionTypes.ImBack, "SoftDrinks", value: "SoftDrinks"), new CardAction(ActionTypes.OpenUrl, "ThickShakes", value: "ThickShakes") } }; return(herocard.ToAttachment()); } catch (Exception ex) { throw ex; } }
public Attachment ToAppointmentDetailsAttachment(ServiceRequest request, string selectedTime) { List<CardImage> cardImages = new List<CardImage>(); cardImages.Add(new CardImage(url: this.ImageUrl)); HeroCard plCard = new HeroCard() { Title = this.FullName, Subtitle = $"{request.Service}", Images = cardImages }; return plCard.ToAttachment(); }
public Activity DisplayFoodItems(IDialogContext context, Activity activity) { try { Activity replyToConversation = activity.CreateReply("Welcome to the Southern Restaurant"); replyToConversation.AttachmentLayout = AttachmentLayoutTypes.Carousel; replyToConversation.Attachments = new List <Attachment>(); Dictionary <string, string> cardContentList = new Dictionary <string, string>(); cardContentList.Add("Biryani", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQj8J-RY4ikjj3qBpIt_3E9fBhDpjoZs6YeoHuKVUkLTdjgrs2t"); cardContentList.Add("Pizza", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-DBSNVXvH34L8viGPcNEZoDcnA1Pe_O9IfaFHoakKoT0388vwPA"); cardContentList.Add("Beverages", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQAVqZQ9ZCd0QPdlH2OjSFiNKraCqzX-RoXyXlMkIF2cZaq9lXS"); foreach (KeyValuePair <string, string> cardContent in cardContentList) { List <CardImage> cardImages = new List <CardImage>(); cardImages.Add(new CardImage(url: cardContent.Value)); List <CardAction> cardButtons = new List <CardAction> { new CardAction(ActionTypes.ImBack, "OrderNow", value: cardContent.Key + "Order") }; //CardAction plButton = new CardAction() //{ // Value = cardContent.Key + "Order", // Type = "ImBack", // Title = "Order" //}; //cardButtons.Add(plButton); Microsoft.Bot.Connector.HeroCard plCard = new Microsoft.Bot.Connector.HeroCard() { Title = cardContent.Key, Images = cardImages, Buttons = cardButtons }; Attachment plAttachment = plCard.ToAttachment(); replyToConversation.Attachments.Add(plAttachment); } return(replyToConversation); } catch (Exception ex) { throw ex; } }
/// <summary> /// Creates a new attachment from <see cref="HeroCard"/>. /// </summary> /// <param name="card"> The instance of <see cref="HeroCard"/>.</param> /// <returns> The generated attachment.</returns> public static Attachment ToAttachment(this HeroCard card) { return(CreateAttachment(card, HeroCard.ContentType)); }
public Attachment ToAttachment() { List<CardImage> cardImages = new List<CardImage>(); cardImages.Add(new CardImage(url: this.ImageUrl)); List<CardAction> cardButtons = new List<CardAction>(); foreach (var time in AvailableTimes) { CardAction plButton = new CardAction() { Value = $"{FullName} at {time}", Type = "imBack", Title = time }; cardButtons.Add(plButton); } HeroCard plCard = new HeroCard() { Title = this.FullName, Subtitle = $"Rating: {this.Rating.ToString("#.##")}", Images = cardImages, Buttons = cardButtons }; return plCard.ToAttachment(); }