//查看数据库中所有的用户
        //private void showUsers()
        //{
        //    var context = new MyDbEntities();
        //    //step1 1
        //    if (context != null)
        //    {
        //        context.Dispose();
        //        context = new MyDbEntities();
        //    }
        //    var q = from t in context.UserTable
        //            select t;
        //    //step 3
        //    //this.dataGrid.ItemsSource = q.ToList();
        //}
        private void R_Submit_Click(object sender, RoutedEventArgs e)
        {
            if (this.R_Name.Text == "" || this.R_password.Text == "" || this.R_password_Confirm.Text == "")
            {
                MessageBox.Show("用户名或密码不能为空!");
            }
            else if (this.R_password.Text != this.R_password_Confirm.Text)
            {
                MessageBox.Show("密码不一致!请重新输入!");
                this.R_password.Text         = "";
                this.R_password_Confirm.Text = "";
            }
            else
            {
                CryptoServiceClient client = new CryptoServiceClient();
                bool flag = client.AddUser(this.R_Name.Text, this.R_password.Text);
                if (flag)
                {
                    MessageBox.Show("success!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("fail!");
                }
                //UserTable user = new UserTable();
                //user.UserName = this.R_Name.Text;
                //user.UserPasswd = this.R_password.Text;
                //user.PrivateKey = this.R_Name.Text + "_privateKey.xml";
                //user.PublicKey = this.R_Name.Text + "_publicKey.xml";
                //CreateKey(this.R_Name.Text);
                ////showUsers();

                //using (var context = new MyDbEntities())
                //{
                //    try
                //    {
                //        context.UserTable.Add(user);
                //        int i = context.SaveChanges();
                //        MessageBox.Show("success!");
                //        this.Close();
                //    }
                //    catch
                //    {
                //        MessageBox.Show("fail!");
                //    }
                //}
            }
        }