protected static HtmlTag OpenUrlActionRender(TypedElement actionElement, RenderContext context) { OpenUrlAction action = (OpenUrlAction)actionElement; if (!context.Config.SupportsInteractivity) { return(null); } var buttonElement = new HtmlTag("button") { Text = action.Title } .Attr("type", "button") .Attr("url", action.Url) .Style("overflow", "hidden") .Style("white-space", "nowrap") .Style("text-overflow", "ellipsis") .Style("flex", context.Config.Actions.ActionAlignment == HorizontalAlignment.Stretch ? "0 1 100%" : "0 1 auto") .AddClass("ac-pushButton") .AddClass("ac-openUrlAction"); return(buttonElement); }
public BrowseCarouselCardItem WithUrlAction(string url) { OpenUrlAction = new OpenUrlAction { Url = url }; return(this); }
private static void AddForcastColumn(ColumnSet forecast, Column column, string place) { forecast.Columns.Add(column); column.Size = "20"; var action = new OpenUrlAction(); action.Url = $"https://www.bing.com/search?q=forecast in {place}"; column.SelectAction = action; }
protected static HtmlTag OpenUrlActionRender(TypedElement actionElement, RenderContext context) { OpenUrlAction action = (OpenUrlAction)actionElement; if (context.Config.SupportsInteractivity) { var uiButton = new LinkTag(action.Title, action.Url, $"ac-{action.Type.Replace(".", "").ToLower()}", "ac-action"); return(uiButton); } return(null); }
public static FrameworkElement Render(OpenUrlAction action, RenderContext context) { if (context.Config.SupportsInteractivity) { Button uiButton = XamlUtilities.CreateActionButton(action, context); // content); uiButton.Click += (sender, e) => { context.Action(uiButton, new ActionEventArgs() { Action = action }); }; return(uiButton); } return(null); }
private async Task <bool> PostAdaptiveCard(IDialogContext context, string url, string title, string imageURL, string text) { List <ActionBase> answerOptions = new List <ActionBase>(); ActionBase action = new OpenUrlAction() { Title = title, Url = url }; answerOptions.Add(action); AdaptiveCard adaptiveCard = new AdaptiveCard() { Body = new List <CardElement>() { new TextBlock() { Text = text, Wrap = true }, new Image() { Size = ImageSize.Large, Url = imageURL, HorizontalAlignment = HorizontalAlignment.Center }, }, Actions = answerOptions }; Attachment attachment = new Attachment() { ContentType = AdaptiveCard.ContentType, Content = adaptiveCard }; var reply = context.MakeMessage(); reply.Attachments.Add(attachment); await context.PostAsync(reply, CancellationToken.None); return(true); }
public virtual void Visit(OpenUrlAction action) { }
public BrowseCarouselCardItem(string title, string description, string imageUrl, string openUrlAction) : base(title, description, imageUrl) { OpenUrlAction = new OpenUrlAction { Url = openUrlAction }; }