Require VFS and CM for SettingsViewModel Init

This commit is contained in:
Isaac Marovitz 2024-02-28 22:19:18 -05:00
parent a8eb25441c
commit f79cff8daa
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
2 changed files with 5 additions and 27 deletions

View file

@ -273,24 +273,17 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
{
_virtualFileSystem = virtualFileSystem;
_contentManager = contentManager;
if (Program.PreviewerDetached)
{
Task.Run(LoadTimeZones);
}
}
public SettingsViewModel()
{
GameDirectories = new AvaloniaList<string>();
TimeZones = new AvaloniaList<TimeZone>();
AvailableGpus = new ObservableCollection<ComboBoxItem>();
_validTzRegions = new List<string>();
_networkInterfaces = new Dictionary<string, string>();
LoadTimeZones();
Task.Run(CheckSoundBackends);
Task.Run(PopulateNetworkInterfaces);
@ -346,7 +339,7 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(PreferredGpuIndex)));
}
public async Task LoadTimeZones()
public void LoadTimeZones()
{
_timeZoneContentManager = new TimeZoneContentManager();
@ -359,15 +352,9 @@ namespace Ryujinx.Ava.UI.ViewModels
string abbr2 = abbr.StartsWith('+') || abbr.StartsWith('-') ? string.Empty : abbr;
await Dispatcher.UIThread.InvokeAsync(() =>
{
TimeZones.Add(new TimeZone($"UTC{hours:+0#;-0#;+00}:{minutes:D2}", location, abbr2));
_validTzRegions.Add(location);
});
}
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(TimeZone)));
}
private async Task PopulateNetworkInterfaces()

View file

@ -26,15 +26,6 @@ namespace Ryujinx.Ava.UI.Windows
Load();
}
public SettingsWindow()
{
ViewModel = new SettingsViewModel();
DataContext = ViewModel;
InitializeComponent();
Load();
}
public void SaveSettings()
{
InputPage.ControllerSettings?.SaveCurrentProfile();