178 lines
5.6 KiB
C#
178 lines
5.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
using AllBase;
|
|
using TemuKJD.KJDForms.BaseForms;
|
|
using Work;
|
|
|
|
namespace TemuKJD.UserForm
|
|
{
|
|
public partial class RegeditForm : Form
|
|
{
|
|
public LoginForm lf;
|
|
private Point mouseOffset;//记录鼠标指针的坐标
|
|
private bool isMouseDown;//记录鼠标左键是否按下
|
|
public delegate void delegateView();
|
|
public RegeditForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void label8_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void closePanel_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void panelEx1_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
if (isMouseDown)
|
|
{//获取鼠标的位置
|
|
Point mousePos = MousePosition;
|
|
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
|
|
Location = mousePos;
|
|
}
|
|
}
|
|
|
|
private void panelEx1_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Button == MouseButtons.Left)
|
|
{
|
|
mouseOffset = new Point(-e.X, -e.Y);
|
|
isMouseDown = true;
|
|
}
|
|
}
|
|
|
|
private void panelEx1_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
isMouseDown = false;
|
|
}
|
|
|
|
private void mobile_TextChanged(object sender, EventArgs e)
|
|
{
|
|
mobile.Text = BaseRegex.GetMatchRegexString(mobile.Text, @"([\d]+)");
|
|
}
|
|
|
|
private void code_TextChanged(object sender, EventArgs e)
|
|
{
|
|
code.Text = BaseRegex.GetMatchRegexString(code.Text, @"([\d]+)");
|
|
}
|
|
|
|
private void regeditPanel_Click(object sender, EventArgs e)
|
|
{
|
|
if (mobile.Text.Length != 11)
|
|
{
|
|
BaseMsgForm.ShowInfo("请输入正确的手机号码", "提示");
|
|
mobile.Focus();
|
|
return;
|
|
}
|
|
if (code.Text.Length != 5)
|
|
{
|
|
BaseMsgForm.ShowInfo("请输入正确的验证码", "提示");
|
|
code.Focus();
|
|
return;
|
|
}
|
|
if (password1.Text.Length < 6)
|
|
{
|
|
BaseMsgForm.ShowInfo("请输入长度不小于6位的密码", "提示");
|
|
password1.Focus();
|
|
return;
|
|
}
|
|
if (password1.Text != password2.Text)
|
|
{
|
|
BaseMsgForm.ShowInfo("两次输入的密码不一致", "提示");
|
|
password1.Text = "";
|
|
password2.Text = "";
|
|
password1.Focus();
|
|
return;
|
|
}
|
|
if (userName.Text.Length == 0)
|
|
{
|
|
BaseMsgForm.ShowInfo("请输入你的姓名", "提示");
|
|
userName.Focus();
|
|
return;
|
|
}
|
|
if (email.Text.Length < 3 && !email.Text.Contains("@"))
|
|
{
|
|
BaseMsgForm.ShowInfo("请输入正确的邮箱", "提示");
|
|
email.Focus();
|
|
return;
|
|
}
|
|
string message;
|
|
UserLogin ul = new UserLogin();
|
|
bool ok = ul.Regedit(mobile.Text,password1.Text,code.Text,userName.Text,email.Text,out message);
|
|
if (!ok)
|
|
{
|
|
var formLevel = message.Length > 100 ? FormLevel.LARGE : FormLevel.MEDIUM;
|
|
BaseMsgForm.ShowError(message, "注册错误", formLevel);
|
|
return;
|
|
}
|
|
BaseMsgForm.ShowInfo("恭喜你,注册成功,请牢记你的密码", "注册成功");
|
|
lf.SetMobile(mobile.Text);
|
|
Close();
|
|
}
|
|
|
|
private void sendCodePanel_Click(object sender, EventArgs e)
|
|
{
|
|
string m = mobile.Text;
|
|
if (m.Length != 11)
|
|
{
|
|
BaseMsgForm.ShowInfo("请先输入正确的手机号码\r\n仅支持中国大陆手机号码\r\n请不要加0086", "提示");
|
|
return;
|
|
}
|
|
bool success;
|
|
string message = UserLogin.SendCode(m, out success);
|
|
if (!success)
|
|
{
|
|
BaseMsgForm.ShowInfo(message, "发送短信错误,请联系客服QQ:" + BaseClass.ServiceQQ + " 代开通");
|
|
return;
|
|
}
|
|
BaseMsgForm.ShowInfo("短信发送成功,请不要重复点击,如果收不到短信,可以联系客服QQ:" + BaseClass.ServiceQQ + "", "提示");
|
|
sendCodePanel.Enabled = false;
|
|
new Thread(SetCodeEnable).Start();
|
|
}
|
|
|
|
public void SetCodeEnable()
|
|
{
|
|
Thread.Sleep(20*1000);
|
|
Invoke(new delegateView(SetCodeEnableGet));
|
|
}
|
|
public void SetCodeEnableGet()
|
|
{
|
|
sendCodePanel.Enabled = true;
|
|
|
|
}
|
|
|
|
private void userName_TextChanged(object sender, EventArgs e)
|
|
{
|
|
string temp = BaseRegex.Clear(userName.Text, @"[\s]+");
|
|
if (temp != userName.Text)
|
|
userName.Text = temp;
|
|
}
|
|
|
|
private void RegeditForm_Load(object sender, EventArgs e)
|
|
{
|
|
if (BaseClass.Ico != null)
|
|
Icon = BaseClass.Ico;
|
|
Text = "注册账户 " + BaseClass.ToolName;
|
|
if (BaseClass.LoginImage != null)
|
|
panelEx1.Style.BackgroundImage = BaseClass.LoginImage;
|
|
}
|
|
|
|
private void label9_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|