diff --git a/App.config b/App.config
index fb0c1f3..0a2370c 100644
--- a/App.config
+++ b/App.config
@@ -2,11 +2,15 @@
-
+
+
-
+
+
+
+
\ No newline at end of file
diff --git a/App.xaml b/App.xaml
index 5041b34..5ca23ca 100644
--- a/App.xaml
+++ b/App.xaml
@@ -22,7 +22,7 @@
-
+
diff --git a/App.xaml.cs b/App.xaml.cs
index dfdc8cf..3b34256 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -1,4 +1,5 @@
using System;
+using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Security.Principal;
@@ -53,6 +54,17 @@ namespace ShanghaiEnvironmentalTechnology
RestartAsAdmin();
Shutdown();
}
+
+ // 加载保存的语言
+ string savedLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+ var resourceDict = new ResourceDictionary
+ {
+ Source = new Uri($"/Resources/Strings.{savedLanguage}.xaml", UriKind.Relative)
+ };
+
+ Current.Resources.MergedDictionaries.Clear();
+ Current.Resources.MergedDictionaries.Add(resourceDict);
+
}
private bool IsRunAsAdmin()
diff --git a/Main.xaml b/Main.xaml
index cd64874..28ec7f5 100644
--- a/Main.xaml
+++ b/Main.xaml
@@ -1,14 +1,51 @@
-
+ Title="{DynamicResource WindowTitle}"
+ Height="768" Width="1024" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">
+
+
+
+
+
+
+
+
+
+
+ 中文
+ English
+
+
+
-
+
@@ -48,4 +86,4 @@
-
+
\ No newline at end of file
diff --git a/Main.xaml.cs b/Main.xaml.cs
index e257373..3530ff6 100644
--- a/Main.xaml.cs
+++ b/Main.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -30,6 +31,27 @@ namespace ShanghaiEnvironmentalTechnology
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(imagePath, UriKind.Absolute));
this.Background = brush;
+
+
+ // 设置语言选择框的默认选中项
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+
+ foreach (ComboBoxItem item in cmbMaterial.Items)
+ {
+ if ((currentLanguage == "zh-CN" && item.Content.ToString() == "中文") ||
+ (currentLanguage == "en-US" && item.Content.ToString() == "English"))
+ {
+ cmbMaterial.SelectedItem = item;
+ break;
+ }
+ }
+
+
+ if (!string.IsNullOrEmpty(currentLanguage))
+ ResourceManager.SwitchLanguage(currentLanguage);
+
+
+
}
///
@@ -46,5 +68,24 @@ namespace ShanghaiEnvironmentalTechnology
this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
}
+
+
+ private void cmbMaterial_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ string selectedText = (cmbMaterial.SelectedItem as ComboBoxItem)?.Content.ToString();
+
+ if (string.IsNullOrEmpty(selectedText))
+ return;
+
+ if (selectedText == "中文" || selectedText == "Chinese")
+ {
+ ResourceManager.SwitchLanguage("zh-CN");
+ }
+ else if (selectedText == "English")
+ {
+ ResourceManager.SwitchLanguage("en-US");
+ }
+
+ }
}
}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 793ae68..efe459f 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -1,7 +1,7 @@
@@ -15,25 +15,25 @@
-
-
-
-
-
-
diff --git a/Resources/ResourceManager.cs b/Resources/ResourceManager.cs
new file mode 100644
index 0000000..3299cff
--- /dev/null
+++ b/Resources/ResourceManager.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Configuration;
+using System.Windows;
+using System.Windows.Controls;
+
+public class ResourceManager
+{
+ //public static void SwitchLanguage(string culture)
+ //{
+ // var uri = new Uri($"/Resources/Strings.{culture}.xaml", UriKind.Relative);
+ // var resourceDict = Application.LoadComponent(uri) as ResourceDictionary;
+
+ // Application.Current.Resources.MergedDictionaries.Clear();
+ // Application.Current.Resources.MergedDictionaries.Add(resourceDict);
+ //}
+
+ public static void SwitchLanguage(string culture)
+ {
+ try
+ {
+ // 保存到App.config
+ var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+ config.AppSettings.Settings["Language"].Value = culture;
+ config.Save(ConfigurationSaveMode.Modified);
+ ConfigurationManager.RefreshSection("appSettings");
+
+ // 切换语言
+ var resourceDict = new ResourceDictionary
+ {
+ Source = new Uri($"/Resources/Strings.{culture}.xaml", UriKind.Relative)
+ };
+
+ Application.Current.Resources.MergedDictionaries.Clear();
+ Application.Current.Resources.MergedDictionaries.Add(resourceDict);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"切换语言失败: {ex.Message}");
+ }
+ }
+}
+
+// 在SelectionChanged中使用
+
+
diff --git a/Resources/Strings.en-US.xaml b/Resources/Strings.en-US.xaml
new file mode 100644
index 0000000..f19508e
--- /dev/null
+++ b/Resources/Strings.en-US.xaml
@@ -0,0 +1,151 @@
+
+
+ Sleep Apnea Treatment Mask Multi-functional Tester
+ Exhaust flow test
+ Air resistance test
+ Asphyxiation prevention valve test
+ Single fault air resistance test
+ Carbon dioxide re-breathing inhalation test
+
+
+ Adjust the set pressure, and the corresponding flow rate at this time
+ Set the pressure:
+ Setting
+ Calibration pressure
+ Real-time traffic flow:
+
+ Real-time Pressure:
+ Record traffic
+ Homepage
+
+ Nasal and oral pressure:
+ Set the flow rate:
+ Connection port calibration
+ Calibration
+ settings
+ Real-time traffic
+ Record air resistance
+ 报表
+
+ Test stopped
+
+ Enter
+ 8# Deformation
+ 9# Deformation
+ 10# Deformation
+ Test Speed
+ Set Pressure
+
+ Parameter Settings
+ Test Speed
+ Test Displacement
+ Trigger Value
+ Set Pressure
+ Reset Down Distance
+ Test Count Setting
+ Test initiation
+ Test stopped
+ Air resistance test
+
+ Reset
+ Test
+ Stop
+ Up
+ Down
+ Zero
+
+ Position to Pressure
+ Pressure to Displacement
+ Peak Test
+ View Report
+ View Curve
+ 中文
+ English
+ Test Date:
+ Calibration
+ Test Time:
+ Sample No:
+ System Parameter
+ Test speed (mm/min)
+ Workstation curve description:
+ Test Status
+ Experimental Report
+ Constant pressure (N)
+ All workstation tests have been completed
+
+ real time data
+ Pressure-deformation relationship curve
+
+ Return
+ System Parameters Settings
+ Device Parameters
+ Reset Speed
+ Manual Speed
+ Pressure Coefficient
+ Pressure Protection
+ Language
+ System Parameters Settings - Modify with caution
+
+
+ mm/min
+ N/V
+ N
+ System Parameters Settings
+
+ Chinese
+ English
+
+ ROUNDS
+ Test Peak Value
+ Maximum Pressure
+
+ Maximum Stroke Soft Limit
+
+ Connection port pressure:
+ It Has Been Crushed
+ Differential Pressure
+
+
+
+
+ Test Date:
+ Test Time:
+ Experimenter:
+ Sample No.:
+
+
+ Position to Pressure (Max Force)
+ Position to Pressure (Deformation)
+ Pressure to Displacement (Deformation)
+ Peak Test (Peak Force)
+ Peak Test (Deformation)
+
+
+ Max Force
+
+
+ Back
+ Print
+ Export
+ Save
+ Close
+
+
+ 1# Maximum Force Value (N)
+ 2# Maximum Force Value (N)
+ 3# Maximum Force Value (N)
+ 4# Maximum Force Value (N)
+ 5# Maximum Force Value (N)
+
+
+ 6# Maximum Force Value (N)
+ 7# Maximum Force Value (N)
+ 8# Maximum Force Value (N)
+ 9# Maximum Force Value (N)
+ 10# Maximum Force Value (N)
+ Peak test (peak force)
+
+
+
\ No newline at end of file
diff --git a/Resources/Strings.zh-CN.xaml b/Resources/Strings.zh-CN.xaml
new file mode 100644
index 0000000..91dbec5
--- /dev/null
+++ b/Resources/Strings.zh-CN.xaml
@@ -0,0 +1,153 @@
+
+
+ 睡眠呼吸暂停治疗面罩多功能测试仪
+ 排气流测试
+ 气阻测试
+ 防室息阀测试
+ 单一故障吸阻力测试
+ 二氧化碳重呼吸吸测试
+
+ 提示: 调节设定压力,该时的流量
+ 设定压力:
+ 设置
+ 校准压力
+
+ 实时流量
+
+ 实时压力
+
+ 记录流量
+ 主页
+ 测试启动
+ 测试停止
+ 连接口压力:
+
+ 鼻口压力:
+ 气阻测试
+ 设定流量
+ 连接口校准
+ 校准
+ 设置
+ 实时流量
+ 记录气阻
+
+ 报表
+
+
+
+
+
+
+ 进入
+ 8#形变量
+ 9#形变量
+ 10#形变量
+ 测试速度
+ 定压压力
+ 已压破
+ 力值判断压差
+
+ 参数设置
+ 测试速度
+ 测试位移
+ 触发值
+ 设置压力
+ 复位向下距离
+ 测试次数设置
+
+ 复位
+ 测试
+ 停止
+ 上升
+ 下降
+ 清零
+
+ 定位移测压力
+ 定压力测位移
+ 峰值测试
+ 查看报表
+ 查看曲线
+ 中文
+ English
+ 校准
+ 测试日期:
+ 测试时间:
+ 测试时间:
+ 测试状态:
+ 工位曲线说明:
+ 全部工位测试完成
+ 压力-变形量关系曲线
+ 实时数据
+
+
+ 返回
+ 系统参数设置
+ 设备参数
+ 上下电机复位速度
+ 上下手动速度
+ 压力系数
+ 压力保护
+ 语言
+ 系统参数设置 - 请谨慎修改
+ 系统参数设置
+
+ mm/min
+ N/V
+ N
+
+
+ 中文
+ English
+
+ 第
+ 系统参数
+ 试验峰值
+ 最大压力
+
+ 最大行程软限位
+
+
+
+ 测试日期:
+ 测试时间:
+ 实验员:
+ 样品编号:
+
+
+ 定位移测压力(最大力值)
+ 定位移测压力(变形量)
+ 定压力测位移(变形量)
+ 峰值测试(峰值力)
+ 峰值测试(变形量)
+ 实验报表
+
+
+ 最大力值
+
+
+ 返回
+ 打印
+ 导出
+ 保存
+ 关闭
+ 测试速度(mm/min)
+ 定压压力(N)
+ 1#最大力值(N)
+ 2#最大力值(N)
+ 3#最大力值(N)
+ 4#最大力值(N)
+ 5#最大力值(N)
+
+ 6#最大力值(N)
+ 7#最大力值(N)
+ 8#最大力值(N)
+ 9#最大力值(N)
+ 10#最大力值(N)
+
+
+ 峰值测试(峰值力)
+
+
+
\ No newline at end of file
diff --git a/Window1.xaml b/Window1.xaml
index 8b339f1..89dff52 100644
--- a/Window1.xaml
+++ b/Window1.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="ShanghaiEnvironmentalTechnology.Window1"
- Title="排气流量测试"
+ Title="{DynamicResource WindowTitle1}"
Height="768" Width="1024" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">
@@ -75,56 +75,56 @@
-
-
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
+
+
+
+
diff --git a/Window1.xaml.cs b/Window1.xaml.cs
index 089de9d..9522938 100644
--- a/Window1.xaml.cs
+++ b/Window1.xaml.cs
@@ -1,7 +1,8 @@
using Microsoft.Win32;
-using Modbus.Device;
using Modbus;
+using Modbus.Device;
using OfficeOpenXml;
+using OxyPlot;
using Sunny.UI;
using System;
using System.ComponentModel.DataAnnotations;
@@ -177,19 +178,36 @@ namespace ShanghaiEnvironmentalTechnology
bool[] result = _modbusMaster?.ReadCoils(0x01, 61, 1);
bool isTestRunning = result != null && result.Length > 0 && result[0];
- TestStartButton.Dispatcher.Invoke(() =>
+ string testStartButtonText = "";
+ string ButtonStatus = "";
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+ if (currentLanguage == "en-US")
{
- if (isTestRunning)
- {
- TestStartButton.Content = "测试启动成功";
- TestStartButton.Foreground = Brushes.LightGreen;
- }
- else
- {
- TestStartButton.Content = "测试启动";
- TestStartButton.Foreground = Brushes.White;
- }
- });
+ testStartButtonText = "Test Start Success";
+ ButtonStatus = "Test initiation";
+ }
+ else if (currentLanguage == "zh-CN")
+ {
+ testStartButtonText = "测试启动成功";
+ ButtonStatus = "测试启动";
+ }
+
+
+
+
+ TestStartButton.Dispatcher.Invoke(() =>
+ {
+ if (isTestRunning)
+ {
+ TestStartButton.Content = testStartButtonText;
+ TestStartButton.Foreground = Brushes.LightGreen;
+ }
+ else
+ {
+ TestStartButton.Content = ButtonStatus;
+ TestStartButton.Foreground = Brushes.White;
+ }
+ });
}
catch (Exception ex)
{
@@ -253,14 +271,43 @@ namespace ShanghaiEnvironmentalTechnology
#endregion
#region UI更新(统一线程安全处理)
+
+ private void UpdateConnectionTextUI(System.Windows.Controls.TextBox textBox, string value)
+ {
+ // 获取当前语言(默认中文)
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+
+ // 多语言提示信息
+ string disconnectMsg = currentLanguage == "en-US" ? "Connection disconnected" : "连接断开";
+
+ // 安全更新UI
+ UpdateUiSafely(() =>
+ textBox.Text = IsModbusConnected() ? value : disconnectMsg
+ );
+ }
+
+ private void UpdateConnectionTextUI(System.Windows.Controls.TextBlock textBox, string value)
+ {
+ // 获取当前语言(默认中文)
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+
+ // 多语言提示信息
+ string disconnectMsg = currentLanguage == "en-US" ? "Connection disconnected" : "连接断开";
+
+ // 安全更新UI
+ UpdateUiSafely(() =>
+ textBox.Text = IsModbusConnected() ? value : disconnectMsg
+ );
+ }
+
+
+
///
/// 更新实时压力UI
///
private void UpdatePressureUI(string value)
{
- UpdateUiSafely(() =>
- RealTimePressureTextBox.Text = IsModbusConnected() ? value : "连接断开"
- );
+ UpdateConnectionTextUI(RealTimePressureTextBox, value);
}
///
@@ -268,33 +315,27 @@ namespace ShanghaiEnvironmentalTechnology
///
private void UpdateSettingUI(string value)
{
- UpdateUiSafely(() =>
- SettingPaTextBox.Text = IsModbusConnected() ? value : "连接断开"
- );
+ UpdateConnectionTextUI(SettingPaTextBox, value);
}
///
/// 更新实时流量UI
///
private void UpdateFlowPressureUI(string value)
{
- UpdateUiSafely(() =>
- txtFolw.Text = IsModbusConnected() ? value : "连接断开"
- );
- }
- private void UpdateStartPressureUI(string value)
- {
- UpdateUiSafely(() =>
- TestStartButton.Content = IsModbusConnected() ? value : "连接断开"
- );
+ UpdateConnectionTextUI(txtFolw, value);
}
+ //private void UpdateStartPressureUI(string value)
+ //{
+ // UpdateUiSafely(() =>
+ // TestStartButton.Content = IsModbusConnected() ? value : "连接断开"
+ // );
+ //}
///
/// 更新实时流量UI
///
private void UpdateFlowFlowUI(string value)
{
- UpdateUiSafely(() =>
- saveFlowTxt.Text = IsModbusConnected() ? value : "连接断开"
- );
+ UpdateConnectionTextUI(saveFlowTxt, value);
}
///
@@ -504,7 +545,7 @@ namespace ShanghaiEnvironmentalTechnology
}
else
{
- MessageBox.Show("Excel导出失败,请检查文件是否被占用", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
+ //MessageBox.Show("Excel导出失败,请检查文件是否被占用", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
@@ -527,7 +568,7 @@ namespace ShanghaiEnvironmentalTechnology
// 用户取消选择则返回
bool? result = saveDialog.ShowDialog(); if (!(result ?? false)) return false;
-
+
// EPPlus 许可设置(.NET 8 必须显式设置)
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; // 非商业用途
@@ -718,12 +759,12 @@ namespace ShanghaiEnvironmentalTechnology
WriteLog($"{logMsg} - 地址:{coilAddress},状态:{value}");
if (!string.IsNullOrEmpty(successMsg))
{
- ShowSuccess(successMsg);
+ //ShowSuccess(successMsg);
}
}
else
{
- ShowError(failMsg);
+ //ShowError(failMsg);
}
}
}
@@ -855,9 +896,9 @@ namespace ShanghaiEnvironmentalTechnology
}
// 消息提示封装
- private void ShowSuccess(string msg) => MessageBox.Show(msg, "成功", MessageBoxButton.OK, MessageBoxImage.Information);
- private void ShowWarning(string msg) => MessageBox.Show(msg, "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
- private void ShowError(string msg) => MessageBox.Show(msg, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
+ //private void ShowSuccess(string msg) => MessageBox.Show(msg, "成功", MessageBoxButton.OK, MessageBoxImage.Information);
+ private void ShowWarning(string msg) => MessageBox.Show(msg, "Instruction", MessageBoxButton.OK, MessageBoxImage.Warning);
+ private void ShowError(string msg) => MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
#endregion
@@ -886,5 +927,16 @@ namespace ShanghaiEnvironmentalTechnology
}
}
+
+ public void RefreshLanguage()
+ {
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+ }
+
+ private string GetLocalizedString(string key)
+ {
+ var resource = Application.Current.TryFindResource(key);
+ return resource?.ToString() ?? key;
+ }
}
}
\ No newline at end of file
diff --git a/Window2.xaml b/Window2.xaml
index 80cf18d..b8adbdd 100644
--- a/Window2.xaml
+++ b/Window2.xaml
@@ -1,7 +1,7 @@
@@ -71,15 +71,15 @@
-
+
-
+
-
-
-
+
+
+
@@ -89,14 +89,14 @@
-
+
-
+
@@ -107,14 +107,14 @@
-
+
-
+
@@ -125,24 +125,24 @@
-
+
-
+
-
+
-
+
@@ -150,10 +150,10 @@
-
-
-
-
+
+
+
+
diff --git a/Window2.xaml.cs b/Window2.xaml.cs
index deb4b9d..6fd0e74 100644
--- a/Window2.xaml.cs
+++ b/Window2.xaml.cs
@@ -239,16 +239,33 @@ namespace ShanghaiEnvironmentalTechnology
bool[] result = _modbusMaster?.ReadCoils(0x01, 81, 1);
bool isTestRunning = result != null && result.Length > 0 && result[0];
+ string testStartButtonText = "";
+ string ButtonStatus = "";
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+ if (currentLanguage == "en-US")
+ {
+ testStartButtonText = "Test Start Success";
+ ButtonStatus = "Test initiation";
+ }
+ else if (currentLanguage == "zh-CN")
+ {
+ testStartButtonText = "测试启动成功";
+ ButtonStatus = "测试启动";
+ }
+
+
+
+
TestStartButton.Dispatcher.Invoke(() =>
{
if (isTestRunning)
{
- TestStartButton.Content = "测试启动成功";
+ TestStartButton.Content = testStartButtonText;
TestStartButton.Foreground = Brushes.LightGreen;
}
else
{
- TestStartButton.Content = "测试启动";
+ TestStartButton.Content = ButtonStatus;
TestStartButton.Foreground = Brushes.White;
}
});
@@ -317,13 +334,49 @@ namespace ShanghaiEnvironmentalTechnology
#endregion
#region UI更新(线程安全处理)
+
+
+
+ private void UpdateConnectionTextUI(System.Windows.Controls.TextBox textBox, string value)
+ {
+ // 获取当前语言(默认中文)
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+
+ // 多语言提示信息
+ string disconnectMsg = currentLanguage == "en-US" ? "Connection disconnected" : "连接断开";
+
+ // 安全更新UI
+ UpdateUiSafely(() =>
+ textBox.Text = IsModbusConnected() ? value : disconnectMsg
+ );
+ }
+
+ private void UpdateConnectionTextUI(System.Windows.Controls.TextBlock textBox, string value)
+ {
+ // 获取当前语言(默认中文)
+ string currentLanguage = ConfigurationManager.AppSettings["Language"] ?? "zh-CN";
+
+ // 多语言提示信息
+ string disconnectMsg = currentLanguage == "en-US" ? "Connection disconnected" : "连接断开";
+
+ // 安全更新UI
+ UpdateUiSafely(() =>
+ textBox.Text = IsModbusConnected() ? value : disconnectMsg
+ );
+ }
+
+
+
+
+
+
///
/// 更新连接口压力UI
///
private void UpdatePressureUI(string value)
{
UpdateUiSafely(() =>
- RealTimePressureTextBox.Text = IsModbusConnected() ? value : "连接断开"
+ UpdateConnectionTextUI(RealTimePressureTextBox, value)
);
}
@@ -333,7 +386,7 @@ namespace ShanghaiEnvironmentalTechnology
private void UpdateNoseUI(string value)
{
UpdateUiSafely(() =>
- NoseTxt.Text = IsModbusConnected() ? value : "连接断开"
+ UpdateConnectionTextUI(NoseTxt, value)
);
}
@@ -343,7 +396,7 @@ namespace ShanghaiEnvironmentalTechnology
private void UpdateFlowUI(string value)
{
UpdateUiSafely(() =>
- flowTxt.Text = IsModbusConnected() ? value : "连接断开"
+ UpdateConnectionTextUI(flowTxt, value)
);
}
@@ -470,7 +523,7 @@ namespace ShanghaiEnvironmentalTechnology
}
else
{
- MessageBox.Show("Excel导出失败,请检查文件是否被占用", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
+ //MessageBox.Show("Excel导出失败,请检查文件是否被占用", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
@@ -493,7 +546,7 @@ namespace ShanghaiEnvironmentalTechnology
// 用户取消选择则返回
bool? result = saveDialog.ShowDialog(); if (!(result ?? false)) return false;
-
+
// EPPlus 许可设置(.NET 8 必须显式设置)
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; // 非商业用途
diff --git a/Window5.xaml.cs b/Window5.xaml.cs
index 97b873f..68001b8 100644
--- a/Window5.xaml.cs
+++ b/Window5.xaml.cs
@@ -895,91 +895,7 @@ namespace ShanghaiEnvironmentalTechnology
#endregion
#region
- /////
- ///// 呼吸比设置(OutTxt和InTxt)
- /////
- //private async void Button_Click(object sender, RoutedEventArgs e)
- //{
- // if (!IsModbusConnected())
- // {
- // ShowError("Modbus TCP 未连接");
- // return;
- // }
- // // 输入验证
- // if (!int.TryParse(OutTxt.Text.Trim(), out int outValue) ||
- // !int.TryParse(InTxt.Text.Trim(), out int inValue))
- // {
- // ShowWarning("请输入有效的整数");
- // return;
- // }
- // if (outValue < 0 || outValue > 10000 || inValue < 0 || inValue > 10000)
- // {
- // ShowWarning("值范围应为 0~10000");
- // return;
- // }
-
- // try
- // {
- // // 显示操作中状态
- // OutTxt.Text = "操作中...";
- // InTxt.Text = "操作中...";
-
- // // 写入两个非连续寄存器
- // _modbusMaster.WriteSingleRegister(0x01, _outAddress, (ushort)outValue);
- // _modbusMaster.WriteSingleRegister(0x01, _inAddress, (ushort)inValue);
-
- // await Task.Delay(300); // 等待PLC处理
- // RefreshFlowPressure(); // 刷新显示
-
- // ShowSuccess($"设置呼吸比: {outValue}-{inValue}");
- // }
- // catch (Exception ex)
- // {
- // ShowError($"设置失败: {ex.Message}");
- // }
- // finally
- // {
- // OutTxt.Text = outValue.ToString();
- // InTxt.Text = inValue.ToString();
- // }
- //}
-
- /////
- ///// 潮气量设置(moistureTxt)
- /////
- //private async void Button_Click_1(object sender, RoutedEventArgs e)
- //{
- // await WriteSingleRegisterWithUI(
- // inputControl: moistureTxt,
- // registerAddress: _moistureTxtAddress,
- // successMessage: value => $"设置潮气量: {value} L"
- // );
- //}
-
- /////
- ///// 呼吸频率设置(respiratoryRateTxt)
- /////
- //private async void Button_Click_2(object sender, RoutedEventArgs e)
- //{
- // await WriteSingleRegisterWithUI(
- // inputControl: respiratoryRateTxt,
- // registerAddress: _respiratoryRateAddress,
- // successMessage: value => $"设置呼吸频率: {value}"
- // );
- //}
-
- /////
- ///// 频率系数设置(frequencyTxt)
- /////
- //private async void Button_Click_3(object sender, RoutedEventArgs e)
- //{
- // await WriteSingleRegisterWithUI(
- // inputControl: frequencyTxt,
- // registerAddress: _frequencyAddress,
- // successMessage: value => $"设置频率系数: {value}"
- // );
- //}
///
/// 返回主窗口
diff --git a/睡眠多功能.csproj b/睡眠呼吸暂停治疗面罩多功能测试仪.csproj
similarity index 100%
rename from 睡眠多功能.csproj
rename to 睡眠呼吸暂停治疗面罩多功能测试仪.csproj
diff --git a/睡眠多功能.sln b/睡眠多功能.sln
index 75c6503..9f0ad2b 100644
--- a/睡眠多功能.sln
+++ b/睡眠多功能.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.9.34728.123
+# Visual Studio Version 18
+VisualStudioVersion = 18.2.11408.102 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "睡眠多功能", "睡眠多功能.csproj", "{BC48015F-9837-4AEB-91B7-FB7085706537}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "睡眠呼吸暂停治疗面罩多功能测试仪", "睡眠呼吸暂停治疗面罩多功能测试仪.csproj", "{BC48015F-9837-4AEB-91B7-FB7085706537}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution