Remove event logic in favour of single init function.

This commit is contained in:
MutantAura 2024-09-04 21:39:37 +01:00
parent ca59c3f499
commit 9cef4ceba4
3 changed files with 8 additions and 38 deletions

View file

@ -120,7 +120,6 @@ namespace Ryujinx.Ava
private readonly object _lockObject = new();
public event EventHandler AppExit;
public event EventHandler<StatusInitEventArgs> StatusInitEvent;
public event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
public VirtualFileSystem VirtualFileSystem { get; }
@ -1044,14 +1043,14 @@ namespace Ryujinx.Ava
public void InitStatus()
{
StatusInitEvent?.Invoke(this, new StatusInitEventArgs(
ConfigurationState.Instance.Graphics.GraphicsBackend.Value switch
_viewModel.BackendText = ConfigurationState.Instance.Graphics.GraphicsBackend.Value switch
{
GraphicsBackend.Vulkan => "Vulkan",
GraphicsBackend.OpenGl => "OpenGL",
_ => throw new NotImplementedException()
},
$"GPU: {_renderer.GetHardwareInfo().GpuDriver}"));
};
_viewModel.GpuNameText = $"GPU: {_renderer.GetHardwareInfo().GpuDriver}";
}
public void UpdateStatus()

View file

@ -1,16 +0,0 @@
using System;
namespace Ryujinx.Ava.UI.Models
{
internal class StatusInitEventArgs : EventArgs
{
public string GpuBackend { get; }
public string GpuName { get; }
public StatusInitEventArgs(string gpuBackend, string gpuName)
{
GpuBackend = gpuBackend;
GpuName = gpuName;
}
}
}

View file

@ -1182,7 +1182,6 @@ namespace Ryujinx.Ava.UI.ViewModels
{
RendererHostControl.WindowCreated += RendererHost_Created;
AppHost.StatusInitEvent += Init_StatusBar;
AppHost.StatusUpdatedEvent += Update_StatusBar;
AppHost.AppExit += AppHost_AppExit;
@ -1209,18 +1208,6 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
private void Init_StatusBar(object sender, StatusInitEventArgs args)
{
if (ShowMenuAndStatusBar && !ShowLoadProgress)
{
Dispatcher.UIThread.InvokeAsync(() =>
{
GpuNameText = args.GpuName;
BackendText = args.GpuBackend;
});
}
}
private void Update_StatusBar(object sender, StatusUpdatedEventArgs args)
{
if (ShowMenuAndStatusBar && !ShowLoadProgress)