private static void AssertAdaptiveImagePropertyValue(string expectedPropertyName, string expectedPropertyValue, AdaptiveImage image)
        {
            bool addedSource = false;
            if (image.Source == null)
            {
                image.Source = "img.png";
                addedSource = true;
            }

            string xml = $"<image {expectedPropertyName}='{expectedPropertyValue}'";

            if (addedSource)
                xml += " src='img.png'";

            xml += "/>";

            AssertAdaptiveChild(xml, image);
        }
Пример #2
0
        protected Attachment ToAdaptiveCardForDeletionRefusedFlow(
            List <TaskItem> todos,
            int allTasksCount,
            string listType)
        {
            var toDoCard = new AdaptiveCard();
            var response = ResponseManager.GetResponseTemplate(DeleteToDoResponses.DeletionAllConfirmationRefused);

            toDoCard.Speak = ResponseManager.Format(response.Reply.Speak, new StringDictionary()
            {
                { "taskCount", allTasksCount.ToString() }, { "listType", listType }
            });

            var body = new List <AdaptiveElement>();

            response = ResponseManager.GetResponseTemplate(ToDoSharedResponses.CardSummaryMessage);
            var showText = ResponseManager.Format(response.Reply.Text, new StringDictionary()
            {
                { "taskCount", allTasksCount.ToString() }, { "listType", listType }
            });
            var textBlock = new AdaptiveTextBlock
            {
                Text = showText,
            };

            body.Add(textBlock);

            var container = new AdaptiveContainer();

            foreach (var todo in todos)
            {
                var columnSet = new AdaptiveColumnSet();

                var icon = new AdaptiveImage
                {
                    UrlString = todo.IsCompleted ? IconImageSource.CheckIconSource : IconImageSource.UncheckIconSource
                };
                var iconColumn = new AdaptiveColumn
                {
                    Width = "auto"
                };
                iconColumn.Items.Add(icon);
                columnSet.Columns.Add(iconColumn);

                var content       = new AdaptiveTextBlock(todo.Topic);
                var contentColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                contentColumn.Items.Add(content);
                columnSet.Columns.Add(contentColumn);

                container.Items.Add(columnSet);
            }

            body.Add(container);
            toDoCard.Body = body;

            var attachment = new Attachment()
            {
                ContentType = AdaptiveCard.ContentType,
                Content     = toDoCard,
            };

            return(attachment);
        }
Пример #3
0
        protected Attachment ToAdaptiveCardForReadMore(
            List <TaskItem> todos,
            int allTasksCount,
            string listType)
        {
            var toDoCard = new AdaptiveCard();
            var response = new ResponseTemplate();

            if (todos.Count == 1)
            {
                response       = ResponseManager.GetResponseTemplate(ShowToDoResponses.NextTask);
                toDoCard.Speak = response.Reply.Speak;
            }
            else if (todos.Count >= 2)
            {
                response       = ResponseManager.GetResponseTemplate(ShowToDoResponses.NextTasks);
                toDoCard.Speak = response.Reply.Speak;
            }

            var body = new List <AdaptiveElement>();

            response = ResponseManager.GetResponseTemplate(ToDoSharedResponses.CardSummaryMessageForMultipleTasks);
            var showText = ResponseManager.Format(response.Reply.Text, new StringDictionary()
            {
                { "taskCount", allTasksCount.ToString() }, { "listType", listType }
            });
            var textBlock = new AdaptiveTextBlock
            {
                Text = showText,
            };

            body.Add(textBlock);

            var container = new AdaptiveContainer();
            int index     = 0;

            foreach (var todo in todos)
            {
                var columnSet = new AdaptiveColumnSet();

                var icon = new AdaptiveImage
                {
                    UrlString = todo.IsCompleted ? IconImageSource.CheckIconSource : IconImageSource.UncheckIconSource
                };
                var iconColumn = new AdaptiveColumn
                {
                    Width = "auto"
                };
                iconColumn.Items.Add(icon);
                columnSet.Columns.Add(iconColumn);

                var content       = new AdaptiveTextBlock(todo.Topic);
                var contentColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                contentColumn.Items.Add(content);
                columnSet.Columns.Add(contentColumn);
                container.Items.Add(columnSet);

                if (index < todos.Count)
                {
                    if (todos.Count == 1)
                    {
                        toDoCard.Speak += todo.Topic + ". ";
                    }
                    else if (index == todos.Count - 2)
                    {
                        toDoCard.Speak += todo.Topic;
                    }
                    else if (index == todos.Count - 1)
                    {
                        toDoCard.Speak += string.Format(ToDoStrings.And, todo.Topic);
                    }
                    else
                    {
                        toDoCard.Speak += todo.Topic + ", ";
                    }
                }

                index++;
            }

            body.Add(container);
            toDoCard.Body = body;

            var attachment = new Attachment()
            {
                ContentType = AdaptiveCard.ContentType,
                Content     = toDoCard,
            };

            return(attachment);
        }
Пример #4
0
        protected Attachment ToAdaptiveCardForPreviousPage(
            List <TaskItem> todos,
            int toBeReadTasksCount)
        {
            var toDoCard  = new AdaptiveCard();
            var speakText = Format(ShowToDoResponses.ShowPreviousToDoTasks.Reply.Speak, new StringDictionary()
            {
            })
                            + Format(ShowToDoResponses.FirstToDoTasks.Reply.Speak, new StringDictionary()
            {
                { "taskCount", toBeReadTasksCount.ToString() }
            });

            toDoCard.Speak = speakText;

            var body     = new List <AdaptiveElement>();
            var showText = Format(ShowToDoResponses.ShowPreviousToDoTasks.Reply.Text, new StringDictionary()
            {
            });
            var textBlock = new AdaptiveTextBlock
            {
                Text = showText,
            };

            body.Add(textBlock);

            var container = new AdaptiveContainer();
            var index     = 0;

            foreach (var todo in todos)
            {
                var columnSet = new AdaptiveColumnSet();

                var icon = new AdaptiveImage();
                icon.UrlString = todo.IsCompleted ? IconImageSource.CheckIconSource : IconImageSource.UncheckIconSource;
                var iconColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                iconColumn.Items.Add(icon);
                columnSet.Columns.Add(iconColumn);

                var content       = new AdaptiveTextBlock(todo.Topic);
                var contentColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                contentColumn.Items.Add(content);
                columnSet.Columns.Add(contentColumn);

                container.Items.Add(columnSet);

                if (index < toBeReadTasksCount)
                {
                    toDoCard.Speak += (++index) + " " + todo.Topic + " ";
                }
            }

            body.Add(container);
            toDoCard.Body = body;

            var attachment = new Attachment()
            {
                ContentType = AdaptiveCard.ContentType,
                Content     = toDoCard,
            };

            return(attachment);
        }
