Exemplo n.º 1
0
            private void AssignAction(T instance, SubmitAction action)
            {
                EntitySession.TrackedItem item;
                this.tracked.TryGetValue(instance, out item);
                switch (action)
                {
                case SubmitAction.None:
                case SubmitAction.Update:
                case SubmitAction.Insert:
                case SubmitAction.InsertOrUpdate:
                case SubmitAction.Delete:
                    this.tracked[instance] = new EntitySession.TrackedItem(this, instance, (item != null) ? item.Original : null, action, (item != null) ? item.HookedEvent : false);
                    break;

                case SubmitAction.PossibleUpdate:
                {
                    INotifyPropertyChanging changing = instance as INotifyPropertyChanging;
                    if (changing == null)
                    {
                        object original = this.Mapping.CloneEntity(base.Entity, instance);
                        this.tracked[instance] = new EntitySession.TrackedItem(this, instance, original, SubmitAction.PossibleUpdate, false);
                        break;
                    }
                    if (!item.HookedEvent)
                    {
                        changing.PropertyChanging += new PropertyChangingEventHandler(this.OnPropertyChanging);
                    }
                    this.tracked[instance] = new EntitySession.TrackedItem(this, instance, null, SubmitAction.PossibleUpdate, true);
                    break;
                }

                default:
                    throw new InvalidOperationException(string.Format("Unknown SubmitAction: {0}", action));
                }
            }
Exemplo n.º 2
0
 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);
 }
 static Home()
 {
     Edit             = new SubmitAction("edit", "report", "edit");
     List             = new SubmitAction("list", "report", "list");
     Create           = new SubmitAction("create", "report", "create");
     View             = new SubmitAction("view", "report", "summary");
     AlreadySubmitted = new SubmitAction("alreadysubmitted", "report", "alreadysubmitted");
 }
 private RedirectResult BuildRedirectResultForSubmitAction(SubmitAction submitAction)
 {
     return
         (new RedirectResult(
              Url.Action(
                  submitAction.ActionName,
                  submitAction.ControllerName)));
 }
Exemplo n.º 5
0
        protected static HtmlTag SubmitActionRender(TypedElement actionElement, RenderContext context)
        {
            SubmitAction action = (SubmitAction)actionElement;

            if (context.Config.SupportsInteractivity)
            {
                var uiButton = new LinkTag(action.Title, null, $"ac-{action.Type.Replace(".", "").ToLower()}", "ac-action");
                return(uiButton);
            }
            return(null);
        }
Exemplo n.º 6
0
        protected virtual bool OnSubmit(out string error, string input)
        {
            error = Validator?.Invoke(input);

            if (error == null)
            {
                SubmitAction?.Invoke(input);
                return(true);
            }
            return(false);
        }
Exemplo n.º 7
0
 public ItemInventoryMenu(MyCharacterController owner, SubmitAction submitact)
     : base(10, 1, owner, pos, size, "ItemInventoryMenu")
 {
     initHeadLabel("持ち物");
     this.Window.MultiSelectMode = false;
     SubmitAct = submitact;
     CancelAct = () => { };
     TargetInventory = owner.Parameter.Inventory;
     UnselectableItemTypes = new List<Type>();
     UnseletctableItems = new List<ItemBasis>();
     UnselectableItemCodes = new List<ItemBasis.ItemCode>();
     SelectableItemTypes = new List<Type>();
 }
Exemplo n.º 8
0
        public void Initialize(PopupMenu oldPopupMenu, Selectable defaultSelectable, SubmitAction resetAction,
                               ButtonWithHotkeyImageElement resetButton, IModLayoutManager layout, IModInputHandler inputHandler)
        {
            _inputHandler = inputHandler;
            var fields = typeof(PopupMenu).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).ToList();

            fields.ForEach(field => field.SetValue(this, field.GetValue(oldPopupMenu)));
            _selectOnActivate = defaultSelectable;
            _resetAction      = resetAction;
            _resetButton      = resetButton;
            _initialized      = false;
            Layout            = layout;
            InitializeMenu();
        }
        public static void SubmitAction()
        {
            Document document = new Document();
            Page     page     = new Page();

            document.Pages.Add(page);

            SubmitAction submitAction = new SubmitAction("www.mydomain.com", FormExportFormat.HtmlPost);
            Button       button       = new Button("btn", 50, 300, 100, 50);

            button.Label  = "Submit";
            button.Action = submitAction;

            page.Elements.Add(button);
            document.Draw(Util.GetPath("Output/SubmitAction.pdf"));
        }
