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; using DevComponents.DotNetBar.Controls; using POS.Language.Language; using POSV.Component; using POSV.Entity; using POSV.Utils; namespace POSV { public partial class PasswdConfirm : BusinessForm { private readonly Authc _authc = null; public PasswdConfirm(Authc authc) { InitializeComponent(); this._authc = authc; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.controlBox.Text = LangProxy.ToLang("初始化系统"); this.lblTenant.Text = string.Format(this.lblTenant.Tag.ToString() , this._authc.TenantId); this.lblPosNo.Text = string.Format(this.lblPosNo.Tag.ToString() , this._authc.PosNo); this.lblStoreNo.Text = string.Format(this.lblStoreNo.Tag.ToString() , this._authc.StoreNo); this.lblStoreName.Text = string.Format(this.lblStoreName.Tag.ToString() , this._authc.StoreName); } protected override void OnShown(EventArgs e) { base.OnShown(e); this.txtPasswd.Multiline = false; this.txtPasswd.Focus(); this.txtPasswd.SelectAll(); } private void OnControlBoxCloseClick(object sender, EventArgs e) { if (this.Owner != null) { this.Owner.Close(); } this.Close(); } private void OnButtonOKClick(object sender , EventArgs e) { if (string.IsNullOrEmpty(this.txtPasswd.Text.Trim())) { this.ShowMessage(this.lblInfo , "请输入安全密码..." , true); return; } var passwd = string.Format("{0}{1}" , this._authc.TenantId , DateTime.Now.ToString("yyyyMMdd")); if (passwd.Equals(this.txtPasswd.Text.Trim())) { //1、校验通过 var data = new Tuple(true,this._authc); //发送参数到前台界面 this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept , "accept" , data)); //关闭窗口 this.OnControlBoxCloseClick(sender , EventArgs.Empty); } else { this.ShowMessage(this.lblInfo , "安全密码输入错误..." , true); return; } } private void OnButtonCancelClick(object sender , EventArgs e) { this.OnControlBoxCloseClick(sender , EventArgs.Empty); } private void OnAcceptCheckedChanged(object sender , EventArgs e) { var item = (CheckBoxX)sender; this.ButtonOK.Enabled = item.Checked; } private void OnPasswdEnterClick(object sender , Component.EnterEventArg e) { this.OnButtonOKClick(this.ButtonOK , EventArgs.Empty); } private void OnTouchBeforeClick(object sender , TouchEventArgs e) { } private void OnTouchClick(object sender , TouchEventArgs e) { switch (e.Value) { case "clear": //如果当前焦点控件是输入框 if (this.ActiveControl is NumericTextBox) { var activeControl = this.ActiveControl as NumericTextBox; activeControl.Text = string.Empty; } break; default: { InputSimulatorUtils.SendKey(KeyCodes.Map[e.Value]); } break; } } } }