public static FrameworkElement Render(SubmitAction action, RenderContext context)
 {
     if (context.Config.SupportsInteractivity)
     {
         Button uiButton = XamlUtilities.CreateActionButton(action, context); // content
         uiButton.Click += (sender, e) =>
         {
             try
             {
                 dynamic data = (action.Data != null) ? ((JToken)action.Data).DeepClone() : new JObject();
                 data = context.MergeInputData(data);
                 context.Action(uiButton, new ActionEventArgs()
                 {
                     Action = action, Data = data
                 });
             }
             catch (MissingInputException err)
             {
                 context.MissingInput(action, new MissingInputEventArgs(err.Input, err.FrameworkElement));
             }
         };
         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);
 }
        public static FrameworkElement Render(TypedElement element, RenderContext context)
        {
            ShowCardAction action = (ShowCardAction)element;

            if (context.Config.SupportsInteractivity)
            {
                Button uiButton = XamlUtilities.CreateActionButton(action, context);
                uiButton.Click += (sender, e) =>
                {
                    context.Action(uiButton, new ActionEventArgs()
                    {
                        Action = action, Data = null
                    });
                };
                return(uiButton);
            }
            return(null);
        }
Esempio n. 4
0
        public static FrameworkElement Render(TypedElement element, RenderContext context)
        {
            HttpAction action = (HttpAction)element;

            if (context.Config.SupportsInteractivity)
            {
                Button uiButton = XamlUtilities.CreateActionButton(action, context);
                uiButton.Click += (sender, e) =>
                {
                    dynamic data = new JObject();
                    try
                    {
                        data = context.MergeInputData(data);

                        string body = (string)action.Body?.ToString() ?? String.Empty;

                        context.Action(uiButton, new ActionEventArgs()
                        {
                            Action = new HttpAction()
                            {
                                Title   = action.Title,
                                Method  = action.Method,
                                Url     = RendererUtilities.BindData(data, action.Url, url: true),
                                Headers = action.Headers,
                                Body    = RendererUtilities.BindData(data, body),
                            },
                            Data = data
                        });
                    }
                    catch (MissingInputException err)
                    {
                        context.MissingInput(action, new MissingInputEventArgs(err.Input, err.FrameworkElement));
                    }
                };
                return(uiButton);
            }
            return(null);
        }
Esempio n. 5
0
 public static void SetThickness(this ContentButton view, double thickness)
 {
     //view.Button.BorderWidth = thickness;
 }
Esempio n. 6
0
 public static void SetBorderColor(this ContentButton view, string color, RenderContext context)
 {
     // view.Button.BorderColor = Color.FromHex(color);
 }
Esempio n. 7
0
 public static void SetBackgroundColor(this ContentButton view, string color, RenderContext context)
 {
     view.BackgroundColor = Color.FromHex(color);
 }