Пример #5
0
        protected Attachment ToAdaptiveCardForShowToDos(
            List <TaskItem> todos,
            int allTasksCount,
            int readSize,
            string listType)
        {
            var toDoCard = new AdaptiveCard();
            var response = ResponseManager.GetResponseTemplate(ShowToDoResponses.TaskSummaryMessage);

            var speakText = ResponseManager.Format(response.Reply.Speak, new StringDictionary()
            {
                { "taskCount", allTasksCount.ToString() }, { "listType", listType }
            }) + " ";

            if (todos.Count == 1)
            {
                response   = ResponseManager.GetResponseTemplate(ShowToDoResponses.LatestOneTask);
                speakText += response.Reply.Speak + " ";
            }
            else if (todos.Count == 2)
            {
                response   = ResponseManager.GetResponseTemplate(ShowToDoResponses.LatestTwoTasks);
                speakText += response.Reply.Speak + " ";
            }
            else if (todos.Count >= readSize)
            {
                response   = ResponseManager.GetResponseTemplate(ShowToDoResponses.LatestThreeOrMoreTasks);
                speakText += ResponseManager.Format(response.Reply.Speak, new StringDictionary()
                {
                    { "taskCount", readSize.ToString() }
                }) + " ";
            }

            toDoCard.Speak = speakText;

            var body = new List <AdaptiveElement>();

            response = ResponseManager.GetResponseTemplate(ToDoSharedResponses.CardSummaryMessage);
            var showText = ResponseManager.Format(response.Reply.Text, new StringDictionary()
            {
                { "taskCount", allTasksCount.ToString() }, { "listType", listType }
            });
            var textBlock = new AdaptiveTextBlock
            {
                Text = showText,
            };

            body.Add(textBlock);

            var container = new AdaptiveContainer();
            int index     = 0;

            readSize = Math.Min(readSize, todos.Count);
            foreach (var todo in todos)
            {
                var columnSet = new AdaptiveColumnSet();

                var icon = new AdaptiveImage
                {
                    UrlString = todo.IsCompleted ? IconImageSource.CheckIconSource : IconImageSource.UncheckIconSource
                };
                var iconColumn = new AdaptiveColumn
                {
                    Width = "auto"
                };
                iconColumn.Items.Add(icon);
                columnSet.Columns.Add(iconColumn);

                var content       = new AdaptiveTextBlock(todo.Topic);
                var contentColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                contentColumn.Items.Add(content);
                columnSet.Columns.Add(contentColumn);

                container.Items.Add(columnSet);

                if (index < readSize)
                {
                    if (readSize == 1)
                    {
                        toDoCard.Speak += todo.Topic + ". ";
                    }
                    else if (index == readSize - 2)
                    {
                        toDoCard.Speak += todo.Topic;
                    }
                    else if (index == readSize - 1)
                    {
                        toDoCard.Speak += string.Format(ToDoStrings.And, todo.Topic);
                    }
                    else
                    {
                        toDoCard.Speak += todo.Topic + ", ";
                    }
                }

                index++;
            }

            if (todos.Count <= readSize)
            {
                response        = ResponseManager.GetResponseTemplate(ShowToDoResponses.AskAddOrCompleteTaskMessage);
                toDoCard.Speak += response.Reply.Speak;
            }

            body.Add(container);
            toDoCard.Body = body;

            var attachment = new Attachment()
            {
                ContentType = AdaptiveCard.ContentType,
                Content     = toDoCard,
            };

            return(attachment);
        }
Пример #6
0
        protected Attachment ToAdaptiveCardForOtherFlows(
            List <TaskItem> todos,
            int allTaskCount,
            string taskContent,
            BotResponse botResponse1,
            BotResponse botResponse2,
            string listType)
        {
            var toDoCard = new AdaptiveCard();
            var showText = Format(botResponse2.Reply.Text, new StringDictionary()
            {
                { "taskCount", allTaskCount.ToString() }, { "listType", listType }
            });
            var speakText = Format(botResponse1.Reply.Speak, new StringDictionary()
            {
                { "taskContent", taskContent }
            })
                            + " " + Format(botResponse2.Reply.Speak, new StringDictionary()
            {
                { "taskCount", allTaskCount.ToString() }, { "listType", listType }
            });

            toDoCard.Speak = speakText.Remove(speakText.Length - 1) + ".";

            var body      = new List <AdaptiveElement>();
            var textBlock = new AdaptiveTextBlock
            {
                Text = showText,
            };

            body.Add(textBlock);

            var container = new AdaptiveContainer();

            foreach (var todo in todos)
            {
                var columnSet = new AdaptiveColumnSet();

                var icon = new AdaptiveImage();
                icon.UrlString = todo.IsCompleted ? IconImageSource.CheckIconSource : IconImageSource.UncheckIconSource;
                var iconColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                iconColumn.Items.Add(icon);
                columnSet.Columns.Add(iconColumn);

                var content       = new AdaptiveTextBlock(todo.Topic);
                var contentColumn = new AdaptiveColumn();
                iconColumn.Width = "auto";
                contentColumn.Items.Add(content);
                columnSet.Columns.Add(contentColumn);

                container.Items.Add(columnSet);
            }

            body.Add(container);
            toDoCard.Body = body;

            var attachment = new Attachment()
            {
                ContentType = AdaptiveCard.ContentType,
                Content     = toDoCard,
            };

            return(attachment);
        }
