From 75b42432b9db4fefd3e6997b07907060f45cf454 Mon Sep 17 00:00:00 2001 From: gongxh Date: Mon, 27 Dec 2021 21:59:01 +0800 Subject: [PATCH] 1 --- CleanMachineHMI/CleanMachineHMI.csproj | 4 ++ .../Utils/KeyboardTextBox.Designer.cs | 36 ++++++++++++++++ CleanMachineHMI/Utils/KeyboardTextBox.cs | 41 +++++++++++++++++++ CleanMachineHMI/frmIOMonitor_Old.cs | 5 ++- NX_LogUtility/LogHelper.cs | 30 +++++++------- 5 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 CleanMachineHMI/Utils/KeyboardTextBox.Designer.cs create mode 100644 CleanMachineHMI/Utils/KeyboardTextBox.cs diff --git a/CleanMachineHMI/CleanMachineHMI.csproj b/CleanMachineHMI/CleanMachineHMI.csproj index 01507df..04d1d75 100644 --- a/CleanMachineHMI/CleanMachineHMI.csproj +++ b/CleanMachineHMI/CleanMachineHMI.csproj @@ -411,6 +411,10 @@ frmMainNew.cs + + + KeyboardTextBox.cs + diff --git a/CleanMachineHMI/Utils/KeyboardTextBox.Designer.cs b/CleanMachineHMI/Utils/KeyboardTextBox.Designer.cs new file mode 100644 index 0000000..b12ad75 --- /dev/null +++ b/CleanMachineHMI/Utils/KeyboardTextBox.Designer.cs @@ -0,0 +1,36 @@ +namespace CleanMachineHMI.Utils +{ + partial class KeyboardTextBox + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/CleanMachineHMI/Utils/KeyboardTextBox.cs b/CleanMachineHMI/Utils/KeyboardTextBox.cs new file mode 100644 index 0000000..bbc3ec1 --- /dev/null +++ b/CleanMachineHMI/Utils/KeyboardTextBox.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CleanMachineHMI.Utils +{ + public partial class KeyboardTextBox : Krypton.Toolkit.KryptonTextBox + { + public KeyboardTextBox() + { + InitializeComponent(); + } + + protected override void OnPaint(PaintEventArgs pe) + { + base.OnPaint(pe); + } + + protected override void OnGotFocus(EventArgs e) + { + + base.OnGotFocus(e); + KeyboardAutoPopUp.ShowInputPanel(); + } + + protected override void OnLostFocus(EventArgs e) + { + + base.OnLostFocus(e); + KeyboardAutoPopUp.HideInputPanel(); + } + + + } +} diff --git a/CleanMachineHMI/frmIOMonitor_Old.cs b/CleanMachineHMI/frmIOMonitor_Old.cs index 9904582..709488f 100644 --- a/CleanMachineHMI/frmIOMonitor_Old.cs +++ b/CleanMachineHMI/frmIOMonitor_Old.cs @@ -18,13 +18,14 @@ using System.Windows.Forms; namespace CleanMachineHMI { + [FormType(EnumFormType.IoMonitor)] public partial class frmIOMonitor_Old : KryptonForm { public frmIOMonitor_Old() { InitializeComponent(); _InfoLanguageTextList = this.GetInfoLanguageText(GlobalHelper.LanguageCode, "Label"); - //InitControl(); + InitControl(); } /// /// 页面信息语言文本列表 @@ -44,7 +45,7 @@ namespace CleanMachineHMI { try { - InitControl(); + //InitControl(); Thread th1 = new Thread(ReFreshControl_Y); th1.IsBackground = true; th1.Start(); diff --git a/NX_LogUtility/LogHelper.cs b/NX_LogUtility/LogHelper.cs index a26f3bb..df1abf8 100644 --- a/NX_LogUtility/LogHelper.cs +++ b/NX_LogUtility/LogHelper.cs @@ -44,21 +44,21 @@ namespace NX_LogUtility /// 日志类型(Run:程序运行日志; Err:程序错误日志; DbErr:数据库异常相关日志; OPCRun:OPC运行日志; SocketRun:Socket运行日志; SocErr:Socket异常日志。) public static void WriteLog(string Txt, LogTypeEum logType) { - //获取日志存放位置,年份不同,存放文件夹不同。 - string strDir = System.Environment.CurrentDirectory + "\\NX_CleanMac_Log\\" + DateTime.Now.ToString("yyyy") + "\\"; - //获取时间,年月日。 - string fileDate = DateTime.Now.ToString("yyyy-MM-dd"); - //获取时间,年月。 - string fileDate1 = DateTime.Now.ToString("yyyy-MM"); - //每一年的不同月份日志放在不同的文件夹,同一月份不同类型的日志放于同一个文件夹。 - string strDir1 = strDir + fileDate1 + "\\"; - //每一年的相同月份不同日期的日志放在不同的文件夹 - string strDir2 = strDir1 + fileDate + "\\"; - //不同的日志名称,日志文件不同 - string filePath = strDir2 + fileDate + "_" + logType + ".log"; - string DateString = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); - string Str = "发生时间:" + DateString + "|" + Txt + "\r\n"; - WriteFile(strDir2, filePath, Str); + ////获取日志存放位置,年份不同,存放文件夹不同。 + //string strDir = System.Environment.CurrentDirectory + "\\NX_CleanMac_Log\\" + DateTime.Now.ToString("yyyy") + "\\"; + ////获取时间,年月日。 + //string fileDate = DateTime.Now.ToString("yyyy-MM-dd"); + ////获取时间,年月。 + //string fileDate1 = DateTime.Now.ToString("yyyy-MM"); + ////每一年的不同月份日志放在不同的文件夹,同一月份不同类型的日志放于同一个文件夹。 + //string strDir1 = strDir + fileDate1 + "\\"; + ////每一年的相同月份不同日期的日志放在不同的文件夹 + //string strDir2 = strDir1 + fileDate + "\\"; + ////不同的日志名称,日志文件不同 + //string filePath = strDir2 + fileDate + "_" + logType + ".log"; + //string DateString = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //string Str = "发生时间:" + DateString + "|" + Txt + "\r\n"; + //WriteFile(strDir2, filePath, Str); } private static readonly object lockobj = new object();