private async void DoLogin(object sender, RoutedEventArgs e)
        {
            var data = new LoginData()
            {
                username = UserName, password = Password, remember = RememberMe
            };

            if (CaptchaRequired)
            {
                data.captcha = Captcha;
            }

            if (await Submit?.Invoke(this, data))
            {
                NotLogged = false;

                Animations.StartFadeAnimation(backdrop, this, FADE_DELAY, false);

                var accounts = Globals.Accounts[UsedFor];
                accounts.Active = UserName;
                if (RememberMe || accounts[UserName] != null)
                {
                    accounts[UserName] = Password;
                }
            }
        }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        if (emojiAsset && emojiAsset.spriteGlyphTable.Count > 0)
        {
            float x = emojiAsset.spriteGlyphTable[0].glyphRect.width;
            float y = emojiAsset.spriteGlyphTable[0].glyphRect.height;
            Panel.cellSize = new Vector2(x, y);
            (Panel.transform as RectTransform).sizeDelta = new Vector2(column * x, row * y);


            foreach (var item in emojiAsset.spriteGlyphTable)
            {
                GameObject    ele   = Instantiate(emojiElementTemplate);
                RectTransform trans = ele.GetComponent <RectTransform>();
                trans.SetParent(Panel.transform);
                trans.localPosition = Vector3.zero;
                trans.localScale    = Vector3.one;
                trans.sizeDelta     = new Vector2(item.glyphRect.width, item.glyphRect.width);
                Image img = ele.GetComponent <Image>();
                img.sprite = item.sprite;

                Button but = ele.GetComponent <Button>();
                but.onClick.AddListener(() =>
                {
                    Submit.Invoke("<sprite=" + item.index + ">");
                    Panel.gameObject.SetActive(false);
                });

                ele.SetActive(true);
            }
        }
    }
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)            // Enter
            {
                Submit?.Invoke();
                e.Handled = true;
                return;
            }

            if (e.KeyChar == 8)            // BackSpace
            {
                if (Text.Length > 0)
                {
                    Text = Text.Substring(0, Text.Length - 1);
                }
                e.Handled = true;
                return;
            }

            if (char.IsLetterOrDigit(e.KeyChar) || char.IsSymbol(e.KeyChar) || char.IsWhiteSpace(e.KeyChar))
            {
                Text += e.KeyChar;
            }

            base.OnKeyPress(e);
        }
 protected virtual void OnSubmit()
 {
     if (Submit != null)
     {
         Submit.Invoke(this, EventArgs.Empty);
     }
 }
 void succAnim_Completed(object sender, EventArgs e)
 {
     wait = false;
     if (Submit != null)
     {
         Submit.Invoke(this, new RoutedEventArgs());
     }
 }
Beispiel #6
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     SelectedIndex = Submit?.Invoke(this, new SubmitEventArgs(ContentCombo.SelectedIndex,
                                                              ContentCombo.SelectedIndex >= 0?Choices[ContentCombo.SelectedIndex].Key:null,
                                                              ContentCombo.SelectedIndex >= 0?Choices[ContentCombo.SelectedIndex].Value:null
                                                              )) ?? ContentCombo.SelectedIndex;
     Editstatus = false;
 }
 private void jmeno_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (Submit != null)
         {
             Submit.Invoke(this, new RoutedEventArgs());
         }
     }
 }
 /// <summary>
 /// 提交更改。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     //提交更改会发送包含被选择内容的布尔列表。需要回执一个列表表示实际内容。
     bool[] newselected = new bool[selected.Length];
     for (int i = 0; i < newselected.Length; ++i)
     {
         newselected[i] = writecontents[i].IsChecked ?? false;
     }
     SetSelects(Submit?.Invoke(this, new SubmitEventArgs(newselected)));
     Editstatus = false;
 }
Beispiel #9
0
        protected override void OnPreviewKeyDown(KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                var be = GetBindingExpression(TextProperty);

                be?.UpdateSource();

                Submit?.Invoke(this, EventArgs.Empty);
            }

            base.OnPreviewKeyDown(e);
        }
        protected override bool OnClick(View view)
        {
            if (view.Id == Resource.Id.btnSendSms)
            {
                ViewModel !.SendSms.Invoke();
                return(true);
            }
            else if (view.Id == Resource.Id.btnSubmit)
            {
                ViewModel !.Submit.Invoke();
                return(true);
            }

            return(base.OnClick(view));
        }
        private void Btn_Touch(object sender, TouchEventArgs e)
        {
            var btn = sender as Button;

            switch (e.Event.Action)
            {
            case MotionEventActions.Down:
                //btn.CompoundDrawableTintMode = PorterDuff.Mode.Multiply;
                //btn.CompoundDrawableTintList = new ColorStateList(
                //  new[] { StateSet.WildCard.ToArray() },
                //  new[] { new Color(BgColor.R - 30, BgColor.G - 30, BgColor.B - 30, (byte)200).ToArgb() });
                break;

            case MotionEventActions.Up:
                //btn.CompoundDrawableTintMode = PorterDuff.Mode.Multiply;
                //btn.CompoundDrawableTintList = new ColorStateList(
                //  new[] { StateSet.WildCard.ToArray() },
                //  new[] { Color.White.ToArgb() });
                Submit?.Invoke(this, rbGroup.CheckedRadioButtonId);
                break;
            }
        }
        private new EditState KeyPressed(Event e)
        {
            bool onlyControl = (e.control || e.command) && !e.shift && !e.alt;

            switch (e.keyCode)
            {
            case KeyCode.Home:
                if (e.control || e.command)
                {
                    MoveTextStart(e.shift);
                }
                else
                {
                    var startOfLine = caretSelectPositionInternal <= 2 ? 0 : text.LastIndexOf('\n', caretSelectPositionInternal - 2) + 1;
                    if (!e.shift)
                    {
                        caretPositionInternal = startOfLine;
                    }
                    caretSelectPositionInternal = startOfLine;
                }
                return(EditState.Continue);

            case KeyCode.End:
                if (e.control || e.command)
                {
                    MoveTextEnd(e.shift);
                }
                else
                {
                    var endOfLine = caretSelectPositionInternal + 1 >= text.Length ? text.Length : text.IndexOf('\n', caretSelectPositionInternal + 1);
                    if (endOfLine < 0)
                    {
                        endOfLine = text.Length;
                    }
                    if (!e.shift)
                    {
                        caretPositionInternal = endOfLine;
                    }
                    caretSelectPositionInternal = endOfLine;
                }
                return(EditState.Continue);

            case KeyCode.Backspace when onlyControl:
                ProcessEvent(Event.KeyboardEvent("^#left"));
                ProcessEvent(Event.KeyboardEvent("backspace"));
                return(EditState.Continue);

            case KeyCode.Delete when onlyControl:
                ProcessEvent(Event.KeyboardEvent("^#right"));
                ProcessEvent(Event.KeyboardEvent("backspace"));
                return(EditState.Continue);

            case KeyCode.Z when onlyControl:
                UndoManager.State state = undoManager.Undo();
                if (state != null)
                {
                    text          = state.Text;
                    caretPosition = state.CursorPosition;
                }
                return(EditState.Continue);

            case KeyCode.Y when onlyControl:
                UndoManager.State state2 = undoManager.Redo();
                if (state2 != null)
                {
                    text          = state2.Text;
                    caretPosition = state2.CursorPosition;
                }
                return(EditState.Continue);

            default:
                switch (e.character)
                {
                case '\t':
                    var e2 = new TabPressedEventArgs();
                    TabPressed?.Invoke(this, e2);
                    if (e2.SuppressKeyPress)
                    {
                        return(EditState.Continue);
                    }
                    goto default;

                case '\n':
                case '\r':
                    if (e.control || e.command)
                    {
                        Submit?.Invoke(this, EventArgs.Empty);
                        return(EditState.Finish);
                    }
                    goto default;

                default:
                    return(base.KeyPressed(e));
                }
            }
        }
Beispiel #13
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     Text       = Submit?.Invoke(this, new SubmitEventArgs(ContentText.Text)) ?? ContentText.Text;
     Editstatus = false;
 }
Beispiel #14
0
 private void OnSubmitClick(object sender, RoutedEventArgs e)
 {
     Submit?.Invoke(results);
 }
 private void submitAction(object obj, EventArgs arg) => Submit?.Invoke();
Beispiel #16
0
 /// <summary>
 /// This is called when the user presses the key assigned in Style.SubmitKey.
 /// </summary>
 public virtual void OnSubmit()
 {
     Submit?.Invoke(this, EventArgs.Empty);
 }
Beispiel #17
0
 protected virtual void OnClick(String s)
 {
     Submit?.Invoke(this, s);
 }