Esempio n. 1
0
 private void SignUp_btn_Click(object sender, RoutedEventArgs e)
 {
     if (UserName.Text == "" || UserName.Text == null)
     {
         tipWindow tw = new tipWindow("请输入用户名");
         tw.ShowDialog();
         return;
     }
     if (!(System.Text.RegularExpressions.Regex.IsMatch(UserName.Text, @"^[a-zA-Z0-9]+$")))
     {
         tipWindow tw = new tipWindow("用户名只能为字母与数字");
         tw.ShowDialog();
         return;
     }
     else if (FloatingPasswordBox.Password == "" || FloatingPasswordBox.Password == null)
     {
         tipWindow tw = new tipWindow("请输入密码");
         tw.ShowDialog();
         return;
     }
     if (CommunityService.SignUp(UserName.Text, FloatingPasswordBox.Password))
     {
         SignUpSuccess = true;
     }
     else
     {
         SignUpSuccess = false;
         tipWindow tw = new tipWindow("用户名已注册");
         tw.ShowDialog();
     }
     if (SignUpSuccess)
     {
         this.Close();
     }
 }
Esempio n. 2
0
 private void LogIn_btn_Click(object sender, RoutedEventArgs e)
 {
     IsLogIn = LoginUser.SignIn(inputUsername.Text, FloatingPasswordBox.Password);
     if (inputUsername.Text == "" || inputUsername.Text == null)
     {
         tipWindow tw = new tipWindow("请输入用户名");
         tw.ShowDialog();
         return;
     }
     else if (FloatingPasswordBox.Password == "" || FloatingPasswordBox.Password == null)
     {
         tipWindow tw = new tipWindow("请输入密码");
         tw.ShowDialog();
         return;
     }
     if (IsLogIn == true)
     {
         this.Close();
     }
     else
     {
         tipWindow tw = new tipWindow("用户名或密码错误");
         tw.ShowDialog();
     }
 }
 private void Ask_Click(object sender, RoutedEventArgs e)
 {
     if (RewardTextBox.Text == "" || RewardTextBox.Text == null)
     {
         tipWindow tw = new tipWindow("请输入正确的积分");
         tw.ShowDialog();
         return;
     }
     else
     {
         int i;
         if (!int.TryParse(RewardTextBox.Text, out i))
         {
             tipWindow tw = new tipWindow("请输入正确的积分");
             tw.ShowDialog();
             return;
         }
         else
         {
             if (i <= 0)
             {
                 tipWindow tw = new tipWindow("请输入正确的积分");
                 tw.ShowDialog();
                 return;
             }
         }
     }
     if (ContentTextBox.Text == "" || ContentTextBox.Text == null)
     {
         tipWindow tw = new tipWindow("请输入正确的提问");
         tw.ShowDialog();
         return;
     }
     Reward = Convert.ToInt32(RewardTextBox.Text);
     if (Reward > Coin)
     {
         tipWindow tw = new tipWindow("剩余积分不足,当前剩余:" + Coin);
         tw.ShowDialog();
         return;
     }
     QContent = ContentTextBox.Text;
     HasAsked = true;
     this.Close();
 }