Exemplo n.º 10
0
 public override void SetSubmitAction(T instance, SubmitAction action)
 {
     switch (action)
     {
     case SubmitAction.None:
     case SubmitAction.Update:
     case SubmitAction.PossibleUpdate:
     case SubmitAction.Delete:
         if (!this.AddToCache(instance).Equals(instance))
         {
             throw new InvalidOperationException("An different instance with the same key is already in the cache.");
         }
         break;
     }
     this.AssignAction(instance, action);
 }
Exemplo n.º 11
0
 public override void SetSubmitAction(T instance, SubmitAction action)
 {
     switch (action)
     {
     case SubmitAction.None:
     case SubmitAction.PossibleUpdate:
     case SubmitAction.Update:
     case SubmitAction.Delete:
         T cached = AddToCache(instance);
         if ((object)cached != (object)instance)
         {
             throw new InvalidOperationException("An different instance with the same key is already in the cache.");
         }
         break;
     }
     AssignAction(instance, action);
 }
Exemplo n.º 12
0
            private void AssignAction(T instance, SubmitAction action)
            {
                this.tracked.TryGetValue(instance, out TrackedItem ti);

                switch (action)
                {
                case SubmitAction.Insert:
                case SubmitAction.InsertOrUpdate:
                case SubmitAction.Update:
                case SubmitAction.Delete:
                case SubmitAction.None:
                {
                    this.tracked[instance] = new TrackedItem(this, instance, ti?.Original, action, ti != null ? ti.HookedEvent : false);

                    break;
                }

                case SubmitAction.PossibleUpdate:
                {
                    if (instance is INotifyPropertyChanging notify)
                    {
                        if (!ti.HookedEvent)
                        {
                            notify.PropertyChanging += new PropertyChangingEventHandler(this.OnPropertyChanging);
                        }

                        this.tracked[instance] = new TrackedItem(this, instance, null, SubmitAction.PossibleUpdate, true);
                    }
                    else
                    {
                        var original = this.Mapping.CloneEntity(this.Entity, instance);

                        this.tracked[instance] = new TrackedItem(this, instance, original, SubmitAction.PossibleUpdate, false);
                    }

                    break;
                }

                default:
                {
                    throw new InvalidOperationException($"Unknown SubmitAction: { action }");
                }
                }
            }
Exemplo n.º 13
0
        public async Task <IActionResult> OnPostAsync()
        {
            PaymentMethod1.Type = PaymentMethodType.BankAccount;

            if (PaymentMethod1.Type == PaymentMethodType.GiftCard || PaymentMethod2.Type == PaymentMethodType.GiftCard)
            {
                ViewData["ErrorMessage"] = "Gift cards are not currently supported.";

                return(Page());
            }

            var auth0UserId = User.FindFirstValue("sub");

            var customerResult = await _mediator.Send(new GetCustomerForAuth0UserRequest(auth0UserId));

            if (customerResult.HasError)
            {
                ViewData["ErrorMessage"] = customerResult.Message;
            }

            var customer      = customerResult.Value;
            var encryptionKey = _configuration["BodyGenesis:Shared:EncryptionKey"];

            if (!SubmitAction.Equals("continue", StringComparison.OrdinalIgnoreCase))
            {
                customer.MembershipSubscriptions.Remove(customer.CurrentMembershipSubscription);

                await _mediator.Send(new SaveCustomerRequest(customer));

                return(Redirect("/membership/join"));
            }

            PaymentMethod1.SetEncryptedAccountNumber(AccountNumber1, encryptionKey);
            PaymentMethod2.SetEncryptedAccountNumber(AccountNumber2, encryptionKey);

            customer.PaymentMethods.Add(PaymentMethod1);
            customer.PaymentMethods.Add(PaymentMethod2);

            await _mediator.Send(new SaveCustomerRequest(customer));

            return(Redirect("/membership/agreement"));
        }
