Esempio n. 1
0
 private void BtnSend_Click(object sender, RoutedEventArgs e)
 {
     if (client != null)
     {
         string msg = TbText.Text;
         client.Broadcast(msg);
         TbText.Text = "";
         TbText.Focus();
     }
 }
Esempio n. 2
0
        public InputWindow(
            string title,
            string text,
            string tail,
            Func <string, string> check,
            Action <string> onOk,
            bool isPassword)
        {
            _isPassword = isPassword;
            this.Title  = title;
            InitializeComponent();
            this.TbUcName.Text = nameof(InputWindow);
            TbTitle.Text       = title;
            if (isPassword)
            {
                TbText.Visibility     = Visibility.Collapsed;
                PbPassword.Visibility = Visibility.Visible;
                PbPassword.Password   = text;
            }
            else
            {
                TbText.Text = text;
            }
            TbTail.Text = tail;

            var owner = WpfUtil.GetTopWindow();

            if (this != owner)
            {
                this.Owner = owner;
            }
            _check = check;
            _onOk  = onOk ?? throw new ArgumentNullException(nameof(onOk));
            TimeSpan.FromMilliseconds(100).Delay().ContinueWith(t => {
                UIThread.Execute(() => () => {
                    if (isPassword)
                    {
                        PbPassword.Focus();
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(TbText.Text))
                        {
                            TbText.SelectionStart = TbText.Text.Length;
                        }
                        TbText.Focus();
                    }
                });
            });
        }
Esempio n. 3
0
 private void CmsResult_AllCopy_Click(object sender, EventArgs e)
 {
     TbText.SelectAll();
     TbText.Copy();
 }