This commit is contained in:
gongxh
2022-06-01 14:33:10 +08:00
parent ae42a43f15
commit a7afd29d82
8 changed files with 4436 additions and 269 deletions

View File

@@ -4,6 +4,7 @@ using Krypton.Toolkit;
using LeadDataBaseUtility;
using Newtonsoft.Json;
using NX_LogUtility;
using Scriban;
using System;
using System.Collections.Generic;
using System.Data;
@@ -158,6 +159,12 @@ namespace CleanMachineHMI.Utils
foreach (Control item in lstControls)
{
if (item is KryptonDateTimePicker)
{
continue;
}
var key = form.Name + "|" + item.Name;
if (!Global.ThemeLanguage.ContainsKey(key))
{
@@ -242,6 +249,37 @@ namespace CleanMachineHMI.Utils
}
public static string T(this Control form, string defaultValue, string infoCode, object Param)
{
try
{
var key = form.Name + "|" + infoCode;
var result = defaultValue;
if (!Global.ThemeLanguage.ContainsKey(key))
{
AddzhCN(key, defaultValue, "");
}
else
{
result = Global.ThemeLanguage[key];
}
var template = Template.Parse(result);
return template.Render(Param);
}
catch (Exception ex)
{
LogHelper.WriteLog(ex.Message, LogTypeEum.Err);
return null;
}
}
/// <summary>
/// 获取信息文本
/// </summary>