ava: Fixes regressions from refactoring (#4237)
* ava: Fix regressions from #4178 * Remove duplicated code * real fix for right click menu Co-Authored-By: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> * Remove ContentDialogOverlay Co-authored-by: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com>
This commit is contained in:
parent
492056abf6
commit
610eecc1c1
@ -38,9 +38,9 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
{
|
{
|
||||||
if (sender is ListBox listBox)
|
if (sender is ListBox listBox)
|
||||||
{
|
{
|
||||||
var selected = listBox.SelectedItem as ApplicationData;
|
_selectedApplication = listBox.SelectedItem as ApplicationData;
|
||||||
|
|
||||||
_selectedApplication = selected;
|
(DataContext as MainWindowViewModel).GridSelectedApplication = _selectedApplication;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ namespace Ryujinx.Ava.UI.Controls
|
|||||||
{
|
{
|
||||||
if (sender is ListBox listBox)
|
if (sender is ListBox listBox)
|
||||||
{
|
{
|
||||||
var selected = listBox.SelectedItem as ApplicationData;
|
_selectedApplication = listBox.SelectedItem as ApplicationData;
|
||||||
|
|
||||||
_selectedApplication = selected;
|
(DataContext as MainWindowViewModel).ListSelectedApplication = _selectedApplication;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,56 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
{
|
{
|
||||||
private static bool _isChoiceDialogOpen;
|
private static bool _isChoiceDialogOpen;
|
||||||
|
|
||||||
private async static Task<UserResult> ShowContentDialog(
|
public async static Task<UserResult> ShowContentDialog(
|
||||||
|
string title,
|
||||||
|
object content,
|
||||||
|
string primaryButton,
|
||||||
|
string secondaryButton,
|
||||||
|
string closeButton,
|
||||||
|
UserResult primaryButtonResult = UserResult.Ok,
|
||||||
|
ManualResetEvent deferResetEvent = null,
|
||||||
|
Func<Window, Task> doWhileDeferred = null,
|
||||||
|
TypedEventHandler<ContentDialog, ContentDialogButtonClickEventArgs> deferCloseAction = null)
|
||||||
|
{
|
||||||
|
UserResult result = UserResult.None;
|
||||||
|
|
||||||
|
ContentDialog contentDialog = new()
|
||||||
|
{
|
||||||
|
Title = title,
|
||||||
|
PrimaryButtonText = primaryButton,
|
||||||
|
SecondaryButtonText = secondaryButton,
|
||||||
|
CloseButtonText = closeButton,
|
||||||
|
Content = content
|
||||||
|
};
|
||||||
|
|
||||||
|
contentDialog.PrimaryButtonCommand = MiniCommand.Create(() =>
|
||||||
|
{
|
||||||
|
result = primaryButtonResult;
|
||||||
|
});
|
||||||
|
|
||||||
|
contentDialog.SecondaryButtonCommand = MiniCommand.Create(() =>
|
||||||
|
{
|
||||||
|
result = UserResult.No;
|
||||||
|
contentDialog.PrimaryButtonClick -= deferCloseAction;
|
||||||
|
});
|
||||||
|
|
||||||
|
contentDialog.CloseButtonCommand = MiniCommand.Create(() =>
|
||||||
|
{
|
||||||
|
result = UserResult.Cancel;
|
||||||
|
contentDialog.PrimaryButtonClick -= deferCloseAction;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (deferResetEvent != null)
|
||||||
|
{
|
||||||
|
contentDialog.PrimaryButtonClick += deferCloseAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
await ShowAsync(contentDialog);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async static Task<UserResult> ShowTextDialog(
|
||||||
string title,
|
string title,
|
||||||
string primaryText,
|
string primaryText,
|
||||||
string secondaryText,
|
string secondaryText,
|
||||||
@ -32,119 +81,9 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
Func<Window, Task> doWhileDeferred = null,
|
Func<Window, Task> doWhileDeferred = null,
|
||||||
TypedEventHandler<ContentDialog, ContentDialogButtonClickEventArgs> deferCloseAction = null)
|
TypedEventHandler<ContentDialog, ContentDialogButtonClickEventArgs> deferCloseAction = null)
|
||||||
{
|
{
|
||||||
UserResult result = UserResult.None;
|
Grid content = CreateTextDialogContent(primaryText, secondaryText, iconSymbol);
|
||||||
|
|
||||||
bool useOverlay = false;
|
return await ShowContentDialog(title, content, primaryButton, secondaryButton, closeButton, primaryButtonResult, deferResetEvent, doWhileDeferred, deferCloseAction);
|
||||||
Window mainWindow = null;
|
|
||||||
|
|
||||||
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
|
|
||||||
{
|
|
||||||
foreach (var item in al.Windows)
|
|
||||||
{
|
|
||||||
if (item.IsActive && item is MainWindow window && window.ViewModel.IsGameRunning)
|
|
||||||
{
|
|
||||||
mainWindow = window;
|
|
||||||
useOverlay = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentDialog contentDialog = null;
|
|
||||||
ContentDialogOverlayWindow overlay = null;
|
|
||||||
|
|
||||||
if (useOverlay)
|
|
||||||
{
|
|
||||||
overlay = new ContentDialogOverlayWindow()
|
|
||||||
{
|
|
||||||
Height = mainWindow.Bounds.Height,
|
|
||||||
Width = mainWindow.Bounds.Width,
|
|
||||||
Position = mainWindow.PointToScreen(new Point())
|
|
||||||
};
|
|
||||||
|
|
||||||
mainWindow.PositionChanged += OverlayOnPositionChanged;
|
|
||||||
|
|
||||||
void OverlayOnPositionChanged(object sender, PixelPointEventArgs e)
|
|
||||||
{
|
|
||||||
overlay.Position = mainWindow.PointToScreen(new Point());
|
|
||||||
}
|
|
||||||
|
|
||||||
contentDialog = overlay.ContentDialog;
|
|
||||||
|
|
||||||
bool opened = false;
|
|
||||||
|
|
||||||
overlay.Opened += OverlayOnActivated;
|
|
||||||
|
|
||||||
async void OverlayOnActivated(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (opened)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
opened = true;
|
|
||||||
|
|
||||||
overlay.Position = mainWindow.PointToScreen(new Point());
|
|
||||||
|
|
||||||
await ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
await overlay.ShowDialog(mainWindow);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
contentDialog = new ContentDialog();
|
|
||||||
|
|
||||||
await ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task ShowDialog()
|
|
||||||
{
|
|
||||||
contentDialog.Title = title;
|
|
||||||
contentDialog.PrimaryButtonText = primaryButton;
|
|
||||||
contentDialog.SecondaryButtonText = secondaryButton;
|
|
||||||
contentDialog.CloseButtonText = closeButton;
|
|
||||||
contentDialog.Content = CreateDialogTextContent(primaryText, secondaryText, iconSymbol);
|
|
||||||
|
|
||||||
contentDialog.PrimaryButtonCommand = MiniCommand.Create(() =>
|
|
||||||
{
|
|
||||||
result = primaryButtonResult;
|
|
||||||
});
|
|
||||||
contentDialog.SecondaryButtonCommand = MiniCommand.Create(() =>
|
|
||||||
{
|
|
||||||
result = UserResult.No;
|
|
||||||
contentDialog.PrimaryButtonClick -= deferCloseAction;
|
|
||||||
});
|
|
||||||
contentDialog.CloseButtonCommand = MiniCommand.Create(() =>
|
|
||||||
{
|
|
||||||
result = UserResult.Cancel;
|
|
||||||
contentDialog.PrimaryButtonClick -= deferCloseAction;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (deferResetEvent != null)
|
|
||||||
{
|
|
||||||
contentDialog.PrimaryButtonClick += deferCloseAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useOverlay)
|
|
||||||
{
|
|
||||||
await contentDialog.ShowAsync(overlay, ContentDialogPlacement.Popup);
|
|
||||||
|
|
||||||
overlay!.Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await contentDialog.ShowAsync(ContentDialogPlacement.Popup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useOverlay)
|
|
||||||
{
|
|
||||||
overlay.Content = null;
|
|
||||||
overlay.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async static Task<UserResult> ShowDeferredContentDialog(
|
public async static Task<UserResult> ShowDeferredContentDialog(
|
||||||
@ -162,7 +101,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
bool startedDeferring = false;
|
bool startedDeferring = false;
|
||||||
UserResult result = UserResult.None;
|
UserResult result = UserResult.None;
|
||||||
|
|
||||||
return await ShowContentDialog(
|
return await ShowTextDialog(
|
||||||
title,
|
title,
|
||||||
primaryText,
|
primaryText,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
@ -192,8 +131,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
|
|
||||||
sender.PrimaryButtonClick -= DeferClose;
|
sender.PrimaryButtonClick -= DeferClose;
|
||||||
|
|
||||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
_ = Task.Run(() =>
|
||||||
Task.Run(() =>
|
|
||||||
{
|
{
|
||||||
deferResetEvent.WaitOne();
|
deferResetEvent.WaitOne();
|
||||||
|
|
||||||
@ -202,7 +140,6 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
||||||
|
|
||||||
if (doWhileDeferred != null)
|
if (doWhileDeferred != null)
|
||||||
{
|
{
|
||||||
@ -213,29 +150,37 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Grid CreateDialogTextContent(string primaryText, string secondaryText, int symbol)
|
private static Grid CreateTextDialogContent(string primaryText, string secondaryText, int symbol)
|
||||||
{
|
{
|
||||||
Grid content = new Grid();
|
Grid content = new()
|
||||||
content.RowDefinitions = new RowDefinitions() { new RowDefinition(), new RowDefinition() };
|
{
|
||||||
content.ColumnDefinitions = new ColumnDefinitions() { new ColumnDefinition(GridLength.Auto), new ColumnDefinition() };
|
RowDefinitions = new RowDefinitions() { new RowDefinition(), new RowDefinition() },
|
||||||
|
ColumnDefinitions = new ColumnDefinitions() { new ColumnDefinition(GridLength.Auto), new ColumnDefinition() },
|
||||||
|
|
||||||
content.MinHeight = 80;
|
MinHeight = 80
|
||||||
|
};
|
||||||
|
|
||||||
|
SymbolIcon icon = new()
|
||||||
|
{
|
||||||
|
Symbol = (Symbol)symbol,
|
||||||
|
Margin = new Thickness(10),
|
||||||
|
FontSize = 40,
|
||||||
|
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
|
||||||
|
};
|
||||||
|
|
||||||
SymbolIcon icon = new SymbolIcon { Symbol = (Symbol)symbol, Margin = new Thickness(10) };
|
|
||||||
icon.FontSize = 40;
|
|
||||||
icon.VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center;
|
|
||||||
Grid.SetColumn(icon, 0);
|
Grid.SetColumn(icon, 0);
|
||||||
Grid.SetRowSpan(icon, 2);
|
Grid.SetRowSpan(icon, 2);
|
||||||
Grid.SetRow(icon, 0);
|
Grid.SetRow(icon, 0);
|
||||||
|
|
||||||
TextBlock primaryLabel = new TextBlock()
|
TextBlock primaryLabel = new()
|
||||||
{
|
{
|
||||||
Text = primaryText,
|
Text = primaryText,
|
||||||
Margin = new Thickness(5),
|
Margin = new Thickness(5),
|
||||||
TextWrapping = TextWrapping.Wrap,
|
TextWrapping = TextWrapping.Wrap,
|
||||||
MaxWidth = 450
|
MaxWidth = 450
|
||||||
};
|
};
|
||||||
TextBlock secondaryLabel = new TextBlock()
|
|
||||||
|
TextBlock secondaryLabel = new()
|
||||||
{
|
{
|
||||||
Text = secondaryText,
|
Text = secondaryText,
|
||||||
Margin = new Thickness(5),
|
Margin = new Thickness(5),
|
||||||
@ -262,7 +207,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
string closeButton,
|
string closeButton,
|
||||||
string title)
|
string title)
|
||||||
{
|
{
|
||||||
return await ShowContentDialog(
|
return await ShowTextDialog(
|
||||||
title,
|
title,
|
||||||
primary,
|
primary,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
@ -280,7 +225,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
string title,
|
string title,
|
||||||
UserResult primaryButtonResult = UserResult.Yes)
|
UserResult primaryButtonResult = UserResult.Yes)
|
||||||
{
|
{
|
||||||
return await ShowContentDialog(
|
return await ShowTextDialog(
|
||||||
string.IsNullOrWhiteSpace(title) ? LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle] : title,
|
string.IsNullOrWhiteSpace(title) ? LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle] : title,
|
||||||
primaryText,
|
primaryText,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
@ -298,7 +243,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
|
|
||||||
internal static async Task CreateUpdaterInfoDialog(string primary, string secondaryText)
|
internal static async Task CreateUpdaterInfoDialog(string primary, string secondaryText)
|
||||||
{
|
{
|
||||||
await ShowContentDialog(
|
await ShowTextDialog(
|
||||||
LocaleManager.Instance[LocaleKeys.DialogUpdaterTitle],
|
LocaleManager.Instance[LocaleKeys.DialogUpdaterTitle],
|
||||||
primary,
|
primary,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
@ -310,7 +255,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
|
|
||||||
internal static async Task CreateWarningDialog(string primary, string secondaryText)
|
internal static async Task CreateWarningDialog(string primary, string secondaryText)
|
||||||
{
|
{
|
||||||
await ShowContentDialog(
|
await ShowTextDialog(
|
||||||
LocaleManager.Instance[LocaleKeys.DialogWarningTitle],
|
LocaleManager.Instance[LocaleKeys.DialogWarningTitle],
|
||||||
primary,
|
primary,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
@ -324,7 +269,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, errorMessage);
|
Logger.Error?.Print(LogClass.Application, errorMessage);
|
||||||
|
|
||||||
await ShowContentDialog(
|
await ShowTextDialog(
|
||||||
LocaleManager.Instance[LocaleKeys.DialogErrorTitle],
|
LocaleManager.Instance[LocaleKeys.DialogErrorTitle],
|
||||||
LocaleManager.Instance[LocaleKeys.DialogErrorMessage],
|
LocaleManager.Instance[LocaleKeys.DialogErrorMessage],
|
||||||
errorMessage,
|
errorMessage,
|
||||||
@ -343,8 +288,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
|
|
||||||
_isChoiceDialogOpen = true;
|
_isChoiceDialogOpen = true;
|
||||||
|
|
||||||
UserResult response =
|
UserResult response = await ShowTextDialog(
|
||||||
await ShowContentDialog(
|
|
||||||
title,
|
title,
|
||||||
primary,
|
primary,
|
||||||
secondaryText,
|
secondaryText,
|
||||||
@ -396,5 +340,98 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<ContentDialogResult> ShowAsync(ContentDialog contentDialog)
|
||||||
|
{
|
||||||
|
ContentDialogResult result;
|
||||||
|
|
||||||
|
ContentDialogOverlayWindow contentDialogOverlayWindow = null;
|
||||||
|
|
||||||
|
Window parent = GetMainWindow();
|
||||||
|
|
||||||
|
if (parent.IsActive && parent is MainWindow window && window.ViewModel.IsGameRunning)
|
||||||
|
{
|
||||||
|
contentDialogOverlayWindow = new()
|
||||||
|
{
|
||||||
|
Height = parent.Bounds.Height,
|
||||||
|
Width = parent.Bounds.Width,
|
||||||
|
Position = parent.PointToScreen(new Point()),
|
||||||
|
ShowInTaskbar = false
|
||||||
|
};
|
||||||
|
|
||||||
|
parent.PositionChanged += OverlayOnPositionChanged;
|
||||||
|
|
||||||
|
void OverlayOnPositionChanged(object sender, PixelPointEventArgs e)
|
||||||
|
{
|
||||||
|
contentDialogOverlayWindow.Position = parent.PointToScreen(new Point());
|
||||||
|
}
|
||||||
|
|
||||||
|
contentDialogOverlayWindow.ContentDialog = contentDialog;
|
||||||
|
|
||||||
|
bool opened = false;
|
||||||
|
|
||||||
|
contentDialogOverlayWindow.Opened += OverlayOnActivated;
|
||||||
|
|
||||||
|
async void OverlayOnActivated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (opened)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
opened = true;
|
||||||
|
|
||||||
|
contentDialogOverlayWindow.Position = parent.PointToScreen(new Point());
|
||||||
|
|
||||||
|
result = await ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
result = await contentDialogOverlayWindow.ShowDialog<ContentDialogResult>(parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = await ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task<ContentDialogResult> ShowDialog()
|
||||||
|
{
|
||||||
|
if (contentDialogOverlayWindow is not null)
|
||||||
|
{
|
||||||
|
result = await contentDialog.ShowAsync(contentDialogOverlayWindow);
|
||||||
|
|
||||||
|
contentDialogOverlayWindow!.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = await contentDialog.ShowAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentDialogOverlayWindow is not null)
|
||||||
|
{
|
||||||
|
contentDialogOverlayWindow.Content = null;
|
||||||
|
contentDialogOverlayWindow.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Window GetMainWindow()
|
||||||
|
{
|
||||||
|
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
|
||||||
|
{
|
||||||
|
foreach (Window item in al.Windows)
|
||||||
|
{
|
||||||
|
if (item.IsActive && item is MainWindow window)
|
||||||
|
{
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -87,8 +87,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
private float _volume;
|
private float _volume;
|
||||||
private string _backendText;
|
private string _backendText;
|
||||||
|
|
||||||
public ApplicationData ListSelectedApplication;
|
|
||||||
public ApplicationData GridSelectedApplication;
|
|
||||||
private bool _canUpdate;
|
private bool _canUpdate;
|
||||||
private Cursor _cursor;
|
private Cursor _cursor;
|
||||||
private string _title;
|
private string _title;
|
||||||
@ -97,6 +95,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
private WindowState _windowState;
|
private WindowState _windowState;
|
||||||
private bool _isActive;
|
private bool _isActive;
|
||||||
|
|
||||||
|
public ApplicationData ListSelectedApplication;
|
||||||
|
public ApplicationData GridSelectedApplication;
|
||||||
|
|
||||||
public event Action ReloadGameList;
|
public event Action ReloadGameList;
|
||||||
|
|
||||||
private string TitleName { get; set; }
|
private string TitleName { get; set; }
|
||||||
|
@ -36,10 +36,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
|
|
||||||
private async void StopEmulation_Click(object sender, RoutedEventArgs e)
|
private async void StopEmulation_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Window.ViewModel.AppHost?.ShowExitPrompt();
|
||||||
{
|
|
||||||
Window.ViewModel.AppHost?.ShowExitPrompt();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void PauseEmulation_Click(object sender, RoutedEventArgs e)
|
private async void PauseEmulation_Click(object sender, RoutedEventArgs e)
|
||||||
|
@ -22,7 +22,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
{
|
{
|
||||||
base.OnAttachedToVisualTree(e);
|
base.OnAttachedToVisualTree(e);
|
||||||
|
|
||||||
if (this.VisualRoot is MainWindow window)
|
if (VisualRoot is MainWindow window)
|
||||||
{
|
{
|
||||||
Window = window;
|
Window = window;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
{
|
{
|
||||||
base.OnAttachedToVisualTree(e);
|
base.OnAttachedToVisualTree(e);
|
||||||
|
|
||||||
if (this.VisualRoot is MainWindow window)
|
if (VisualRoot is MainWindow window)
|
||||||
{
|
{
|
||||||
ViewModel = window.ViewModel;
|
ViewModel = window.ViewModel;
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,26 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
|
x:Class="Ryujinx.Ava.UI.Windows.AboutWindow"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
|
||||||
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
|
||||||
|
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||||
xmlns:viewModel="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
xmlns:viewModel="clr-namespace:Ryujinx.Ava.UI.ViewModels"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
Width="550"
|
||||||
mc:Ignorable="d"
|
Height="260"
|
||||||
|
Margin="0,-12,0,0"
|
||||||
d:DesignHeight="260"
|
d:DesignHeight="260"
|
||||||
d:DesignWidth="550"
|
d:DesignWidth="550"
|
||||||
Height="260"
|
|
||||||
Width="550"
|
|
||||||
x:Class="Ryujinx.Ava.UI.Windows.AboutWindow"
|
|
||||||
x:DataType="viewModel:AboutWindowViewModel"
|
|
||||||
x:CompileBindings="True"
|
x:CompileBindings="True"
|
||||||
Margin="0 -12 0 0"
|
x:DataType="viewModel:AboutWindowViewModel"
|
||||||
Focusable="True">
|
Focusable="True"
|
||||||
|
mc:Ignorable="d">
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<viewModel:AboutWindowViewModel />
|
<viewModel:AboutWindowViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<Grid
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch">
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@ -39,9 +37,9 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Spacing="10"
|
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch"
|
||||||
|
Spacing="10">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@ -64,112 +62,108 @@
|
|||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
Text="Ryujinx"
|
Text="Ryujinx"
|
||||||
TextAlignment="Left" />
|
TextAlignment="Left" />
|
||||||
<TextBlock
|
<TextBlock Text="(REE-YOU-JINX)" TextAlignment="Left" />
|
||||||
Text="(REE-YOU-JINX)"
|
|
||||||
TextAlignment="Left" />
|
|
||||||
</flex:FlexPanel>
|
</flex:FlexPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding Version}"
|
|
||||||
TextAlignment="Center"
|
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
LineHeight="12" />
|
LineHeight="12"
|
||||||
|
Text="{Binding Version}"
|
||||||
|
TextAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Spacing="10"
|
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch"
|
||||||
|
Spacing="10">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Width="200"
|
Width="200"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
FontSize="10"
|
||||||
|
LineHeight="12"
|
||||||
Text="{locale:Locale AboutDisclaimerMessage}"
|
Text="{locale:Locale AboutDisclaimerMessage}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap" />
|
||||||
FontSize="10"
|
|
||||||
LineHeight="12" />
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Name="AmiiboLabel"
|
Name="AmiiboLabel"
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Width="200"
|
Width="200"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
FontSize="10"
|
||||||
|
LineHeight="12"
|
||||||
PointerPressed="AmiiboLabel_OnPointerPressed"
|
PointerPressed="AmiiboLabel_OnPointerPressed"
|
||||||
Text="{locale:Locale AboutAmiiboDisclaimerMessage}"
|
Text="{locale:Locale AboutAmiiboDisclaimerMessage}"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap" />
|
||||||
FontSize="10"
|
|
||||||
LineHeight="12" />
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
Spacing="10">
|
Spacing="10">
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
|
||||||
MaxWidth="30"
|
|
||||||
MinHeight="30"
|
|
||||||
MinWidth="30"
|
MinWidth="30"
|
||||||
|
MinHeight="30"
|
||||||
|
MaxWidth="30"
|
||||||
|
MaxHeight="30"
|
||||||
Padding="8"
|
Padding="8"
|
||||||
CornerRadius="15"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
|
CornerRadius="15"
|
||||||
Tag="https://www.patreon.com/ryujinx"
|
Tag="https://www.patreon.com/ryujinx"
|
||||||
ToolTip.Tip="{locale:Locale AboutPatreonUrlTooltipMessage}">
|
ToolTip.Tip="{locale:Locale AboutPatreonUrlTooltipMessage}">
|
||||||
<Image Source="{Binding PatreonLogo}" />
|
<Image Source="{Binding PatreonLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
|
||||||
MaxWidth="30"
|
|
||||||
MinHeight="30"
|
|
||||||
MinWidth="30"
|
MinWidth="30"
|
||||||
|
MinHeight="30"
|
||||||
|
MaxWidth="30"
|
||||||
|
MaxHeight="30"
|
||||||
Padding="8"
|
Padding="8"
|
||||||
CornerRadius="15"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
|
CornerRadius="15"
|
||||||
Tag="https://github.com/Ryujinx/Ryujinx"
|
Tag="https://github.com/Ryujinx/Ryujinx"
|
||||||
ToolTip.Tip="{locale:Locale AboutGithubUrlTooltipMessage}">
|
ToolTip.Tip="{locale:Locale AboutGithubUrlTooltipMessage}">
|
||||||
<Image Source="{Binding GithubLogo}" />
|
<Image Source="{Binding GithubLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
|
||||||
MaxWidth="30"
|
|
||||||
MinHeight="30"
|
|
||||||
MinWidth="30"
|
MinWidth="30"
|
||||||
|
MinHeight="30"
|
||||||
|
MaxWidth="30"
|
||||||
|
MaxHeight="30"
|
||||||
Padding="8"
|
Padding="8"
|
||||||
CornerRadius="15"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
|
CornerRadius="15"
|
||||||
Tag="https://discordapp.com/invite/N2FmfVc"
|
Tag="https://discordapp.com/invite/N2FmfVc"
|
||||||
ToolTip.Tip="{locale:Locale AboutDiscordUrlTooltipMessage}">
|
ToolTip.Tip="{locale:Locale AboutDiscordUrlTooltipMessage}">
|
||||||
<Image Source="{Binding DiscordLogo}" />
|
<Image Source="{Binding DiscordLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
|
||||||
MaxWidth="30"
|
|
||||||
MinHeight="30"
|
|
||||||
MinWidth="30"
|
MinWidth="30"
|
||||||
|
MinHeight="30"
|
||||||
|
MaxWidth="30"
|
||||||
|
MaxHeight="30"
|
||||||
Padding="8"
|
Padding="8"
|
||||||
CornerRadius="15"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
|
CornerRadius="15"
|
||||||
Tag="https://twitter.com/RyujinxEmu"
|
Tag="https://twitter.com/RyujinxEmu"
|
||||||
ToolTip.Tip="{locale:Locale AboutTwitterUrlTooltipMessage}">
|
ToolTip.Tip="{locale:Locale AboutTwitterUrlTooltipMessage}">
|
||||||
<Image Source="{Binding TwitterLogo}" />
|
<Image Source="{Binding TwitterLogo}" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
MaxHeight="30"
|
|
||||||
MaxWidth="30"
|
|
||||||
MinHeight="30"
|
|
||||||
MinWidth="30"
|
MinWidth="30"
|
||||||
|
MinHeight="30"
|
||||||
|
MaxWidth="30"
|
||||||
|
MaxHeight="30"
|
||||||
Padding="8"
|
Padding="8"
|
||||||
CornerRadius="15"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
|
CornerRadius="15"
|
||||||
Tag="https://www.ryujinx.org"
|
Tag="https://www.ryujinx.org"
|
||||||
ToolTip.Tip="{locale:Locale AboutUrlTooltipMessage}">
|
ToolTip.Tip="{locale:Locale AboutUrlTooltipMessage}">
|
||||||
<ui:SymbolIcon
|
<ui:SymbolIcon Foreground="{DynamicResource ThemeForegroundColor}" Symbol="Link" />
|
||||||
Symbol="Link"
|
|
||||||
Foreground="{DynamicResource ThemeForegroundColor}" />
|
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@ -177,10 +171,10 @@
|
|||||||
<Border
|
<Border
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="1"
|
Width="1"
|
||||||
|
Margin="20,0"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
||||||
BorderThickness="1,0,0,0"
|
BorderThickness="1,0,0,0" />
|
||||||
Margin="20 0"/>
|
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@ -192,34 +186,34 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="0 10 0 0"
|
Margin="0,10,0,0"
|
||||||
Spacing="2">
|
Spacing="2">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontWeight="Bold"
|
|
||||||
FontSize="15"
|
FontSize="15"
|
||||||
|
FontWeight="Bold"
|
||||||
Text="{locale:Locale AboutRyujinxAboutTitle}" />
|
Text="{locale:Locale AboutRyujinxAboutTitle}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
TextWrapping="Wrap"
|
Text="{locale:Locale AboutRyujinxAboutContent}"
|
||||||
Text="{locale:Locale AboutRyujinxAboutContent}" />
|
TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="0 10 0 0"
|
Margin="0,10,0,0"
|
||||||
Spacing="2">
|
Spacing="2">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontWeight="Bold"
|
|
||||||
FontSize="15"
|
FontSize="15"
|
||||||
|
FontWeight="Bold"
|
||||||
Text="{locale:Locale AboutRyujinxMaintainersTitle}" />
|
Text="{locale:Locale AboutRyujinxMaintainersTitle}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
TextWrapping="Wrap"
|
Text="{Binding Developers}"
|
||||||
Text="{Binding Developers}" />
|
TextWrapping="Wrap" />
|
||||||
<Button
|
<Button
|
||||||
|
Padding="5"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Click="Button_OnClick"
|
Click="Button_OnClick"
|
||||||
Padding="5"
|
|
||||||
Tag="https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a">
|
Tag="https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
@ -230,22 +224,22 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Margin="0 10 0 0"
|
Margin="0,10,0,0"
|
||||||
Spacing="2">
|
Spacing="2">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
FontWeight="Bold"
|
|
||||||
FontSize="15"
|
FontSize="15"
|
||||||
|
FontWeight="Bold"
|
||||||
Text="{locale:Locale AboutRyujinxSupprtersTitle}" />
|
Text="{locale:Locale AboutRyujinxSupprtersTitle}" />
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
VerticalScrollBarVisibility="Visible"
|
Height="70"
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
Height="70">
|
VerticalScrollBarVisibility="Visible">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Name="SupportersTextBlock"
|
Name="SupportersTextBlock"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
TextWrapping="Wrap"
|
Text="{Binding Supporters}"
|
||||||
Text="{Binding Supporters}" />
|
TextWrapping="Wrap" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -4,6 +4,7 @@ using Avalonia.Interactivity;
|
|||||||
using Avalonia.Styling;
|
using Avalonia.Styling;
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Ui.Common.Helper;
|
using Ryujinx.Ui.Common.Helper;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -22,14 +23,12 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
|
|
||||||
public static async Task Show()
|
public static async Task Show()
|
||||||
{
|
{
|
||||||
var content = new AboutWindow();
|
|
||||||
|
|
||||||
ContentDialog contentDialog = new()
|
ContentDialog contentDialog = new()
|
||||||
{
|
{
|
||||||
PrimaryButtonText = "",
|
PrimaryButtonText = "",
|
||||||
SecondaryButtonText = "",
|
SecondaryButtonText = "",
|
||||||
CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
|
CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
|
||||||
Content = content
|
Content = new AboutWindow()
|
||||||
};
|
};
|
||||||
|
|
||||||
Style closeButton = new(x => x.Name("CloseButton"));
|
Style closeButton = new(x => x.Name("CloseButton"));
|
||||||
@ -41,7 +40,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
contentDialog.Styles.Add(closeButton);
|
contentDialog.Styles.Add(closeButton);
|
||||||
contentDialog.Styles.Add(closeButtonParent);
|
contentDialog.Styles.Add(closeButtonParent);
|
||||||
|
|
||||||
await contentDialog.ShowAsync();
|
await ContentDialogHelper.ShowAsync(contentDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_OnClick(object sender, RoutedEventArgs e)
|
private void Button_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user