118 lines
4.3 KiB
C#
118 lines
4.3 KiB
C#
|
using DotNet4.Utilities;
|
|||
|
using HandyControl.Controls;
|
|||
|
using LiveTools.Data;
|
|||
|
using Microsoft.VisualBasic.ApplicationServices;
|
|||
|
using Microsoft.Win32;
|
|||
|
using Newtonsoft.Json.Linq;
|
|||
|
using ryCommon;
|
|||
|
using ryCommonDb;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows;
|
|||
|
using System.Windows.Controls;
|
|||
|
using System.Windows.Data;
|
|||
|
using System.Windows.Documents;
|
|||
|
using System.Windows.Forms;
|
|||
|
using System.Windows.Input;
|
|||
|
using System.Windows.Media;
|
|||
|
using System.Windows.Media.Imaging;
|
|||
|
using System.Windows.Shapes;
|
|||
|
|
|||
|
namespace LiveTools
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// FrmAddRule.xaml 的交互逻辑
|
|||
|
/// </summary>
|
|||
|
public partial class FrmRegUser : HandyControl.Controls.Window
|
|||
|
{
|
|||
|
public FrmRegUser()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
private string postdata { get; set; } = "";
|
|||
|
private void RegUser()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Config.UserInfo.Cookie = "";
|
|||
|
|
|||
|
HttpResult html = Config.ry_api.Post(Config.Api_Url + "user.aspx", postdata);
|
|||
|
string jsonText = API.GetJson(html.Html);
|
|||
|
Dispatcher.Invoke(new Action(() =>
|
|||
|
{
|
|||
|
TxtUserId.IsEnabled = true;
|
|||
|
txtPwd.IsEnabled = true;
|
|||
|
BtnOK.IsEnabled = true;
|
|||
|
}));
|
|||
|
if (jsonText != "")
|
|||
|
{
|
|||
|
Json json = new Json(jsonText);
|
|||
|
string result = json.GetJsonValue(ConstVar.json_Result);
|
|||
|
if (result == ResultVar.json_Success.ToString())
|
|||
|
{
|
|||
|
Dispatcher.Invoke(new Action(() =>
|
|||
|
{
|
|||
|
HandyControl.Controls.MessageBox.Show(json.GetJsonValue(ConstVar.json_ResultText), "用户注册");
|
|||
|
DialogResult = true;
|
|||
|
}));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Dispatcher.Invoke(new Action(() =>
|
|||
|
{
|
|||
|
HandyControl.Controls.MessageBox.Show(json.GetJsonValue(ConstVar.json_ResultText), "注册失败");
|
|||
|
TxtUserId.IsEnabled = true;
|
|||
|
txtPwd.IsEnabled = true;
|
|||
|
BtnOK.IsChecked = false;
|
|||
|
BtnOK.IsEnabled = true;
|
|||
|
}));
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Dispatcher.Invoke(new Action(() =>
|
|||
|
{
|
|||
|
HandyControl.Controls.MessageBox.Show("服务器异常,请联系管理员", "错误代码:-100000");
|
|||
|
TxtUserId.IsEnabled = true;
|
|||
|
txtPwd.IsEnabled = true;
|
|||
|
BtnOK.IsChecked = false;
|
|||
|
BtnOK.IsEnabled = true;
|
|||
|
}));
|
|||
|
}
|
|||
|
}
|
|||
|
catch(Exception ex)
|
|||
|
{
|
|||
|
Dispatcher.Invoke(new Action(() =>
|
|||
|
{
|
|||
|
HandyControl.Controls.MessageBox.Show("程序出错", "注册失败");
|
|||
|
TxtUserId.IsEnabled = true;
|
|||
|
txtPwd.IsEnabled = true;
|
|||
|
BtnOK.IsChecked = false;
|
|||
|
BtnOK.IsEnabled = true;
|
|||
|
}));
|
|||
|
}
|
|||
|
}
|
|||
|
private void BtnOK_Click(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
TxtUserId.IsEnabled = false;
|
|||
|
txtPwd.IsEnabled = false;
|
|||
|
BtnOK.IsChecked = true;
|
|||
|
BtnOK.IsEnabled = false;
|
|||
|
postdata = "api=reguser&userid=" + RyWeb.WebDecode.Escape(TxtUserId.Text) +
|
|||
|
"&softid=" + RyWeb.WebDecode.Escape(Config.SoftId) + "&nickName=" + RyWeb.WebDecode.Escape(TxtnickName.Text) + "&pwd=" + RyWeb.WebDecode.Escape(txtPwd.Password) + "&email=" + RyWeb.WebDecode.Escape(TxtEmail.Text)
|
|||
|
+ "&phone=" + RyWeb.WebDecode.Escape(TxtPhone.Text) + "&Invite=" + RyWeb.WebDecode.Escape(TxtInvite.Text) + "&hdid=" + RyWeb.WebDecode.Escape(Config.GetMac());
|
|||
|
Thread th = new Thread(RegUser);
|
|||
|
th.Start();
|
|||
|
}
|
|||
|
|
|||
|
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
DialogResult = false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|