protected override async Task OnMembersAddedAsync( IList <ChannelAccount> membersAdded, ITurnContext <IConversationUpdateActivity> turnContext, CancellationToken cancellationToken) { foreach (var member in membersAdded) { // Greet anyone that was not the target (recipient) of this message. // To learn more about Adaptive Cards, see https://aka.ms/msbot-adaptivecards for more details. if (member.Id != turnContext.Activity.Recipient.Id) { var welcomeCard = CreateAdaptiveCardAttachment(); var response = MessageFactory.Attachment(welcomeCard, ssml: "Welcome to Bot Framework!"); await turnContext.SendActivityAsync(response, cancellationToken); MediaCardProperties mediaCardProperties = new MediaCardProperties(); mediaCardProperties.CardTitle = "Hello !! We can assist you with following topics?"; Media_Cards media_Cards = new Media_Cards(); List <string> options = new List <string>(); options.Add("Examcards"); options.Add("Coil Combination"); options.Add("Coil Information"); options.Add("T/R Coil queries"); var promptMessage = (Activity)MessageFactory.Attachment(media_Cards.HeroCard(options, mediaCardProperties)); await turnContext.SendActivityAsync(promptMessage, cancellationToken); } } }
/// <summary> /// File attachment methoed returns an attachment type of all extension /// </summary> /// <returns></returns> public Attachment FileAttachment(MediaCardProperties mediaCardPropertiesObj) { return(new Attachment { Name = mediaCardPropertiesObj.CardTitle, ContentType = "application/*", ContentUrl = mediaCardPropertiesObj.URL }); }
public Attachment ImageCard(MediaCardProperties mediaCardPropertiesObj) { return(new Attachment { Name = mediaCardPropertiesObj.CardTitle, ContentType = "image/png", ContentUrl = mediaCardPropertiesObj.URL }); }
public Attachment HeroCard(List <string> optionkey, MediaCardProperties mediaCardPropertiesObj) { var heroCard = new HeroCard(); heroCard.Title = mediaCardPropertiesObj.CardTitle; heroCard.Buttons = new List <CardAction>(); foreach (var option in optionkey) { heroCard.Buttons.Add(new CardAction(ActionTypes.ImBack, option, value: option)); } return(heroCard.ToAttachment()); }
public Attachment ThumbnailCard(MediaCardProperties mediaCardPropertiesObj) { var thumbnailCard = new ThumbnailCard { Title = mediaCardPropertiesObj.CardTitle, Subtitle = mediaCardPropertiesObj.CardSubtitle, Text = mediaCardPropertiesObj.CardText, Images = new List <CardImage> { new CardImage(mediaCardPropertiesObj.URL) } }; return(thumbnailCard.ToAttachment()); }
private static async Task<DialogTurnResult> DisplayOptionAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { MediaCardProperties mediaCardProperties = new MediaCardProperties(); mediaCardProperties.CardTitle = "Hello !! I can assist you with following queries?"; Media_Cards media_Cards = new Media_Cards(); List<string> options = new List<string>(); options.Add("Examcards"); options.Add("Coil Combination"); options.Add("Coil Information"); options.Add("T/R Coil queries"); var promptMessage = MessageFactory.Attachment(media_Cards.HeroCard(options, mediaCardProperties)); await stepContext.Context.SendActivityAsync(promptMessage, cancellationToken); return await stepContext.EndDialogAsync(); }
private static async Task <DialogTurnResult> RetreiveValueAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { CoilModel coil = CoilData.GetCoilDatails(stepContext.Result.ToString()); if (coil != null) { MediaCardProperties mediaCardProperties = new MediaCardProperties(); mediaCardProperties.CardTitle = coil.CoilName + " (" + coil.CoilType + ")"; mediaCardProperties.CardSubtitle = coil.Applications; mediaCardProperties.CardText = coil.Design; mediaCardProperties.URL = coil.ImagePath; Media_Cards mediaCards = new Media_Cards(); Attachment attachment = mediaCards.ThumbnailCard(mediaCardProperties); await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(attachment)); } else { await stepContext.Context.SendActivityAsync(stepContext.Result.ToString() + " not found!"); } await stepContext.Context.SendActivityAsync("For more information about Coils , Please refer under Coils tab in User Documentation"); var reply = MessageFactory.Text("Do you have other queries "); reply.SuggestedActions = new SuggestedActions() { Actions = new List <CardAction>() { new CardAction() { Title = "Yes", Type = ActionTypes.ImBack, Value = "default" }, new CardAction() { Title = "No", Type = ActionTypes.ImBack, Value = "exit" } }, }; reply.InputHint = InputHints.ExpectingInput; await stepContext.Context.SendActivityAsync(reply, cancellationToken); return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken)); }
public Attachment VideoAttachment(MediaCardProperties mediaCardPropertiesObj) { var videoCard = new VideoCard { Title = mediaCardPropertiesObj.CardTitle, Subtitle = mediaCardPropertiesObj.CardSubtitle, Text = mediaCardPropertiesObj.CardText, Image = new ThumbnailUrl { Url = mediaCardPropertiesObj.URL, }, Media = new List <MediaUrl> { new MediaUrl() { Url = mediaCardPropertiesObj.URL, }, }, }; return(videoCard.ToAttachment()); }
public Media_Cards(MediaCardProperties mediaCardProperties) { mediaCardPropertiesObj = mediaCardProperties; }