You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.3 KiB
C#

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);
}
/// <summary>
/// 确认登录
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnAcceptClick(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// 重新登录
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnResetClick(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
}