修改语言
This commit is contained in:
@@ -505,7 +505,7 @@ namespace CleanMachineHMI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
lastAlarm[i] = tmpReadAlarmBytArr_D[i];
|
||||
@@ -1195,6 +1195,7 @@ namespace CleanMachineHMI
|
||||
try
|
||||
{
|
||||
#endif
|
||||
if (!this.IsConn) return false;
|
||||
switch (itemType)
|
||||
{
|
||||
case PlcItemTypeDesc.M:
|
||||
@@ -1322,18 +1323,18 @@ namespace CleanMachineHMI
|
||||
#if UseHeartbeat
|
||||
|
||||
|
||||
if (DateTime.Now > HeartbeatTime.AddSeconds(10))//心跳超时
|
||||
if (DateTime.Now > HeartbeatTime.AddSeconds(10))//心跳超时
|
||||
{
|
||||
IsConn = false;
|
||||
//报警处理。
|
||||
frmMainNew.Show_Plc_Alarm("PLC heartbeat data is abnormal, PLC loses connection!");
|
||||
if (ReConnNum % 5 == 0)
|
||||
{
|
||||
IsConn = false;
|
||||
//报警处理。
|
||||
frmMainNew.Show_Plc_Alarm("PLC heartbeat data is abnormal, PLC loses connection!");
|
||||
if (ReConnNum % 5 == 0)
|
||||
{
|
||||
ClosePlcConn();
|
||||
PlcInit();
|
||||
}
|
||||
ReConnNum++;
|
||||
ClosePlcConn();
|
||||
PlcInit();
|
||||
}
|
||||
ReConnNum++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if RELEASE
|
||||
|
||||
@@ -151,36 +151,38 @@ namespace CleanMachineHMI.Utils
|
||||
/// <param name="languageCode">语言编码</param>
|
||||
public static void SetFormControlText(this Control form)
|
||||
{
|
||||
try
|
||||
//try
|
||||
//{
|
||||
var lstControls = GetAllControls(form);
|
||||
lstControls.Add(form);
|
||||
foreach (Control item in lstControls)
|
||||
{
|
||||
var lstControls = GetAllControls(form);
|
||||
lstControls.Add(form);
|
||||
foreach (Control item in lstControls)
|
||||
|
||||
var key = form.Name + "|" + item.Name;
|
||||
if (!Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
var key = form.Name + "|" + item.Name;
|
||||
if (!Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#if DEBUG
|
||||
|
||||
AddzhCN(key, item.Text, "");
|
||||
#endif
|
||||
if (item is KryptonGroupBox)
|
||||
{
|
||||
((KryptonGroupBox)item).Values.Heading = Global.ThemeLanguage[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Text = Global.ThemeLanguage[key];
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item is KryptonGroupBox)
|
||||
{
|
||||
((KryptonGroupBox)item).Values.Heading = Global.ThemeLanguage[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Text = Global.ThemeLanguage[key];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLog(ex.Message, LogTypeEum.Err);
|
||||
}
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// LogHelper.WriteLog(ex.Message, LogTypeEum.Err);
|
||||
//}
|
||||
}
|
||||
|
||||
public static void SetSingleControlText(this Control form, Control control)
|
||||
@@ -193,13 +195,14 @@ namespace CleanMachineHMI.Utils
|
||||
var key = form.Name + "|" + control.Name;
|
||||
if (!Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
AddzhCN(key, control.Text, "");
|
||||
control.Text = control.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Text = Global.ThemeLanguage[key];
|
||||
}
|
||||
AddzhCN(key, control.Text, "");
|
||||
|
||||
|
||||
#if RELEASE
|
||||
}
|
||||
@@ -225,9 +228,10 @@ namespace CleanMachineHMI.Utils
|
||||
var key = formName + "|" + item.Name;
|
||||
if (!Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
AddzhCN(key, item.HeaderText, "");
|
||||
continue;
|
||||
}
|
||||
AddzhCN(key, item.HeaderText, "");
|
||||
|
||||
item.HeaderText = Global.ThemeLanguage[key];
|
||||
}
|
||||
}
|
||||
@@ -251,11 +255,12 @@ namespace CleanMachineHMI.Utils
|
||||
var key = form.Name + "|" + infoCode;
|
||||
if (!Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
AddzhCN(key, defaultValue, "");
|
||||
return defaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddzhCN(key, defaultValue, "");
|
||||
|
||||
return Global.ThemeLanguage[key];
|
||||
}
|
||||
}
|
||||
@@ -273,6 +278,14 @@ namespace CleanMachineHMI.Utils
|
||||
var key = form.Name + "|" + controlCode;
|
||||
if (!Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
var control = (KryptonComboBox)form.Controls.Find(controlCode, true)[0];
|
||||
var str = "";
|
||||
foreach (var item in control.Items)
|
||||
{
|
||||
str += $"{item},";
|
||||
}
|
||||
|
||||
AddzhCN(key, "", string.IsNullOrEmpty(str) ? Global.ThemeLanguage[key] : str.TrimEnd(new char[] { ',' }));
|
||||
return new List<string>();
|
||||
}
|
||||
else
|
||||
@@ -355,12 +368,19 @@ namespace CleanMachineHMI.Utils
|
||||
|
||||
private static void AddzhCN(string key, string name, string options)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
|
||||
if (string.IsNullOrEmpty(name) && string.IsNullOrEmpty(options))
|
||||
{
|
||||
Console.WriteLine(key + "空");
|
||||
return;
|
||||
}
|
||||
var codes = key.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (codes.Length != 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Global.ThemeLanguage.ContainsKey(key))
|
||||
{
|
||||
return;
|
||||
@@ -375,6 +395,7 @@ namespace CleanMachineHMI.Utils
|
||||
var str1 = Newtonsoft.Json.JsonConvert.SerializeObject(_newlyLang);
|
||||
WriteLangFile("newly.json", str1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public class ThemeLanguage
|
||||
|
||||
Reference in New Issue
Block a user