using JwKdsV.Core; using JwKdsV.Core.Utils; using JwKdsV.Entity.Common; 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 JwKdsV { public partial class LoginOffLineConfirmForm : BaseForm { public LoginOffLineConfirmForm() { InitializeComponent(); } public LoginOffLineConfirmForm(Worker worker) { InitializeComponent(); KeyboardUtils.Instance.RegisterHook(this.AppHookKeyDown); this.timeLabel.Text = string.Format(this.timeLabel.Text, string.Format("{0:yyyy-MM-dd HH:mm:ss dddd}", DateTime.Now)); this.workerLabel.Text = string.Format(this.workerLabel.Text, worker.No + " " + worker.Name); var storeInfo = Global.Instance.StoreInfo; if (storeInfo != null) { this.storeLabel.Text = string.Format(this.storeLabel.Text, storeInfo.StoreNo + " " + storeInfo.StoreName); this.posNoLabel.Text = string.Format(this.posNoLabel.Text, storeInfo.PosNo); } } protected override void AppHookKeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: this.OnAcceptClick(sender, e); break; case Keys.Escape: this.OnResetClick(sender, e); break; } } protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); KeyboardUtils.Instance.UnRegisterHook(this.AppHookKeyDown); } /// /// 确认登录 /// /// /// private void OnAcceptClick(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; } /// /// 重新登录 /// /// /// private void OnResetClick(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } } }