0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 17:10:44 -05:00

fix profile wipe checkbox

also fix select folder dialog, removed a commented out property
This commit is contained in:
IsWaffle 2024-07-12 09:38:09 -04:00
parent 8ca094cc56
commit 83a6266845
3 changed files with 16 additions and 14 deletions

View File

@ -18,8 +18,6 @@ namespace SPT.Launcher.ViewModels
[RequireLoggedIn]
public class ProfileViewModel : ViewModelBase
{
// public string CurrentUsername { get; set; }
private string _CurrentEdition;
public string CurrentEdition
{
@ -65,8 +63,6 @@ namespace SPT.Launcher.ViewModels
_monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback);
// CurrentUsername = AccountManager.SelectedAccount.username;
CurrentEdition = AccountManager.SelectedAccount.edition;
CurrentId = AccountManager.SelectedAccount.id;

View File

@ -11,7 +11,9 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Controls.Notifications;
using Avalonia.Platform.Storage;
namespace SPT.Launcher.ViewModels
{
@ -148,18 +150,22 @@ namespace SPT.Launcher.ViewModels
public async Task SelectGameFolderCommand()
{
OpenFolderDialog dialog = new OpenFolderDialog();
dialog.Directory = Assembly.GetExecutingAssembly().Location;
if (Application.Current?.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktop)
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
string? result = await dialog.ShowAsync(desktop.MainWindow);
if (result != null)
var startPath = await desktop.MainWindow.StorageProvider.TryGetFolderFromPathAsync(Assembly.GetExecutingAssembly().Location);
var dir = await desktop.MainWindow.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions()
{
LauncherSettingsProvider.Instance.GamePath = result;
Title = "Select your SPT folder",
SuggestedStartLocation = startPath
});
if (dir == null || dir.Count == 0)
{
return;
}
LauncherSettingsProvider.Instance.GamePath = dir[0].Path.LocalPath;
}
}
}

View File

@ -13,7 +13,7 @@
ProfileInfo="{Binding ProfileInfo}"
CurrentEdition="{Binding CurrentEdition}"
CurrentId="{Binding CurrentId}"
WipeProfileOnStart="{Binding WipeProfileOnStart}"
WipeProfileOnStart="{Binding WipeProfileOnStart, Mode=TwoWay}"
ProfileWipePending="{Binding ProfileWipePending}"
CopyCommand="{Binding CopyCommand}"
ChangeEditionCommand="{Binding ChangeEditionCommand}"