UI: Fix diaglog popups doubling the window controls and laying text over the menu bar.

This commit is contained in:
Evan Husted 2024-10-17 11:51:40 -05:00
parent 045f9a39bb
commit 430073817c
21 changed files with 75 additions and 60 deletions

View file

@ -95,26 +95,23 @@ namespace Ryujinx.Ava.UI.Views.Main
if (VisualRoot is MainWindow window)
{
Window = window;
DataContext = ViewModel = window.ViewModel;
}
ViewModel = MainWindow.ViewModel;
DataContext = ViewModel;
}
private async void StopEmulation_Click(object sender, RoutedEventArgs e)
{
await MainWindow.ViewModel.AppHost?.ShowExitPrompt().OrCompleted()!;
await ViewModel.AppHost?.ShowExitPrompt().OrCompleted()!;
}
private void PauseEmulation_Click(object sender, RoutedEventArgs e)
{
MainWindow.ViewModel.AppHost?.Pause();
ViewModel.AppHost?.Pause();
}
private void ResumeEmulation_Click(object sender, RoutedEventArgs e)
{
MainWindow.ViewModel.AppHost?.Resume();
ViewModel.AppHost?.Resume();
}
public async void OpenSettings(object sender, RoutedEventArgs e)
@ -178,7 +175,7 @@ namespace Ryujinx.Ava.UI.Views.Main
Window.VirtualFileSystem,
ViewModel.AppHost.Device.Processes.ActiveApplication.ProgramIdText,
name,
MainWindow.ViewModel.SelectedApplication.Path).ShowDialog(Window);
ViewModel.SelectedApplication.Path).ShowDialog(Window);
ViewModel.AppHost.Device.EnableCheats();
}
@ -186,7 +183,7 @@ namespace Ryujinx.Ava.UI.Views.Main
private void ScanAmiiboMenuItem_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
{
if (sender is MenuItem)
ViewModel.IsAmiiboRequested = MainWindow.ViewModel.AppHost.Device.System.SearchingForAmiibo(out _);
ViewModel.IsAmiiboRequested = ViewModel.AppHost.Device.System.SearchingForAmiibo(out _);
}
private async void InstallFileTypes_Click(object sender, RoutedEventArgs e)

View file

@ -26,16 +26,15 @@ namespace Ryujinx.Ava.UI.Views.Main
if (VisualRoot is MainWindow window)
{
Window = window;
DataContext = window.ViewModel;
}
DataContext = MainWindow.ViewModel;
}
private void VsyncStatus_PointerReleased(object sender, PointerReleasedEventArgs e)
{
MainWindow.ViewModel.AppHost.ToggleVSync();
Window.ViewModel.AppHost.ToggleVSync();
Logger.Info?.Print(LogClass.Application, $"VSync toggled to: {MainWindow.ViewModel.AppHost.Device.EnableDeviceVsync}");
Logger.Info?.Print(LogClass.Application, $"VSync toggled to: {Window.ViewModel.AppHost.Device.EnableDeviceVsync}");
}
private void DockedStatus_PointerReleased(object sender, PointerReleasedEventArgs e)
@ -57,9 +56,9 @@ namespace Ryujinx.Ava.UI.Views.Main
private void VolumeStatus_OnPointerWheelChanged(object sender, PointerWheelEventArgs e)
{
// Change the volume by 5% at a time
float newValue = MainWindow.ViewModel.Volume + (float)e.Delta.Y * 0.05f;
float newValue = Window.ViewModel.Volume + (float)e.Delta.Y * 0.05f;
MainWindow.ViewModel.Volume = newValue switch
Window.ViewModel.Volume = newValue switch
{
< 0 => 0,
> 1 => 1,

View file

@ -22,12 +22,11 @@ namespace Ryujinx.Ava.UI.Views.Main
{
base.OnAttachedToVisualTree(e);
if (VisualRoot is MainWindow)
if (VisualRoot is MainWindow window)
{
ViewModel = MainWindow.ViewModel;
DataContext = ViewModel = window.ViewModel;
}
DataContext = ViewModel;
}
public void Sort_Checked(object sender, RoutedEventArgs args)