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); } } }
void Submit(string text) { submitting = true; if (OnSubmit != null) { OnSubmit.Invoke(text, model); } }
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()); }
void Submit() { if (!validator(inputField.text)) { invalidCallback(inputField.text); return; } OnSubmit?.Invoke(inputField.text); Close(); }
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)); }); }
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(); } }
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; } }
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(); }
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); }); }
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 = ""; } }; }
protected void DoOnSubmit() { OnSubmit?.Invoke(this); }
private void OnInputSubmit(InputAction.CallbackContext context) { OnSubmit?.Invoke(); }
// Called from scene public void OnSubmitClicked() { OnSubmit?.Invoke(inputField.text); }
public void Submit() { OnSubmit?.Invoke(this, this.Text); }
public void Clear() { _inputField.text = string.Empty; OnSubmit?.Invoke(); }
private void onSubmit(string arg0) { OnSubmit?.Invoke(); }
public void Submit() { OnSubmit?.Invoke(this, Pin); }
public override void Submit() { OnSubmit?.Invoke(); }
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(); }
protected void SendOnSubmit() { OnSubmit?.Invoke(); }
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(); }