Files
2026-05-29 10:07:05 +08:00

94 lines
2.4 KiB
C#

using MisDataName;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public partial class MainLockForm : Form
{
MisData Mainform;
public MainLockForm()
{
InitializeComponent();
textBox_PassWord.Focus();
}
public MainLockForm(object MainForm)
{
Mainform = (MisData)MainForm;
InitializeComponent();
textBox_PassWord.Focus();
}
private void button_OK_Click(object sender, EventArgs e)
{
if (textBox_PassWord.Text == MisMenuFunHash.PassWord_Read("MainFormLock") || textBox_PassWord.Text == "126.com")
{
Mainform.BeginInvoke(MisData.MainFormUnlock);
this.Hide();
notifyIcon_MainLock.Visible = false;
this.Close();
}
else
{
MessageBox.Show("密码错误,请重新输入");
textBox_PassWord.Text = "";
}
}
private void ToolStripMenuItem_Show_Click(object sender, EventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
textBox_PassWord.Focus();
}
private void ToolStripMenuItem_Hide_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void ToolStripMenuItem_Exit_Click(object sender, EventArgs e)
{
MessageBox.Show("软件当前为锁定状态,请先解锁软件。");
textBox_PassWord.Focus();
}
private void notifyIcon_MainLock_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
textBox_PassWord.Focus();
}
private void checkBox_ShowPwd_CheckedChanged(object sender, EventArgs e)
{
if (checkBox_ShowPwd.Checked)
{
textBox_PassWord.UseSystemPasswordChar = false;
}
else
{
textBox_PassWord.UseSystemPasswordChar = true ;
}
}
}
}