コード例 #1
0
        private async Task HandleSubmitAsync()
        {
            if (OnSubmit is object)
            {
                // When using OnSubmit, the developer takes control of the validation lifecycle
                var submitSuccess = await OnSubmit.Invoke(_fixedEditContext);

                if (submitSuccess)
                {
                    await _jsRuntime.InvokeVoidAsync("localStorage.removeItem", Id);
                }
            }
            else
            {
                // Otherwise, the system implicitly runs validation on form submission
                var isValid = _fixedEditContext.Validate(); // This will likely become ValidateAsync later

                if (isValid && OnValidSubmit.HasDelegate)
                {
                    await OnValidSubmit.InvokeAsync(_fixedEditContext);

                    // Clear saved form model from local storage
                    await _jsRuntime.InvokeVoidAsync("localStorage.removeItem", Id);
                }

                if (!isValid && OnInvalidSubmit.HasDelegate)
                {
                    await OnInvalidSubmit.InvokeAsync(_fixedEditContext);
                }
            }
        }
コード例 #2
0
 void Submit(string text)
 {
     submitting = true;
     if (OnSubmit != null)
     {
         OnSubmit.Invoke(text, model);
     }
 }
コード例 #3
0
        private void Setup()
        {
            TextField streamIDText = this.Q <TextField>("StreamIDText");
            Button    submitButton = this.Q <Button>("SubmitButton");
            Button    logoutButton = this.Q <Button>("LogoutButton");

            submitButton.RegisterCallback <ClickEvent>(ev => OnSubmit.Invoke(streamIDText.text));
            logoutButton.RegisterCallback <ClickEvent>(ev => LogoutEvent.Invoke());
        }
コード例 #4
0
ファイル: DialogStringInput.cs プロジェクト: Etabli/DA-GAME
        void Submit()
        {
            if (!validator(inputField.text))
            {
                invalidCallback(inputField.text);
                return;
            }

            OnSubmit?.Invoke(inputField.text);
            Close();
        }
コード例 #5
0
        private void SubmitPersonalPin()
        {
            Commands cmd = new Backend.Commands();
            var      pinVerificationResult = cmd.SetPin(PersonalPin);

            PersonalPin             = null;
            PersonalPinErrorMessage = null;
            if (pinVerificationResult == 1)
            {
                HIOStaticValues.tmain.IsPinRequired = false;
                ShowResetPersonalPin = false;
                if (SetupWizard != null)
                {
                    SetupWizard.MoveNextPage();
                }
                OnSubmit?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                HIOStaticValues.tmain.IsPinRequired = true;
                PersonalPinErrorMessage             = "Wrong pincode";
                switch (pinVerificationResult)
                {
                case 0:
                    PinLockEnd = null;
                    break;

                case -1:
                    PinLockEnd = DateTime.Now.AddMinutes(1);
                    break;

                case -2:
                    PinLockEnd = DateTime.Now.AddMinutes(5);
                    break;

                case -3:
                    PinLockEnd = DateTime.Now.AddMinutes(10);
                    break;

                case -4:
                    PinLockEnd = DateTime.Now.AddHours(1);
                    break;

                default:
                    PersonalPinErrorMessage = null;
                    SetPersonalPinFooterErrorMessage("Something went wrong!");
                    HIOStaticValues.PinInputDashboardVM?.OnPropertyChanged(nameof(PersonalPinFooterErrorMessage));
                    HIOStaticValues.PinInputExtensionVM?.OnPropertyChanged(nameof(PersonalPinFooterErrorMessage));
                    PinLockEnd = null;
                    break;
                }
            }
        }
        private void Setup()
        {
            TextField inputServer   = this.Q <TextField>("InputServer");
            TextField inputEmail    = this.Q <TextField>("InputEmail");
            TextField inputPassword = this.Q <TextField>("InputPassword");
            Button    buttonSubmit  = this.Q <Button>("ButtonSubmit");

            labelError      = this.Q <Label>("LabelError");
            labelError.text = string.Empty;

            buttonSubmit.RegisterCallback <ClickEvent>(ev => {
                this.SetEnabled(false);
                OnSubmit.Invoke(inputServer.text, inputEmail.text, inputPassword.text, (s) => this.SetEnabled(!s));
            });
        }
コード例 #7
0
 public override void Click()
 {
     if (Menu.StaticIsOverButton(submitButton) || EnterPressed)
     {
         if (Value != DefaultValue && !IsDisabled)
         {
             menuArgs = new MenuEventArgs(Value);
             OnSubmit?.Invoke(this, menuArgs);
         }
         EnterPressed = false;
     }
     else
     {
         base.Click();
     }
 }
