98 lines
2.8 KiB
C#
98 lines
2.8 KiB
C#
using DevExpress.Pdf.Native;
|
|
using DevExpress.XtraEditors;
|
|
using LFP_Manager.DataStructure;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace LFP_Manager.Forms
|
|
{
|
|
public partial class FmxPassword : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
#region DELEGATE
|
|
public delegate void PasswordResut(int result);
|
|
#endregion
|
|
|
|
#region VARIABLES
|
|
private CommConfig Config;
|
|
private int result = -1;
|
|
private int mode = 0;
|
|
|
|
public event PasswordResut OnResult = null;
|
|
|
|
#endregion
|
|
|
|
#region CONSTRUCTORS
|
|
public FmxPassword(CommConfig aConfig, int aMode)
|
|
{
|
|
InitializeComponent();
|
|
|
|
Config = aConfig;
|
|
mode = aMode;
|
|
}
|
|
#endregion
|
|
|
|
#region FORM EVENT
|
|
private void FmxPassword_FormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
OnResult?.Invoke(result);
|
|
}
|
|
#endregion
|
|
|
|
#region BUTTON EVENT
|
|
private void BtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void BtnOk_Click(object sender, EventArgs e)
|
|
{
|
|
if (mode == 0)
|
|
{
|
|
if (Config.DisablePassword == TePassword.Text)
|
|
{
|
|
result = 1;
|
|
MessageBox.Show("Anti-Theft Protect Clear Success", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Wrong Password - Try again", "Result", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
else if (mode == 1)
|
|
{
|
|
if (Config.EnablePassword == TePassword.Text)
|
|
{
|
|
result = 1;
|
|
MessageBox.Show("Enable Success", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Wrong Password - Try again", "Result", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
else if (mode == 2)
|
|
{
|
|
if (Config.DisablePassword == TePassword.Text)
|
|
{
|
|
result = 1;
|
|
MessageBox.Show("Disable Success", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Wrong Password - Try again", "Result", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |