Skip to content

Commit 536f25c

Browse files
committed
Fix old version settings not applying on first launch after upgrade
1 parent a8436f1 commit 536f25c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

IPConfig/App.xaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using IPConfig.Helpers;
1818
using IPConfig.Languages;
1919
using IPConfig.Models;
20+
using IPConfig.Properties;
2021
using IPConfig.ViewModels;
2122
using IPConfig.Views;
2223

@@ -115,6 +116,13 @@ protected override void OnStartup(StartupEventArgs e)
115116
DefaultValue = Current.FindResource(typeof(Window))
116117
});
117118

119+
if (Settings.Default.UpgradeRequired)
120+
{
121+
Settings.Default.Upgrade();
122+
Settings.Default.UpgradeRequired = false;
123+
Settings.Default.Save();
124+
}
125+
118126
var mainWindow = Services.GetRequiredService<MainWindow>();
119127
mainWindow.Show();
120128
}

IPConfig/ViewModels/MainViewModel.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,6 @@ private void Loaded()
146146
{
147147
var cultures = LangSource.GetAvailableCultures().OrderBy(x => x.Name);
148148
Languages = new(cultures);
149-
150-
if (Settings.Default.UpgradeRequired)
151-
{
152-
Settings.Default.Upgrade();
153-
Settings.Default.UpgradeRequired = false;
154-
Settings.Default.Save();
155-
}
156149
}
157150

158151
[RelayCommand]

0 commit comments

Comments
 (0)