コード例 #8
0
        private void CallDirectEventSubscribers(Event evt)
        {
            switch (evt.Type)
            {
            case "submit":
                if (OnSubmit?.Invoke(evt) != false && !evt.IsDefaultPrevented())
                {
                    Document.HandleFormSubmit(evt.Target as HtmlFormElement, evt.OriginalTarget as HtmlElement);
                }
                break;

            case "click":
                if (OnClick?.Invoke(evt) != false &&
                    !evt.IsDefaultPrevented() &&
                    evt.Target is HtmlButtonElement button &&
                    button.Type == "submit")
                {
                    button.Form?.RaiseSubmit(evt.Target as HtmlElement);
                }
                break;
            }
        }
コード例 #9
0
        private void textBox_InputAmount_KeyPress(object sender, KeyPressEventArgs e)
        {
            var eKeyChar = e.KeyChar;

            if (!char.IsDigit(eKeyChar) && !char.IsControl(eKeyChar))
            {
                e.Handled = true;
            }
            if (char.IsControl(eKeyChar) && eKeyChar != '\b')
            {
                e.Handled = true;
            }

            if (!char.IsControl(eKeyChar) || eKeyChar != '\r')
            {
                return;
            }

            e.Handled = true;
            OnSubmit?.Invoke(textBox_InputAmount.Text);
            _isSubmitted = true;
            Close();
        }
コード例 #10
0
        private void Submit()
        {
            OnSubmit?.Invoke(this, new IpcInteractionEventArgs(this));
            var json = JsonConvert.SerializeObject(outgoingMessage);

            encoder.Send(json);
            awaitingResponseToSubmittedMessage = true;
            IpcManager.PrepareToReceiveMessage((sender, args) => {
                receivedMessage = args.message;
                if (receivedMessage != null)
                {
                    UnityEngine.Debug.Log("Got response to originating message");
                }
                var evtArgs = new IpcInteractionEventArgs(this);
                UnityEngine.Debug.Log(json);
                OnResolution += (s, e) =>
                {
                    awaitingResponseToSubmittedMessage = false;
                    IpcChannel.Semaphore.Release();
                };
                OnResolution.Invoke(this, evtArgs);
            });
        }
コード例 #11
0
        public ChatInputComponent(
            ComponentGroup componentGroup,
            Vector2 position,
            Vector2 size,
            int fontSize
            ) : base(
                componentGroup,
                position,
                size,
                "",
                "",
                TextureManager.InputFieldBg,
                FontManager.UIFontRegular,
                fontSize
                )
        {
            Text.alignment = TextAnchor.MiddleLeft;

            InputField.characterLimit   = ChatMessage.MaxMessageLength;
            InputField.onValidateInput += (text, index, addedChar) => {
                if (!WhitelistedChars.Contains(addedChar))
                {
                    return('\0');
                }

                return(addedChar);
            };

            MonoBehaviourUtil.Instance.OnUpdateEvent += () => {
                if (Input.GetKeyDown(KeyCode.Return))
                {
                    OnSubmit?.Invoke(InputField.text);

                    InputField.text = "";
                }
            };
        }
コード例 #12
0
ファイル: GrowTextInput.cs プロジェクト: danieloff/GeonBit.UI
 protected void DoOnSubmit()
 {
     OnSubmit?.Invoke(this);
 }
コード例 #13
0
 private void OnInputSubmit(InputAction.CallbackContext context)
 {
     OnSubmit?.Invoke();
 }
コード例 #14
0
 // Called from scene
 public void OnSubmitClicked()
 {
     OnSubmit?.Invoke(inputField.text);
 }
コード例 #15
0
 public void Submit()
 {
     OnSubmit?.Invoke(this, this.Text);
 }
コード例 #16
0
 public void Clear()
 {
     _inputField.text = string.Empty;
     OnSubmit?.Invoke();
 }
コード例 #17
0
 private void onSubmit(string arg0)
 {
     OnSubmit?.Invoke();
 }
コード例 #18
0
 public void Submit()
 {
     OnSubmit?.Invoke(this, Pin);
 }
コード例 #19
0
 public override void Submit()
 {
     OnSubmit?.Invoke();
 }
コード例 #20
0
ファイル: UIInput.cs プロジェクト: Jagerente/GucciGangMod
    private void Append(string input)
    {
        var num    = 0;
        var length = input.Length;

        while (num < length)
        {
            var nextChar = input[num];
            switch (nextChar)
            {
            case '\b':
                if (mText.Length > 0)
                {
                    mText = mText.Substring(0, mText.Length - 1);
                    SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }

                break;

            case '\r':
            case '\n':
                if ((UICamera.current.submitKey0 == KeyCode.Return || UICamera.current.submitKey1 == KeyCode.Return) && (!label.multiLine || !Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)))
                {
                    current = this;
                    onSubmit?.Invoke(mText);
                    if (eventReceiver == null)
                    {
                        eventReceiver = gameObject;
                    }

                    eventReceiver.SendMessage(functionName, mText, SendMessageOptions.DontRequireReceiver);
                    current  = null;
                    selected = false;
                    return;
                }

                if (validator != null)
                {
                    nextChar = validator(mText, nextChar);
                }

                if (nextChar != '\0')
                {
                    if (nextChar == '\n' || nextChar == '\r')
                    {
                        if (label.multiLine)
                        {
                            mText = mText + "\n";
                        }
                    }
                    else
                    {
                        mText = mText + nextChar;
                    }

                    SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }

                break;

            default:
                if (nextChar >= ' ')
                {
                    if (validator != null)
                    {
                        nextChar = validator(mText, nextChar);
                    }

                    if (nextChar != '\0')
                    {
                        mText = mText + nextChar;
                        SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                    }
                }

                break;
            }

            num++;
        }

        UpdateLabel();
    }
コード例 #21
0
ファイル: InputReader.cs プロジェクト: AhTtekan/towerRpg
 protected void SendOnSubmit()
 {
     OnSubmit?.Invoke();
 }
コード例 #22
0
        internal override void OnUpdate()
        {
            m_caretBox.Bounds = new RectangleShape(Bounds.X + 10, Bounds.Y + 10, 0, 0);

            Vector2f mousePosition = TackInput.MousePosition();

            if (TackInput.MouseButtonUp(MouseButtonKey.Left))
            {
                if (mousePosition.X >= Bounds.X && mousePosition.X <= (Bounds.X + Bounds.Width))
                {
                    if (mousePosition.Y >= Bounds.Y && mousePosition.Y <= (Bounds.Y + Bounds.Height))
                    {
                        RequiringInput             = true;
                        TackInput.GUIInputRequired = true;
                    }
                    else
                    {
                        RequiringInput             = false;
                        TackInput.GUIInputRequired = false;
                    }
                }
                else
                {
                    RequiringInput             = false;
                    TackInput.GUIInputRequired = false;
                }
            }

            KeyboardKey[] bufferOperations = TackInput.GetInputBufferArray();

            for (int i = 0; i < bufferOperations.Length; i++)
            {
                if (bufferOperations[i] == KeyboardKey.Enter)
                {
                    if (OnSubmit != null)
                    {
                        if (OnSubmit.GetInvocationList().Length > 0)
                        {
                            OnSubmit.Invoke(this, Text);
                        }
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Left)
                {
                    if (SelectionStart > 0)
                    {
                        SelectionStart -= 1;
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Right)
                {
                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.BackSpace)
                {
                    if (SelectionStart > 0)
                    {
                        Text = Text.Remove((int)SelectionStart - 1, 1);
                    }

                    if (SelectionStart > 0)
                    {
                        SelectionStart -= 1;
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Delete)
                {
                    if (SelectionStart < Text.Length)
                    {
                        Text = Text.Remove((int)SelectionStart, 1);
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Space)
                {
                    Text = Text.Insert((int)SelectionStart, " ");

                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Period)
                {
                    Text = Text.Insert((int)SelectionStart, ".");

                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Quote)
                {
                    Text = Text.Insert((int)SelectionStart, "\"");

                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }
                else if (bufferOperations[i] == KeyboardKey.Minus)
                {
                    if (TackInput.InputBufferShift)
                    {
                        Text = Text.Insert((int)SelectionStart, "_");
                    }
                    else
                    {
                        Text = Text.Insert((int)SelectionStart, "-");
                    }

                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }

                else if (bufferOperations[i] >= KeyboardKey.Number0 && bufferOperations[i] <= KeyboardKey.Number9)
                {
                    Text = Text.Insert((int)SelectionStart, ((char)((int)bufferOperations[i] - 61)).ToString());

                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }
                else if (bufferOperations[i] >= KeyboardKey.A && bufferOperations[i] <= KeyboardKey.Z)
                {
                    if (TackInput.InputBufferCapsLock || TackInput.InputBufferShift)
                    {
                        Text = Text.Insert((int)SelectionStart, ((char)((int)bufferOperations[i] - 18)).ToString());
                    }
                    else
                    {
                        Text = Text.Insert((int)SelectionStart, ((char)((int)bufferOperations[i] + 14)).ToString());
                    }

                    if (SelectionStart < Text.Length)
                    {
                        SelectionStart += 1;
                    }
                }
            }

            TackInput.ClearInputBuffer();
        }