Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public BrowseCarouselCardItem WithUrlAction(string url)
 {
     OpenUrlAction = new OpenUrlAction {
         Url = url
     };
     return(this);
 }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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);
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 public virtual void Visit(OpenUrlAction action)
 {
 }
Esempio n. 8
0
 public BrowseCarouselCardItem(string title, string description, string imageUrl, string openUrlAction) : base(title, description, imageUrl)
 {
     OpenUrlAction = new OpenUrlAction {
         Url = openUrlAction
     };
 }