|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace POSV.Component
|
|
|
|
|
{
|
|
|
|
|
[ToolboxItem(true)]
|
|
|
|
|
public partial class TitleControlBox : BaseUserControl
|
|
|
|
|
{
|
|
|
|
|
public TitleControlBox()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
|
|
|
|
|
|
|
|
|
this.ForeColor = NewForeColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
|
|
|
|
|
if (this.DesignMode) return;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前程序集版本
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string Version
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Application.ProductVersion.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string _text = "巨为收银";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 窗口标题
|
|
|
|
|
/// </summary>
|
|
|
|
|
public override string Text
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._text = value;
|
|
|
|
|
|
|
|
|
|
this.lblTitle.Text = _text;
|
|
|
|
|
if (this._showApplicationVersion)
|
|
|
|
|
{
|
|
|
|
|
this.lblTitle.Text = this._text + "V" + this.Version;
|
|
|
|
|
}
|
|
|
|
|
this.lblTitle.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
get { return this._text; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Color _foreColor = Color.White;
|
|
|
|
|
public Color NewForeColor
|
|
|
|
|
{
|
|
|
|
|
get { return this._foreColor; }
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._foreColor = value;
|
|
|
|
|
|
|
|
|
|
this.lblTitle.ForeColor = this._foreColor;
|
|
|
|
|
|
|
|
|
|
this.lblTitle.Invalidate();
|
|
|
|
|
|
|
|
|
|
this.lblClose.SymbolColor = this._foreColor;
|
|
|
|
|
this.lblKeyboard.SymbolColor = this._foreColor;
|
|
|
|
|
this.lblMin.SymbolColor = this._foreColor;
|
|
|
|
|
this.lblSettings.SymbolColor = this._foreColor;
|
|
|
|
|
this.lblQrCode.SymbolColor = this._foreColor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private bool _minimizeBox = true;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示最小化按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool MinimizeBox
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._minimizeBox;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._minimizeBox = value;
|
|
|
|
|
|
|
|
|
|
this.lblMin.Visible = this._minimizeBox;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _closeBox = true;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示关闭按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool CloseBox
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._closeBox;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._closeBox = value;
|
|
|
|
|
|
|
|
|
|
this.lblClose.Visible = this._closeBox;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _settingsBox = false;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示设置按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool SettingsBox
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._settingsBox;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._settingsBox = value;
|
|
|
|
|
|
|
|
|
|
this.lblSettings.Visible = this._settingsBox;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _showNetworkStatus = true;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示网路连接
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowNetworkStatus
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showNetworkStatus;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showNetworkStatus = value;
|
|
|
|
|
this.lblNetworkStatus.Visible = this._showNetworkStatus;
|
|
|
|
|
this.lblNetworkStatus.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _network = false;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 网络检测默认的标题文字
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool NetworkStatus
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._network = value;
|
|
|
|
|
|
|
|
|
|
this.lblNetworkStatus.Symbol = value ? Constant.ONLINE : Constant.OFFLINE;
|
|
|
|
|
this.lblNetworkStatus.SymbolColor = value ? Color.Green : Color.Red;
|
|
|
|
|
this.lblNetworkStatus.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
get { return this._network; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _showApplicationVersion = true;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示网路连接
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowApplicationVersion
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showApplicationVersion;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showApplicationVersion = value;
|
|
|
|
|
|
|
|
|
|
this.lblTitle.Text = _text;
|
|
|
|
|
if (this._showApplicationVersion)
|
|
|
|
|
{
|
|
|
|
|
this.lblTitle.Text = this._text + "V" + this.Version;
|
|
|
|
|
}
|
|
|
|
|
this.lblTitle.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ControlBoxEventAction _eventAction = ControlBoxEventAction.None;
|
|
|
|
|
|
|
|
|
|
public ControlBoxEventAction Action
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _eventAction;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void EventHandler(object sender, EventArgs e);
|
|
|
|
|
public event EventHandler CloseClick;
|
|
|
|
|
public event EventHandler MinimizedClick;
|
|
|
|
|
public event EventHandler IconClick;
|
|
|
|
|
public event EventHandler SettingsClick;
|
|
|
|
|
public event EventHandler LockedClick;
|
|
|
|
|
public event EventHandler QRCodeClick;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭按钮事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected virtual void OnCloseClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.Closed;
|
|
|
|
|
|
|
|
|
|
CloseClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 最小化按钮事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected virtual void OnMinimizedClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.Minimized;
|
|
|
|
|
MinimizedClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Settings点击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected virtual void OnSettingsClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.Setting;
|
|
|
|
|
SettingsClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ICON点击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected virtual void OnIconClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.Icon;
|
|
|
|
|
IconClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnMinTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnMinimizedClick(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnCloseTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnCloseClick(e);
|
|
|
|
|
}
|
|
|
|
|
private void OnIconTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnIconClick(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnSettingsTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnSettingsClick(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void WindowMoveEventHandler(object sender, MouseEventArgs e);
|
|
|
|
|
|
|
|
|
|
public event WindowMoveEventHandler WindowMoveClick;
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseDown(MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnMouseDown(e);
|
|
|
|
|
|
|
|
|
|
WindowMoveClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _showKeyboard = false;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示键盘按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowKeyboard
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showKeyboard;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showKeyboard = value;
|
|
|
|
|
|
|
|
|
|
this.lblKeyboard.Visible = this._showKeyboard;
|
|
|
|
|
this.lblKeyboard.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _showMessageCenter = false;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示消息中心连接状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowMessageCenter
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showMessageCenter;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showMessageCenter = value;
|
|
|
|
|
|
|
|
|
|
this.lblMessageCenter.Visible = this._showMessageCenter;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _messageCenter = false;
|
|
|
|
|
public bool MessageCenterStatus
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._messageCenter = value;
|
|
|
|
|
|
|
|
|
|
this.lblMessageCenter.Symbol = "\uf0e8";
|
|
|
|
|
this.lblMessageCenter.SymbolColor = this._messageCenter ? Color.Green : Color.Red;
|
|
|
|
|
this.lblMessageCenter.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
get { return this._messageCenter; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public event EventHandler KeyboardClick;
|
|
|
|
|
private void OnKeyboardTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnKeyboardClick(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void OnKeyboardClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.None;
|
|
|
|
|
KeyboardClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _showLockScreen = false;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示锁屏按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowLockScreen
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showLockScreen;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showLockScreen = value;
|
|
|
|
|
|
|
|
|
|
this.lblLockScreen.Visible = value;
|
|
|
|
|
|
|
|
|
|
this.lblLockScreen.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void OnLockedClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.Locked;
|
|
|
|
|
LockedClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnLockTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnLockedClick(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool _showQrCode = false;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否显示锁屏按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ShowQrCode
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this._showQrCode;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this._showQrCode = value;
|
|
|
|
|
|
|
|
|
|
this.lblQrCode.Visible = value;
|
|
|
|
|
|
|
|
|
|
this.lblQrCode.Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnQrCodeTouchClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnQrCodeClick(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void OnQrCodeClick(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this._eventAction = ControlBoxEventAction.QrCode;
|
|
|
|
|
QRCodeClick?.Invoke(this, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|