public Window1()
        {
            InitializeComponent();

            //textBoxUserName.Text = "admin";
            //passwordBoxPassword.Password = "******";
            //textBoxUserName.Text = "18600757116";
            //passwordBoxPassword.Password = "******";
            string[] user = UserCacheUtil.LoadUserNameAndPassword();
            if (user != null && user.Length > 1)
            {
                textBoxUserName.Text         = user[0];
                passwordBoxPassword.Password = user[1];
            }
        }
        private void buttonLogin_Click(object sender, RoutedEventArgs e)
        {
            //MainWindow 上传列表Wnd = new MainWindow();
            //上传列表Wnd.Loaded += delegate
            //{
            //    Visibility = Visibility.Hidden;
            //};
            //上传列表Wnd.ShowDialog();

            //return;

            {
                bool userNameMissing = textBoxUserName.Text.Trim() == textBoxUserName.Tag.ToString() || textBoxUserName.Text.Trim() == string.Empty;
                bool passwordMissing = passwordBoxPassword.Password.Trim() == string.Empty;

                if (userNameMissing && passwordMissing)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        MessageBox.Show("请输入用户名和密码。");
                    }));

                    return;
                }
                if (userNameMissing)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        MessageBox.Show("请输入用户名。");
                    }));

                    return;
                }
                if (passwordMissing)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        MessageBox.Show("请输入密码。");
                    }));

                    return;
                }
                //if (!IsPhoneNumberValid())
                if (false)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        MessageBox.Show("请正确输入11位手机号。");
                    }));
                    return;
                }
            }

            labelWaitLogin.Content = "正在登陆,请稍候";
            PauseGUI();

            LoginRequest LoginRequest = new LoginRequest();

            LoginRequest.UserName = textBoxUserName.Text;
            LoginRequest.Password = passwordBoxPassword.Password;
            LoginRequest.Sender   = "PC Client";

            UserCacheUtil.SaveUserNameAndPassword(textBoxUserName.Text, passwordBoxPassword.Password);
            ThreadPool.QueueUserWorkItem(delegate
            {
                attemptCount = 0;

                AttemptLogin(LoginRequest, attemptCount);
            });
        }