This commit is contained in:
GukSang.Jin
2026-03-16 19:10:33 +08:00
parent 34083df6de
commit 88a65233a7
26 changed files with 839 additions and 235 deletions

View File

@@ -218,14 +218,12 @@ namespace 自救器呼吸器综合检验仪
// 释放Modbus资源
ModbusResourceManager.Instance?.Dispose();
// 确保应用程序完全退出
Application.Current.Shutdown();
// 延后到当前窗口完成关闭后再统一关停,避免关闭重入。
AppShutdownCoordinator.RequestShutdown();
}
private void Window_Closed(object sender, EventArgs e)
{
//_mainWindow4?.Close();
_mainWindow?.Close();
// 由应用级关停统一处理其他窗口,避免关闭链路重入。
}
private void BtnPrint_Click(object sender, RoutedEventArgs e)
@@ -274,22 +272,16 @@ namespace 自救器呼吸器综合检验仪
// 添加窗口关闭事件处理
windowInstance.Closed += (s, args) =>
{
// 窗口关闭时重新启动定时器并显示当前窗口
this.Show();
this.Activate();
WindowNavigationHelper.RestoreWindow(this);
};
}
else
{
// 激活已存在的窗口(前置显示)
windowInstance.Activate();
WindowNavigationHelper.ShowWithoutWhiteFlash(this, windowInstance);
return;
}
// 4. 切换窗口:隐藏当前窗口,显示目标窗口(非模态)
this.Hide();
windowInstance.Show(); // 使用 Show() 而不是 ShowDialog()
WindowNavigationHelper.ShowWithoutWhiteFlash(this, windowInstance);
}
private void BtnClose_Click(object sender, RoutedEventArgs e)
@@ -297,4 +289,4 @@ namespace 自救器呼吸器综合检验仪
SwitchWindow(ref _mainWindow, () => new MainWindow());
}
}
}
}