aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/Ui/Windows
diff options
context:
space:
mode:
authorEmmanuel Hansen <emmausssss@gmail.com>2022-07-11 22:25:33 +0000
committerGitHub <noreply@github.com>2022-07-12 00:25:33 +0200
commit7d9a5feccbedc32dfeec00478c3a67ffff26dc60 (patch)
treec22b5d5eb5535824b4b5e54b137df1cf70c1b5f2 /Ryujinx.Ava/Ui/Windows
parent14ae4e276f81aa6511fb6d00c8d7b9998a88a1c8 (diff)
Avalonia - Couple fixes and improvements (#3451)
* fix updater check crash * remove line * reduce cheat window sizes * enable tiered compilation and r2r * remove warning on LaunchState * remove warnings related to tasks * addressed review * undo csproj indentation * fix tabs in axaml file * remove double line * remove R2R
Diffstat (limited to 'Ryujinx.Ava/Ui/Windows')
-rw-r--r--Ryujinx.Ava/Ui/Windows/CheatWindow.axaml14
-rw-r--r--Ryujinx.Ava/Ui/Windows/DlcManagerWindow.axaml.cs13
-rw-r--r--Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs13
-rw-r--r--Ryujinx.Ava/Ui/Windows/TitleUpdateWindow.axaml.cs15
4 files changed, 39 insertions, 16 deletions
diff --git a/Ryujinx.Ava/Ui/Windows/CheatWindow.axaml b/Ryujinx.Ava/Ui/Windows/CheatWindow.axaml
index 1685ee80..a5a4b0ee 100644
--- a/Ryujinx.Ava/Ui/Windows/CheatWindow.axaml
+++ b/Ryujinx.Ava/Ui/Windows/CheatWindow.axaml
@@ -7,7 +7,6 @@
xmlns:model="clr-namespace:Ryujinx.Ava.Ui.Models"
xmlns:window="clr-namespace:Ryujinx.Ava.Ui.Windows"
mc:Ignorable="d"
- SizeToContent="Height"
Width="500" MinHeight="500" Height="500"
WindowStartupLocation="CenterOwner"
MinWidth="500">
@@ -45,6 +44,13 @@
VerticalAlignment="Stretch"
Name="CheatsView"
MinHeight="300">
+ <TreeView.Styles>
+ <Styles>
+ <Style Selector="TreeViewItem:empty /template/ ItemsPresenter">
+ <Setter Property="IsVisible" Value="False"/>
+ </Style>
+ </Styles>
+ </TreeView.Styles>
<TreeView.DataTemplates>
<TreeDataTemplate DataType="model:CheatsList" ItemsSource="{Binding}">
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
@@ -56,9 +62,9 @@
</StackPanel>
</TreeDataTemplate>
<DataTemplate x:DataType="model:CheatModel">
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
- <CheckBox IsChecked="{Binding IsEnabled}" MinWidth="20" />
- <TextBlock Text="{Binding CleanName}" />
+ <StackPanel Orientation="Horizontal" Margin="0" HorizontalAlignment="Left">
+ <CheckBox IsChecked="{Binding IsEnabled}" Padding="0" Margin="5,0" MinWidth="20" />
+ <TextBlock Text="{Binding CleanName}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</TreeView.DataTemplates>
diff --git a/Ryujinx.Ava/Ui/Windows/DlcManagerWindow.axaml.cs b/Ryujinx.Ava/Ui/Windows/DlcManagerWindow.axaml.cs
index cb2ed324..7450c64f 100644
--- a/Ryujinx.Ava/Ui/Windows/DlcManagerWindow.axaml.cs
+++ b/Ryujinx.Ava/Ui/Windows/DlcManagerWindow.axaml.cs
@@ -2,6 +2,7 @@ using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
+using Avalonia.Threading;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
@@ -21,6 +22,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
+using System.Threading.Tasks;
using Path = System.IO.Path;
namespace Ryujinx.Ava.Ui.Windows
@@ -125,15 +127,18 @@ namespace Ryujinx.Ava.Ui.Windows
}
catch (Exception ex)
{
- ContentDialogHelper.CreateErrorDialog(this,
+ Dispatcher.UIThread.InvokeAsync(async () =>
+ {
+ await ContentDialogHelper.CreateErrorDialog(this,
string.Format(LocaleManager.Instance[
"DialogDlcLoadNcaErrorMessage"], ex.Message, containerPath));
+ });
}
return null;
}
- private void AddDlc(string path)
+ private async Task AddDlc(string path)
{
if (!File.Exists(path) || Dlcs.FirstOrDefault(x => x.ContainerPath == path) != null)
{
@@ -175,7 +180,7 @@ namespace Ryujinx.Ava.Ui.Windows
if (!containsDlc)
{
- ContentDialogHelper.CreateErrorDialog(this, LocaleManager.Instance["DialogDlcNoDlcErrorMessage"]);
+ await ContentDialogHelper.CreateErrorDialog(this, LocaleManager.Instance["DialogDlcNoDlcErrorMessage"]);
}
}
}
@@ -214,7 +219,7 @@ namespace Ryujinx.Ava.Ui.Windows
{
foreach (string file in files)
{
- AddDlc(file);
+ await AddDlc(file);
}
}
}
diff --git a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
index bea84e3b..2b5c10e2 100644
--- a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
+++ b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
@@ -120,8 +120,6 @@ namespace Ryujinx.Ava.Ui.Windows
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
LoadGameList();
-
- CheckLaunchState();
}
_rendererWaitEvent = new AutoResetEvent(false);
@@ -451,7 +449,7 @@ namespace Ryujinx.Ava.Ui.Windows
RefreshFirmwareStatus();
}
- protected async void CheckLaunchState()
+ protected void CheckLaunchState()
{
if (ShowKeyErrorOnLoad)
{
@@ -470,7 +468,7 @@ namespace Ryujinx.Ava.Ui.Windows
if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false, this))
{
- await Updater.BeginParse(this, false).ContinueWith(task =>
+ Updater.BeginParse(this, false).ContinueWith(task =>
{
Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}");
}, TaskContinuationOptions.OnlyOnFaulted);
@@ -537,6 +535,13 @@ namespace Ryujinx.Ava.Ui.Windows
LoadHotKeys();
}
+ protected override void OnOpened(EventArgs e)
+ {
+ base.OnOpened(e);
+
+ CheckLaunchState();
+ }
+
public static void UpdateGraphicsConfig()
{
int resScale = ConfigurationState.Instance.Graphics.ResScale;
diff --git a/Ryujinx.Ava/Ui/Windows/TitleUpdateWindow.axaml.cs b/Ryujinx.Ava/Ui/Windows/TitleUpdateWindow.axaml.cs
index edc1abcd..e465dc6e 100644
--- a/Ryujinx.Ava/Ui/Windows/TitleUpdateWindow.axaml.cs
+++ b/Ryujinx.Ava/Ui/Windows/TitleUpdateWindow.axaml.cs
@@ -24,6 +24,7 @@ using System.Text;
using Path = System.IO.Path;
using SpanHelpers = LibHac.Common.SpanHelpers;
using LibHac.Tools.FsSystem;
+using Avalonia.Threading;
namespace Ryujinx.Ava.Ui.Windows
{
@@ -151,14 +152,20 @@ namespace Ryujinx.Ava.Ui.Windows
}
else
{
- ContentDialogHelper.CreateErrorDialog(this,
- LocaleManager.Instance["DialogUpdateAddUpdateErrorMessage"]);
+ Dispatcher.UIThread.Post(async () =>
+ {
+ await ContentDialogHelper.CreateErrorDialog(this,
+ LocaleManager.Instance["DialogUpdateAddUpdateErrorMessage"]);
+ });
}
}
catch (Exception ex)
{
- ContentDialogHelper.CreateErrorDialog(this,
- string.Format(LocaleManager.Instance["DialogDlcLoadNcaErrorMessage"], ex.Message, path));
+ Dispatcher.UIThread.Post(async () =>
+ {
+ await ContentDialogHelper.CreateErrorDialog(this,
+ string.Format(LocaleManager.Instance["DialogDlcLoadNcaErrorMessage"], ex.Message, path));
+ });
}
}
}