This commit is contained in:
2026-03-21 16:40:32 +08:00
2 changed files with 24 additions and 8 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
Closing="Window_Closing" Closing="Window_Closing"
Closed="Window_Closed" Closed="Window_Closed"
PreviewKeyDown="Main_Grid_PreviewKeyDown" PreviewKeyDown="Main_Grid_PreviewKeyDown"
Height="9000" Width="1440" Height="16000" Width="1440"
FontFamily="Microsoft YaHei UI" FontFamily="Microsoft YaHei UI"
MouseWheel="Window_MouseWheel" MouseWheel="Window_MouseWheel"
Foreground="{DynamicResource FloatBarForeground}" Foreground="{DynamicResource FloatBarForeground}"
@@ -41,16 +41,16 @@ namespace Ink_Canvas
// 应用当前主题 // 应用当前主题
ApplyCurrentTheme(); ApplyCurrentTheme();
// 折叠浮动工具栏 // 隐藏主窗口
CollapseFloatingBar(); HideMainWindow();
LoadVersions(); LoadVersions();
} }
/// <summary> /// <summary>
/// 折叠主窗口的浮动工具栏 /// 隐藏主窗口
/// </summary> /// </summary>
private async void CollapseFloatingBar() private void HideMainWindow()
{ {
try try
{ {
@@ -58,13 +58,13 @@ namespace Ink_Canvas
var mainWindow = Application.Current.MainWindow as MainWindow; var mainWindow = Application.Current.MainWindow as MainWindow;
if (mainWindow != null) if (mainWindow != null)
{ {
// 调用折叠方法 // 隐藏主窗口
await mainWindow.FoldFloatingBar(null); mainWindow.Visibility = Visibility.Hidden;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogHelper.WriteLogToFile($"折叠浮动工具栏时出错: {ex.Message}", LogHelper.LogType.Error); LogHelper.WriteLogToFile($"隐藏主窗口时出错: {ex.Message}", LogHelper.LogType.Error);
} }
} }
@@ -346,6 +346,22 @@ namespace Ink_Canvas
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
{ {
downloadCts?.Cancel(); downloadCts?.Cancel();
try
{
// 获取主窗口实例
var mainWindow = Application.Current.MainWindow as MainWindow;
if (mainWindow != null)
{
// 重新显示主窗口
mainWindow.Visibility = Visibility.Visible;
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"显示主窗口时出错: {ex.Message}", LogHelper.LogType.Error);
}
base.OnClosing(e); base.OnClosing(e);
} }