diff --git a/Data/LanguageManager.cs b/Data/LanguageManager.cs
new file mode 100644
index 0000000..3f3050a
--- /dev/null
+++ b/Data/LanguageManager.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace 睡眠呼吸暂停治疗面罩多功能测试仪.Data
+{
+ public static class LanguageManager
+ {
+ // 私有静态变量,只在首次访问时初始化一次
+ private static readonly string _currentLanguage;
+
+ // 静态构造函数:程序启动时自动执行一次,读取配置
+ static LanguageManager()
+ {
+ // 读取配置文件的Language值,没有的话默认zh-CN
+ _currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+ }
+
+ // 对外只读的全局属性,项目任何地方都能直接调用
+ public static string CurrentLanguage => _currentLanguage;
+
+ // 可选:给个更方便的判断属性,不用每次都写==判断
+ public static bool IsEnglish => _currentLanguage == "en-US";
+ public static bool IsChinese => _currentLanguage == "zh-CN";
+ }
+}
diff --git a/Resources/Strings.en-US.xaml b/Resources/Strings.en-US.xaml
index bdbccde..cb12231 100644
--- a/Resources/Strings.en-US.xaml
+++ b/Resources/Strings.en-US.xaml
@@ -141,6 +141,38 @@
Next page
+
+
+ Manual interface
+ Manual speed(mm/min)
+ Offline
+ settings
+ Tidal volume coefficient
+ Expiratory flow coefficient
+ Inhalation flow coefficient
+ Pressure coefficient
+ Real-time monitoring parameters
+ Location
+ Pressure
+ Exhalation flow rate
+ Inhalation flow rate
+ Shout up!
+ Hold down
+ Inhale
+ Take a deep breath
+ Manual suction
+ Manual call
+ Reset
+ Control operation
+ Test interface
+ Calibration operation
+ Exhalation calibration
+ Inhalation calibration
+ Pressure calibration
+ Basic parameter settings
+
+
+
Workstation curve description:
Test Status
Experimental Report
diff --git a/Resources/Strings.zh-CN.xaml b/Resources/Strings.zh-CN.xaml
index 562bbeb..97e841a 100644
--- a/Resources/Strings.zh-CN.xaml
+++ b/Resources/Strings.zh-CN.xaml
@@ -142,6 +142,39 @@
+
+ 手动界面
+ 手动速度(mm/min)
+ 离线
+ 设置
+ 潮气量系数
+ 呼气流量系数
+ 吸气流量系数
+ 压力系数
+ 实时监测参数
+ 位置
+ 压力
+ 呼气流量
+ 吸气流量
+ 呼上
+ 呼下
+ 吸上
+ 吸下
+ 手动吸
+ 手动呼
+ 复位
+ 控制操作
+ 测试界面
+ 校准操作
+ 呼气校准
+ 吸气校准
+ 压力校准
+ 基础参数设置
+
+
+
+
+
定位移测压力
定压力测位移
峰值测试
diff --git a/Window6.xaml b/Window6.xaml
index deb025d..4e879ed 100644
--- a/Window6.xaml
+++ b/Window6.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:oxy="http://oxyplot.org/wpf"
- Title="手动界面" Height="768" Width="1024"
+ Title="{DynamicResource Manual}" Height="768" Width="1024"
WindowStartupLocation="CenterScreen" Loaded="Window_Loaded"
Background="#F5F7FA" >
@@ -18,7 +18,7 @@
-
+
@@ -76,7 +76,7 @@
-
+
@@ -92,7 +92,7 @@
-
-
-
+
+
-
+
@@ -134,7 +134,7 @@
-
+
@@ -151,48 +151,54 @@
-
-
-
-
+
-
-
+
+
+
-
+
-
+
+
+
-
+
-
+
+
+
-
+
-
+
+
+
-
+
-
+
+
+
@@ -201,7 +207,7 @@ IsReadOnly="True"
-
+
@@ -216,22 +222,22 @@ IsReadOnly="True"
-
+
-
+
-
+
-
+
@@ -251,9 +257,9 @@ IsReadOnly="True"
-
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
diff --git a/Window6.xaml.cs b/Window6.xaml.cs
index 46a557d..e58f97c 100644
--- a/Window6.xaml.cs
+++ b/Window6.xaml.cs
@@ -22,7 +22,7 @@ using System.Windows.Threading;
using OxyPlot.Axes;
using OxyPlot.Legends;
using 口罩泄露定制款;
-
+using 睡眠呼吸暂停治疗面罩多功能测试仪.Data;
namespace ShanghaiEnvironmentalTechnology
{
///
@@ -91,7 +91,7 @@ namespace ShanghaiEnvironmentalTechnology
private TcpClient _tcpClient;
private IModbusMaster _modbusMaster;
private System.Timers.Timer resetTimer; // 启动状态实时定时器
-
+ string currentLang = LanguageManager.CurrentLanguage;
#region 统计相关
private PlotModel _plotModel;
@@ -139,6 +139,7 @@ namespace ShanghaiEnvironmentalTechnology
}
else
{
+
btn1.IsEnabled = true;
btn2.IsEnabled = true;
btn3.IsEnabled = true;
@@ -147,6 +148,7 @@ namespace ShanghaiEnvironmentalTechnology
ResetBtn.Content = _lang == "en-US" ? "Reset" : "复位";
+
ResetBtn.Foreground = Brushes.White;
}
});
@@ -235,7 +237,20 @@ namespace ShanghaiEnvironmentalTechnology
{
if (!IsModbusConnected())
{
- updateAction(_lang == "en-US" ? "Offline" : "离线");
+
+ //updateAction("离线");
+ //// 2. 直接判断是否是英文
+ if (LanguageManager.IsEnglish)
+ {
+ // 英文逻辑
+ updateAction("Offline");
+ }
+ else if (LanguageManager.IsChinese)
+ {
+ // 中文逻辑
+ updateAction("离线");
+ }
+
return;
}
try