Пример #7
0
        protected static HtmlTag ImageRender(AdaptiveImage image, AdaptiveRendererContext context)
        {
            var uiDiv = new DivTag()
                        .AddClass($"ac-{image.Type.Replace(".", "").ToLower()}")
                        .Style("display", "block")
                        .Style("box-sizing", "border-box");

            switch (image.Size)
            {
            case AdaptiveImageSize.Auto:
                uiDiv = uiDiv.Style("max-width", $"100%");
                break;

            case AdaptiveImageSize.Small:
                uiDiv = uiDiv.Style("max-width", $"{context.Config.ImageSizes.Small}px");
                break;

            case AdaptiveImageSize.Medium:
                uiDiv = uiDiv.Style("max-width", $"{context.Config.ImageSizes.Medium}px");
                break;

            case AdaptiveImageSize.Large:
                uiDiv = uiDiv.Style("max-width", $"{context.Config.ImageSizes.Large}px");
                break;

            case AdaptiveImageSize.Stretch:
                uiDiv = uiDiv.Style("width", $"100%");
                break;
            }

            var uiImage = new HtmlTag("img")
                          .Style("width", "100%")
                          .Attr("alt", image.AltText ?? "card image")
                          .Attr("src", image.Url.ToString());

            switch (image.Style)
            {
            case AdaptiveImageStyle.Default:
                break;

            case AdaptiveImageStyle.Person:
                uiImage = uiImage.Style("background-position", "50% 50%")
                          .Style("border-radius", "50%")
                          .Style("background-repeat", "no-repeat");
                break;
            }


            switch (image.HorizontalAlignment)
            {
            case AdaptiveHorizontalAlignment.Left:
                uiDiv = uiDiv.Style("overflow", "hidden")
                        .Style("display", "block");
                break;

            case AdaptiveHorizontalAlignment.Center:
                uiDiv = uiDiv.Style("overflow", "hidden")
                        .Style("margin-right", "auto")
                        .Style("margin-left", "auto")
                        .Style("display", "block");
                break;

            case AdaptiveHorizontalAlignment.Right:
                uiDiv = uiDiv.Style("overflow", "hidden")
                        .Style("margin-left", "auto")
                        .Style("display", "block");
                break;
            }
            uiDiv.Children.Add(uiImage);

            if (context.Config.SupportsInteractivity && image.SelectAction != null)
            {
                uiDiv.AddClass("ac-tap");
            }
            return(uiDiv);
        }
Пример #8
0
        public MainPage()
        {
            this.InitializeComponent();

            // Construct a temporary object model tree until the parser is available
            AdaptiveCard      card       = new AdaptiveCard();
            AdaptiveContainer container1 = new AdaptiveContainer();

            AdaptiveTextBlock textBlock1 = new AdaptiveTextBlock();

            textBlock1.Text   = "Hello";
            textBlock1.Weight = TextWeight.Normal;
            textBlock1.Color  = TextColor.Warning;
            textBlock1.Size   = TextSize.Large;
            container1.Items.Add(textBlock1);
            AdaptiveTextBlock textBlock2 = new AdaptiveTextBlock();

            textBlock2.Text   = "World";
            textBlock2.Weight = TextWeight.Normal;
            textBlock2.Color  = TextColor.Accent;
            container1.Items.Add(textBlock2);

            card.Body.Add(container1);

            AdaptiveContainer container2 = new AdaptiveContainer();

            AdaptiveTextBlock textBlock3 = new AdaptiveTextBlock();

            textBlock3.Text   = "In new container";
            textBlock3.Weight = TextWeight.Normal;
            textBlock3.Color  = TextColor.Default;
            container2.Items.Add(textBlock3);

            card.Body.Add(container2);

            AdaptiveImage image = new AdaptiveImage();

            image.Url = new Uri("https://unsplash.it/360/202?image=883");
            card.Body.Add(image);

            m_renderer = new AdaptiveCards.XamlCardRenderer.XamlCardRenderer();

            AdaptiveHostConfig hostConfig = AdaptiveHostConfig.CreateHostConfigFromJson(hostConfigString);

            m_renderer.SetHostConfig(hostConfig);

            m_renderer.Action += async(sender, e) =>
            {
                if (m_actionDialog != null)
                {
                    m_actionDialog.Hide();
                }

                m_actionDialog = new ContentDialog();

                if (e.Action.ActionType == ActionType.ShowCard)
                {
                    AdaptiveShowCardAction showCardAction = (AdaptiveShowCardAction)e.Action;
                    m_actionDialog.Content = await m_renderer.RenderCardAsXamlAsync(showCardAction.Card);
                }
                else
                {
                    m_actionDialog.Content = "We got an action!\n" + e.Action.ActionType + "\n" + e.Inputs;
                }

                m_actionDialog.PrimaryButtonText = "Close";

                await m_actionDialog.ShowAsync();
            };

            PopulateXamlContent(card);
        }
