mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-11 12:47:51 +02:00

* Add hooks to ApplicationLibrary for loading DLC/updates * Trigger DLC/update load on games refresh * Initial moving of DLC/updates to UI.Common * Use new models in ApplicationLibrary * Make dlc/updates records; use ApplicationLibrary for loading logic * Fix a bug with DLC window; rework some logic * Auto-load bundled DLC on startup * Autoload DLC * Add setting for autoloading dlc/updates * Remove dead code; bind to AppLibrary apps directly in mainwindow * Stub out bulk dlc menu item * Add localization; stub out bulk load updates * Set autoload dirs explicitly * Begin extracting updates to match DLC refactors * Add title update autoloading * Reduce size of settings sections * Better cache lookup for apps * Dont reload entire library on game version change * Remove ApplicationAdded event; always enumerate nsp when autoloading
104 lines
3.3 KiB
C#
104 lines
3.3 KiB
C#
using Avalonia.Controls;
|
|
using FluentAvalonia.Core;
|
|
using FluentAvalonia.UI.Controls;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using Ryujinx.Ava.UI.ViewModels;
|
|
using Ryujinx.HLE.FileSystem;
|
|
using System;
|
|
|
|
namespace Ryujinx.Ava.UI.Windows
|
|
{
|
|
public partial class SettingsWindow : StyleableWindow
|
|
{
|
|
internal SettingsViewModel ViewModel { get; set; }
|
|
|
|
public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
|
|
{
|
|
Title = $"Ryujinx {Program.Version} - {LocaleManager.Instance[LocaleKeys.Settings]}";
|
|
|
|
ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);
|
|
DataContext = ViewModel;
|
|
|
|
ViewModel.CloseWindow += Close;
|
|
ViewModel.SaveSettingsEvent += SaveSettings;
|
|
|
|
InitializeComponent();
|
|
Load();
|
|
}
|
|
|
|
public SettingsWindow()
|
|
{
|
|
ViewModel = new SettingsViewModel();
|
|
DataContext = ViewModel;
|
|
|
|
InitializeComponent();
|
|
Load();
|
|
}
|
|
|
|
public void SaveSettings()
|
|
{
|
|
InputPage.InputView?.SaveCurrentProfile();
|
|
|
|
if (Owner is MainWindow window && (ViewModel.GameDirectoryChanged || ViewModel.AutoloadDirectoryChanged))
|
|
{
|
|
window.LoadApplications();
|
|
}
|
|
}
|
|
|
|
private void Load()
|
|
{
|
|
Pages.Children.Clear();
|
|
NavPanel.SelectionChanged += NavPanelOnSelectionChanged;
|
|
NavPanel.SelectedItem = NavPanel.MenuItems.ElementAt(0);
|
|
}
|
|
|
|
private void NavPanelOnSelectionChanged(object sender, NavigationViewSelectionChangedEventArgs e)
|
|
{
|
|
if (e.SelectedItem is NavigationViewItem navItem && navItem.Tag is not null)
|
|
{
|
|
switch (navItem.Tag.ToString())
|
|
{
|
|
case "UiPage":
|
|
UiPage.ViewModel = ViewModel;
|
|
NavPanel.Content = UiPage;
|
|
break;
|
|
case "InputPage":
|
|
NavPanel.Content = InputPage;
|
|
break;
|
|
case "HotkeysPage":
|
|
NavPanel.Content = HotkeysPage;
|
|
break;
|
|
case "SystemPage":
|
|
SystemPage.ViewModel = ViewModel;
|
|
NavPanel.Content = SystemPage;
|
|
break;
|
|
case "CpuPage":
|
|
NavPanel.Content = CpuPage;
|
|
break;
|
|
case "GraphicsPage":
|
|
NavPanel.Content = GraphicsPage;
|
|
break;
|
|
case "AudioPage":
|
|
NavPanel.Content = AudioPage;
|
|
break;
|
|
case "NetworkPage":
|
|
NavPanel.Content = NetworkPage;
|
|
break;
|
|
case "LoggingPage":
|
|
NavPanel.Content = LoggingPage;
|
|
break;
|
|
default:
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void OnClosing(WindowClosingEventArgs e)
|
|
{
|
|
HotkeysPage.Dispose();
|
|
InputPage.Dispose();
|
|
base.OnClosing(e);
|
|
}
|
|
}
|
|
}
|