Exemplo n.º 14
0
        protected string submit(string button_label, GUIStyle button_style, SubmitAction submit_action)
        {
            submit_clicked = false;
            button(button_label, button_style, () => {
                submit_clicked = true;
            });
            Event e = Event.current;

            if (GUI.GetNameOfFocusedControl() == "dialog_focus_field" && e.type == EventType.KeyDown && (e.keyCode == KeyCode.Return || e.keyCode == KeyCode.KeypadEnter))
            {
                submit_clicked = true;
                e.Use();
            }

            if (submit_clicked)
            {
                return(submit_action());
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 15
0
 protected string submit(string button_label, SubmitAction submit_action)
 {
     return(submit(button_label, "Button", submit_action));
 }
Exemplo n.º 16
0
        private static AdaptiveCard CreateSearchResultCard(string title, string category, string score, string text)
        {
            AdaptiveCard card = new AdaptiveCard();

            var columnsBlock = new ColumnSet()
            {
                Separation = SeparationStyle.Strong,
                Columns    = new List <Column>
                {
                    new Column
                    {
                        Size  = "1",
                        Items = new List <CardElement>
                        {
                            new TextBlock
                            {
                                Text   = title,
                                Size   = TextSize.Large,
                                Weight = TextWeight.Bolder,
                                Wrap   = true
                            },
                            new FactSet
                            {
                                Separation = SeparationStyle.None,
                                Facts      = new List <AdaptiveCards.Fact>
                                {
                                    new AdaptiveCards.Fact("Search Score:", score),
                                    new AdaptiveCards.Fact("Category:", category),
                                }
                            }
                        }
                    },
                    new Column
                    {
                        Size  = "auto",
                        Items = new List <CardElement>
                        {
                            new Image
                            {
                                Url  = "https://bot-framework.azureedge.net/bot-icons-v1/bot-framework-default-7.png",
                                Size = ImageSize.Medium
                            }
                        }
                    }
                }
            };

            var textBlock = new TextBlock()
            {
                Text     = text,
                Wrap     = true,
                MaxLines = 2,
                Size     = TextSize.Normal
            };

            var submitAction = new SubmitAction
            {
                Title = "More Details",
                Data  = $"show me the article {title}"
            };

            // fill the card
            card.Body.Add(columnsBlock);
            card.Body.Add(textBlock);
            card.Actions.Add(submitAction);

            return(card);
        }
Exemplo n.º 17
0
 public void OnSubmit(SubmitAction p0, IDictionary <string, string> p1)
 {
 }
Exemplo n.º 18
0
        public Attachment CreateDisplayCard(IMessageActivity message)
        {
            dynamic val   = message.Value;
            string  name  = val.Name.ToString();
            string  quest = val.Quest.ToString();
            string  color = val.Color.ToString();

            // TODO = complete this method
            // create facts for name, quest, color
            // Create the fact set for the facts

            // Next up the hierarchy is the items list for facts collection
            List <CardElement> factItems = new List <CardElement>()
            {
                fs
            };

            // These are then grouped into a column
            Column colFacts = new Column()
            {
                Items = factItems
            };
            List <Column> lsFacts = new List <Column>()
            {
                colFacts
            };

            // TODO - Add columns to a ColumnSet
            // Finally add it to the items list

            // TODO - Add facts and two TextBlocks to the items list

            // items go into a container
            Container cntFacts = new Container()
            {
                Items = items
            };

            // container goes into the body of the card
            List <CardElement> crdBody = new List <CardElement>()
            {
                cntFacts
            };

            // TODO - define the action
            SubmitAction btnSubmit = new SubmitAction()
            {
                Title    = "",
                DataJson = ""
            };

            List <ActionBase> submitAction = new List <ActionBase>()
            {
                btnSubmit
            };

            // TODO - add body and actions to a new card

            // Return as an attachment
            return(attachment);
        }