Пример #9
0
        public static FrameworkElement Render(AdaptiveTextInput input, AdaptiveRenderContext context)
        {
            if (context.Config.SupportsInteractivity)
            {
                var textBox = new WatermarkTextBox()
                {
                    Text = input.Value
                };
                if (input.IsMultiline == true)
                {
                    textBox.AcceptsReturn = true;
                    textBox.TextWrapping  = TextWrapping.Wrap;
                    textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
                }
                if (input.MaxLength > 0)
                {
                    textBox.MaxLength = input.MaxLength;
                }

                textBox.Watermark   = input.Placeholder;
                textBox.Style       = context.GetStyle($"Adaptive.Input.Text.{input.Style}");
                textBox.DataContext = input;
                context.InputBindings.Add(input.Id, () => textBox.Text);
                if (input.InlineAction != null)
                {
                    if (context.Config.Actions.ShowCard.ActionMode == ShowCardActionMode.Inline &&
                        input.InlineAction.GetType() == typeof(AdaptiveShowCardAction))
                    {
                        context.Warnings.Add(new AdaptiveWarning(-1, "Inline ShowCard not supported for InlineAction"));
                    }
                    else
                    {
                        if (context.Config.SupportsInteractivity && context.ActionHandlers.IsSupported(input.InlineAction.GetType()))
                        {
                            // Set up a parent view that holds textbox, separator and button
                            var parentView = new Grid();

                            // grid config for textbox
                            parentView.ColumnDefinitions.Add(new ColumnDefinition()
                            {
                                Width = new GridLength(1, GridUnitType.Star)
                            });
                            Grid.SetColumn(textBox, 0);
                            parentView.Children.Add(textBox);

                            // grid config for spacing
                            int spacing = context.Config.GetSpacing(AdaptiveSpacing.Default);
                            var uiSep   = new Grid
                            {
                                Style             = context.GetStyle($"Adaptive.Input.Text.InlineAction.Separator"),
                                VerticalAlignment = VerticalAlignment.Stretch,
                                Width             = spacing,
                            };
                            parentView.ColumnDefinitions.Add(new ColumnDefinition()
                            {
                                Width = new GridLength(spacing, GridUnitType.Pixel)
                            });
                            Grid.SetColumn(uiSep, 1);

                            // adding button
                            var   uiButton = new Button();
                            Style style    = context.GetStyle($"Adaptive.Input.Text.InlineAction.Button");
                            if (style != null)
                            {
                                uiButton.Style = style;
                            }

                            // this textblock becomes tooltip if icon url exists else becomes the tile for the button
                            var uiTitle = new TextBlock
                            {
                                Text = input.InlineAction.Title,
                            };

                            if (input.InlineAction.IconUrl != null)
                            {
                                var actionsConfig = context.Config.Actions;

                                var image = new AdaptiveImage(input.InlineAction.IconUrl)
                                {
                                    HorizontalAlignment = AdaptiveHorizontalAlignment.Center,
                                    Type = "Adaptive.Input.Text.InlineAction.Image",
                                };

                                FrameworkElement uiIcon = null;
                                uiIcon           = AdaptiveImageRenderer.Render(image, context);
                                uiButton.Content = uiIcon;

                                // adjust height
                                textBox.Loaded += (sender, e) =>
                                {
                                    uiIcon.Height = textBox.ActualHeight;
                                };

                                uiButton.ToolTip = uiTitle;
                            }
                            else
                            {
                                uiTitle.FontSize = context.Config.GetFontSize(AdaptiveFontStyle.Default, AdaptiveTextSize.Default);
                                uiTitle.Style    = context.GetStyle($"Adaptive.Input.Text.InlineAction.Title");
                                uiButton.Content = uiTitle;
                            }

                            uiButton.Click += (sender, e) =>
                            {
                                context.InvokeAction(uiButton, new AdaptiveActionEventArgs(input.InlineAction));

                                // Prevent nested events from triggering
                                e.Handled = true;
                            };

                            parentView.ColumnDefinitions.Add(new ColumnDefinition()
                            {
                                Width = GridLength.Auto
                            });
                            Grid.SetColumn(uiButton, 2);
                            parentView.Children.Add(uiButton);
                            uiButton.VerticalAlignment = VerticalAlignment.Bottom;

                            textBox.KeyDown += (sender, e) =>
                            {
                                if (e.Key == System.Windows.Input.Key.Enter)
                                {
                                    context.InvokeAction(uiButton, new AdaptiveActionEventArgs(input.InlineAction));
                                    e.Handled = true;
                                }
                            };
                            return(parentView);
                        }
                    }
                }
                return(textBox);
            }
            else
            {
                var textBlock = AdaptiveTypedElementConverter.CreateElement <AdaptiveTextBlock>();
                textBlock.Text = XamlUtilities.GetFallbackText(input) ?? input.Placeholder;
                return(context.Render(textBlock));
            }
        }
