Skip to content

Commit 1147b11

Browse files
committed
Fix codes not being saved (oops)
1 parent 206673f commit 1147b11

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

SA-Mod-Manager/UI/MainWindow.xaml.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ private async void MainWindowManager_Loaded(object sender, RoutedEventArgs e)
181181
suppressEvent = false;
182182
}
183183

184+
private void ClearCodesList()
185+
{
186+
if (CodeListView is not null)
187+
{
188+
CodeListView.BeginInit();
189+
CodeListView.Items.Clear();
190+
codesSearch?.Clear();
191+
EnabledCodes?.Clear();
192+
CodeListView.EndInit();
193+
}
194+
}
195+
184196
private void MainForm_FormClosing(object sender, EventArgs e)
185197
{
186198
App.CancelUpdate = true;
@@ -2013,14 +2025,7 @@ private void LoadModList()
20132025
codes = new List<Code>(mainCodes.Codes);
20142026
codesSearch = [];
20152027

2016-
if (CodeListView is not null)
2017-
{
2018-
CodeListView.BeginInit();
2019-
CodeListView.Items.Clear();
2020-
codesSearch?.Clear();
2021-
EnabledCodes?.Clear();
2022-
CodeListView.EndInit();
2023-
}
2028+
20242029

20252030
//if game path hasn't been set, give up the process of loading mods.
20262031

@@ -2905,10 +2910,12 @@ private bool DoGameSwap(Game newGame = null, string newPath = null)
29052910
if (newGame is not null)
29062911
{
29072912
EnabledMods.Clear();
2908-
EnabledCodes.Clear();
2913+
ClearCodesList();
29092914
App.CurrentGame = newGame;
29102915
GamesInstall.HandleGameSwap(newGame, newPath);
29112916
Load(newPath is not null);
2917+
2918+
29122919
return true;
29132920
}
29142921
else
@@ -2919,10 +2926,11 @@ private bool DoGameSwap(Game newGame = null, string newPath = null)
29192926
{
29202927
App.ManagerSettings.CurrentSetGame = ComboGameSelection.SelectedIndex;
29212928
EnabledMods.Clear();
2922-
EnabledCodes.Clear();
2929+
ClearCodesList();
29232930
App.CurrentGame = game;
29242931
GamesInstall.HandleGameSwap(game, newPath);
29252932
Load(newPath is not null);
2933+
29262934
return true;
29272935
}
29282936
}

0 commit comments

Comments
 (0)