### RaUI V4.0.2606.0401 - *.[新增]QuickWeb新增支持重试次数。 - *.[新增]RySetting类新增支持json格式设置存储和获取。 - *.[新增]RySetting类新增支持读取设置到内存,然后按配置名称读取。 - *.[新增]新增SuperFileSearch类,文件查找。 - *.[新增]QuickWeb新增CurPageUrl属性。 - *.[新增]HardWare新增支持获取显示器信息。 - *.[新增]HardWare新增GetWMI函数。 - *.[改进]QuickWeb类的UA从IE改为Edge。 - *.[改进]Hosts类IP与域名分隔符从\t改为三个空格。 - *.[改进]RyImage的CropOrFill函数,如果输入的长宽比例与原图一致,则返回原图的副本而不是原图。 - *.[改进]RySoft类的CompareVer函数支持特殊格式的版本号。 - *.[改进]QuickWeb的ConvertUrl函数新增支持自动从CurPageUrl获取。 - *.[改进]DateDiff函数对时间差异小于等于10秒的,自动加上毫秒数据。 - *.[修复]修复ObjectListView控件的AspectGetter方法可能调用null对象的问题。 - *.[修复]修复日期选择控件在获取节假日数据时,会因为节假日文件夹无法访问而报错的问题。 - *.[修复]修复某些情况下剪切板权限问题导致ObjectListView控件报错。 - *.[修复]修复RyImage的CropOrFill函数图片比例不一致时,也是返回原图副本的BUG。 ### Itrycn_Project2 V1.0.2606.0401 - *.[改进]将公共调用,无需新增内容的部分代码,改到Public文件夹下
121 lines
4.0 KiB
C#
121 lines
4.0 KiB
C#
using Config;
|
|
using Itrycn_Project2;
|
|
using ryCommon;
|
|
using RyHardWare;
|
|
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;
|
|
|
|
namespace Itrycn
|
|
{
|
|
public partial class FrmLogin : Form
|
|
{
|
|
public delegate void LoginHandler(object sender,out bool LoginSuccess);
|
|
[Description("点击登录按钮时激发")]
|
|
public event LoginHandler OnLoginClick;
|
|
public FrmLogin()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void BtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
private void BtnLogin_Click(object sender, EventArgs e)
|
|
{
|
|
txtUserId.Enabled = false;
|
|
txtPwd.Enabled = false;
|
|
btnLogin.Enabled = false;
|
|
LoginPram.UserId = txtUserId.Text;
|
|
LoginPram.Pwd = txtPwd.Text;
|
|
bool LoginSuccess = false;
|
|
OnLoginClick?.Invoke(this,out LoginSuccess);
|
|
txtUserId.Enabled = true;
|
|
txtPwd.Enabled = true;
|
|
btnLogin.Enabled = true;
|
|
if (LoginSuccess)
|
|
{
|
|
#region 登录成功
|
|
ryCommon.Ini ryIni = new Ini(Soft_ConstInfo.UserDataFolder + "\\Setting.dat");
|
|
if (chkAutoLogin.Checked || chkRememberUserId.Checked)
|
|
{
|
|
ryIni.WriteIni("User", "id", LoginPram.UserId);
|
|
if (chkAutoLogin.Checked)
|
|
{
|
|
LoginPram.isAutoLogin = 2;
|
|
ryIni.WriteIni("User", "pwd", rySafe.AES.Encode("121" + LoginPram.Pwd, RyHardWare.Network.GetMacs() + "|" + LoginPram.UserId));
|
|
}
|
|
else
|
|
{
|
|
LoginPram.isAutoLogin = 1;
|
|
ryIni.DelKey("User", "pwd");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ryIni.DelKey("User", "id");
|
|
LoginPram.isAutoLogin = 0;
|
|
}
|
|
#endregion
|
|
DialogResult = DialogResult.OK;
|
|
}
|
|
}
|
|
|
|
private void TxtPwd_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if(e.KeyCode==Keys.Enter)
|
|
{
|
|
btnLogin.PerformClick();
|
|
}
|
|
}
|
|
|
|
private void FrmLogin_Load(object sender, EventArgs e)
|
|
{
|
|
lblTitle.Text = Soft_ConstInfo.Soft_Title;
|
|
if (System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(Soft_ConstInfo.UserDataFolder)))
|
|
{
|
|
System.IO.Directory.CreateDirectory(Soft_ConstInfo.UserDataFolder);
|
|
}
|
|
ryCommon.Ini ryIni = new Ini(Soft_ConstInfo.UserDataFolder + "\\Setting.dat");
|
|
txtUserId.Text=ryIni.ReadIni("User", "id", LoginPram.UserId);
|
|
if(txtUserId.Text!="")
|
|
{ chkRememberUserId.Checked = true; }
|
|
string pwd = rySafe.AES.Decode(ryIni.ReadIni("User", "pwd", ""), Network.GetMacs() + "|" + txtUserId.Text);
|
|
if (pwd.IndexOf("121") == 0) { pwd = pwd.Substring(3); } else { pwd = ""; }
|
|
txtPwd.Text = pwd;
|
|
if (pwd != "")
|
|
{
|
|
chkAutoLogin.Checked = true;
|
|
txtUserId.Enabled = false;
|
|
txtPwd.Enabled = false;
|
|
btnLogin.PerformClick();
|
|
btnLogin.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
txtUserId.SelectionLength = 0;
|
|
txtUserId.SelectionStart = 0;
|
|
txtPwd.Select();
|
|
}
|
|
}
|
|
|
|
private void ChkAutoLogin_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkAutoLogin.Checked) { chkRememberUserId.Checked = true; }
|
|
}
|
|
}
|
|
public static class LoginPram
|
|
{
|
|
public static string UserId = "";
|
|
public static string Pwd = "";
|
|
public static int isAutoLogin = 0;
|
|
}
|
|
}
|