Skip to content

Commit

Permalink
Resolved bug preventing user profiles from properly transferring corr…
Browse files Browse the repository at this point in the history
…ectly.
  • Loading branch information
ItsEasyActually committed Feb 6, 2025
1 parent bb81944 commit 27de4fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion SA-Mod-Manager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public partial class App : Application

public static string ManagerConfigFile = Path.Combine(ConfigFolder, "Manager.json");
public static ManagerSettings ManagerSettings { get; set; }
public static Profiles Profiles { get; set; }
public static Profiles Profiles { get; set; } = new Profiles();

private static readonly Mutex mutex = new(true, pipeName);
public static Updater.UriQueue UriQueue;
Expand Down
39 changes: 20 additions & 19 deletions SA-Mod-Manager/UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public MainWindow()
InitializeComponent();
UpdateDLLData();
GraphicsManager.SetupGraphics();
ProfileManager.ValidateProfileFolder();

try
{
Expand Down Expand Up @@ -108,13 +107,13 @@ private async void MainWindowManager_Loaded(object sender, RoutedEventArgs e)

ViewModel.Games = App.GamesList;
DataContext = ViewModel;

Load();
SetBindings(); //theme is set here

suppressEvent = true;
App.GamesList.Add(GamesInstall.AddGame);
ComboGameSelection.SelectedItem = App.CurrentGame;
suppressEvent = false;
Load();
SetBindings(); //theme is set here
suppressEvent = false;
if (string.IsNullOrEmpty(App.CurrentGame?.modDirectory) == false)
{
var oneClick = new OneClickInstall(updatePath);
Expand Down Expand Up @@ -177,9 +176,8 @@ private async void MainWindowManager_Loaded(object sender, RoutedEventArgs e)
App.isVanillaTransition = false;
UIHelper.ToggleButton(ref btnCheckUpdates, true);


// Save Manager Settings
Save();
// Save Manager Settings
Save();
suppressEvent = false;

}
Expand Down Expand Up @@ -1768,7 +1766,7 @@ public void Load(bool newSetup = false)
{
if (ComboGameSelection?.SelectedItem == null)
{
if (App.GamesList is not null && (App.CurrentGame.loader is null || Directory.Exists(App.CurrentGame.gameDirectory) == false))
if (GamesInstall.IsGameListEmpty() && (App.CurrentGame.loader is null || Directory.Exists(App.CurrentGame.gameDirectory) == false))
{
if (App.Current.MainWindow is not null && GamesInstall.IsGameListEmpty() == false)
((MainWindow)App.Current.MainWindow).ComboGameSelection_SetNewItem(App.GamesList[0]);
Expand All @@ -1779,12 +1777,12 @@ public void Load(bool newSetup = false)
if (newSetup || App.isFirstBoot)
ProfileManager.CreateProfiles();

ProfileManager.SetProfile();

if (App.CurrentGame.id != GameEntry.GameType.Unsupported)
{
// Set the existing profiles to the ones from the loaded Manager Settings.
LoadGameSettings(newSetup);
// Set the existing profiles to the ones from the loaded Manager Settings.
ProfileManager.ValidateProfileFolder();
ProfileManager.SetProfile();
LoadGameSettings(newSetup);
UpdateManagerIcons();
UpdateManagerInfo();
if (!App.isVanillaTransition)
Expand Down Expand Up @@ -2337,12 +2335,15 @@ private void SetManagerBindings()
Source = App.ManagerSettings,
Mode = BindingMode.TwoWay
});
comboProfile.ItemsSource = App.Profiles.ProfilesList;
comboProfile.DisplayMemberPath = "Name";
comboProfile.SetBinding(ComboBox.SelectedIndexProperty, new Binding("ProfileIndex")
{
Source = App.Profiles
});
if (App.Profiles.ProfilesList is not null)
{
comboProfile.ItemsSource = App.Profiles.ProfilesList;
comboProfile.DisplayMemberPath = "Name";
comboProfile.SetBinding(ComboBox.SelectedIndexProperty, new Binding("ProfileIndex")
{
Source = App.Profiles
});
}
comboLanguage.SetBinding(ComboBox.SelectedIndexProperty, new Binding("Language")
{
Source = App.ManagerSettings
Expand Down

0 comments on commit 27de4fe

Please sign in to comment.