fix: 修复返回引用类型导致的设置保存失败

This commit is contained in:
yaobiao131
2025-06-28 22:20:17 +08:00
parent b8e2fa66f7
commit 03d54ec3a7
2 changed files with 13 additions and 2 deletions

View File

@@ -6,4 +6,15 @@ public class WindowSettings
public double Height { get; set; } = 750; // 默认高度
public double X { get; set; } = double.NaN; // 默认位置未设置
public double Y { get; set; } = double.NaN; // 默认位置未设置
public WindowSettings Clone()
{
return new WindowSettings
{
Width = Width,
Height = Height,
X = X,
Y = Y
};
}
}

View File

@@ -7,12 +7,12 @@ namespace DownKyi.Views;
public partial class MainWindow : Window
{
private readonly WindowSettings _windowSettings;
private WindowSettings _windowSettings;
public MainWindow()
{
InitializeComponent();
_windowSettings = SettingsManager.GetInstance().GetWindowSettings();
_windowSettings = SettingsManager.GetInstance().GetWindowSettings().Clone();
ApplyWindowSettings();
}