using Tiobon.Core.OPS.Tool.OPS.Tool.Helper; using Tiobon.Core.OPS.Tool.OPS.Tool.Model; using Tiobon.Core.OPS.Tool.OPS.Tool.Src; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; namespace Tiobon.Core.OPS.Tool.OPS.Tool.View { public partial class Frm_Lock : Form { Login_method _Method = new Login_method(); List Configs = new List(); public bool Islock = false; public static Frm_Lock m_Frm_lock = null; private Frm_Lock() { InitializeComponent(); } public static Frm_Lock CreateFrm_lock() { if (m_Frm_lock == null) m_Frm_lock = new Frm_Lock(); return m_Frm_lock; } #region 登录验证 /// /// 登录验证 /// /// /// private void Btn_login_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_password.Text)) { MessageBox.Show("请输入密码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } else { //if (txt_password.Text == $"jianlianmed{DateTime.Now.Day}") if (txt_password.Text == $"1") { Configs = _Method.Loadconfig(); this.Visible = false; //首先判断是否是解锁 if (Islock) { Islock = false; Frm_Main.Createfrm_Main().Visible = true; return; } //判断是否为Windows if (Configs.Count == 1 && Configs.FirstOrDefault().system != "Linux") { Const.config = Configs.FirstOrDefault(); Const.config.tmp_dir = Path.GetTempPath(); Frm_Main.Createfrm_Main().Show(); return; } //启动登录界面 Frm_Login.Create_Login().Show(); } else { MessageBox.Show(this, "密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } #endregion private void Button1_Click(object sender, EventArgs e) { try { Environment.Exit(0); } catch (Exception) { Environment.Exit(0); } } private void Frm_lock_VisibleChanged(object sender, EventArgs e) { this.txt_password.Text = ""; } } }