Пример #10
0
        public static Button CreateActionButton(AdaptiveAction action, AdaptiveRenderContext context)
        {
            var uiButton = new Button
            {
                Style = context.GetStyle($"Adaptive.{action.Type}"),
            };

            if (!String.IsNullOrWhiteSpace(action.Sentiment))
            {
                Style sentimentStyle = context.GetStyle($"Adaptive.{action.Type}.{action.Sentiment}");

                if (sentimentStyle == null && String.Equals(action.Sentiment, "positive", StringComparison.OrdinalIgnoreCase))
                {
                    sentimentStyle = context.GetStyle("PositiveActionDefaultStyle");
                }
                else if (sentimentStyle == null && String.Equals(action.Sentiment, "destructive", StringComparison.OrdinalIgnoreCase))
                {
                    sentimentStyle = context.GetStyle("DestructiveActionDefaultStyle");
                }

                uiButton.Style = sentimentStyle;
            }

            var contentStackPanel = new StackPanel();

            if (!context.IsRenderingSelectAction)
            {
                // Only apply padding for normal card actions
                uiButton.Padding = new Thickness(6, 4, 6, 4);
            }
            else
            {
                // Remove any extra spacing for selectAction
                uiButton.Padding         = new Thickness(0, 0, 0, 0);
                contentStackPanel.Margin = new Thickness(0, 0, 0, 0);
            }
            uiButton.Content = contentStackPanel;
            FrameworkElement uiIcon = null;

            var uiTitle = new TextBlock
            {
                Text     = action.Title,
                FontSize = context.Config.GetFontSize(AdaptiveFontStyle.Default, AdaptiveTextSize.Default),
                Style    = context.GetStyle($"Adaptive.Action.Title")
            };

            if (action.IconUrl != null)
            {
                var actionsConfig = context.Config.Actions;

                var image = new AdaptiveImage(action.IconUrl)
                {
                    HorizontalAlignment = AdaptiveHorizontalAlignment.Center
                };
                uiIcon = AdaptiveImageRenderer.Render(image, context);
                if (actionsConfig.IconPlacement == IconPlacement.AboveTitle)
                {
                    contentStackPanel.Orientation = Orientation.Vertical;
                    uiIcon.Height = (double)actionsConfig.IconSize;
                }
                else
                {
                    contentStackPanel.Orientation = Orientation.Horizontal;
                    //Size the image to the textblock, wait until layout is complete (loaded event)
                    uiIcon.Loaded += (sender, e) =>
                    {
                        uiIcon.Height = uiTitle.ActualHeight;
                    };
                }
                contentStackPanel.Children.Add(uiIcon);

                // Add spacing for the icon for horizontal actions
                if (actionsConfig.IconPlacement == IconPlacement.LeftOfTitle)
                {
                    int spacing = context.Config.GetSpacing(AdaptiveSpacing.Default);
                    var uiSep   = new Grid
                    {
                        Style             = context.GetStyle($"Adaptive.VerticalSeparator"),
                        VerticalAlignment = VerticalAlignment.Stretch,
                        Width             = spacing,
                    };
                    contentStackPanel.Children.Add(uiSep);
                }
            }

            contentStackPanel.Children.Add(uiTitle);

            string name = context.GetType().Name.Replace("Action", String.Empty);

            return(uiButton);
        }