UI: Rename App to RyujinxApp

Add more NotificationHelper methods
Simplify ID copy logic
This commit is contained in:
Evan Husted 2024-12-24 13:39:48 -06:00
parent 4d7350fc6e
commit 16a60fdf12
13 changed files with 82 additions and 40 deletions

View file

@ -43,17 +43,19 @@ namespace Ryujinx.Ava.UI.Controls
if (sender is not Button { Content: TextBlock idText })
return;
if (!RyujinxApp.IsClipboardAvailable(out var clipboard))
return;
if (App.MainWindow.Clipboard is { } clipboard)
{
var appData = mwvm.Applications.FirstOrDefault(it => it.IdString == idText.Text);
if (appData is null)
return;
var appData = mwvm.Applications.FirstOrDefault(it => it.IdString == idText.Text);
if (appData is null)
return;
await clipboard.SetTextAsync(appData.IdString);
await clipboard.SetTextAsync(appData.IdString);
NotificationHelper.Show("Copied Title ID", $"{appData.Name} ({appData.IdString})", NotificationType.Information);
}
NotificationHelper.ShowInformation(
"Copied Title ID",
$"{appData.Name} ({appData.IdString})");
}
}
}

View file

@ -62,9 +62,46 @@ namespace Ryujinx.Ava.UI.Helpers
_notifications.Add(new Notification(title, text, type, delay, onClick, onClose));
}
public static void ShowError(string message)
{
Show(LocaleManager.Instance[LocaleKeys.DialogErrorTitle], $"{LocaleManager.Instance[LocaleKeys.DialogErrorMessage]}\n\n{message}", NotificationType.Error);
}
public static void ShowError(string message) =>
ShowError(
LocaleManager.Instance[LocaleKeys.DialogErrorTitle],
$"{LocaleManager.Instance[LocaleKeys.DialogErrorMessage]}\n\n{message}"
);
public static void ShowInformation(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
Show(
title,
text,
NotificationType.Information,
waitingExit,
onClick,
onClose);
public static void ShowSuccess(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
Show(
title,
text,
NotificationType.Success,
waitingExit,
onClick,
onClose);
public static void ShowWarning(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
Show(
title,
text,
NotificationType.Warning,
waitingExit,
onClick,
onClose);
public static void ShowError(string title, string text, bool waitingExit = false, Action onClick = null, Action onClose = null) =>
Show(
title,
text,
NotificationType.Error,
waitingExit,
onClick,
onClose);
}
}

View file

@ -51,7 +51,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public AboutWindowViewModel()
{
Version = App.FullAppName + "\n" + Program.Version;
Version = RyujinxApp.FullAppName + "\n" + Program.Version;
UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value);
ThemeManager.ThemeChanged += ThemeManager_ThemeChanged;
@ -64,7 +64,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private void UpdateLogoTheme(string theme)
{
bool isDarkTheme = theme == "Dark" || (theme == "Auto" && App.DetectSystemTheme() == ThemeVariant.Dark);
bool isDarkTheme = theme == "Dark" || (theme == "Auto" && RyujinxApp.DetectSystemTheme() == ThemeVariant.Dark);
string basePath = "resm:Ryujinx.UI.Common.Resources.";
string themeSuffix = isDarkTheme ? "Dark.png" : "Light.png";

View file

@ -2051,7 +2051,7 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.InvokeAsync(() =>
{
Title = App.FormatTitle();
Title = RyujinxApp.FormatTitle();
});
}

View file

@ -16,7 +16,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent();
Title = App.FormatTitle(LocaleKeys.Amiibo);
Title = RyujinxApp.FormatTitle(LocaleKeys.Amiibo);
}
public AmiiboWindow()
@ -27,7 +27,7 @@ namespace Ryujinx.Ava.UI.Windows
if (Program.PreviewerDetached)
{
Title = App.FormatTitle(LocaleKeys.Amiibo);
Title = RyujinxApp.FormatTitle(LocaleKeys.Amiibo);
}
}

View file

@ -28,7 +28,7 @@ namespace Ryujinx.Ava.UI.Windows
InitializeComponent();
Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
Title = RyujinxApp.FormatTitle(LocaleKeys.CheatWindowTitle);
}
public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName, string titlePath)
@ -93,7 +93,7 @@ namespace Ryujinx.Ava.UI.Windows
DataContext = this;
Title = App.FormatTitle(LocaleKeys.CheatWindowTitle);
Title = RyujinxApp.FormatTitle(LocaleKeys.CheatWindowTitle);
}
public void Save()

View file

@ -86,7 +86,7 @@ namespace Ryujinx.Ava.UI.Windows
UiHandler = new AvaHostUIHandler(this);
ViewModel.Title = App.FormatTitle();
ViewModel.Title = RyujinxApp.FormatTitle();
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
TitleBar.TitleBarHitTestType = (ConfigurationState.Instance.ShowTitleBar) ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
@ -117,7 +117,7 @@ namespace Ryujinx.Ava.UI.Windows
/// </summary>
private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
{
if (Application.Current is App app)
if (Application.Current is RyujinxApp app)
app.ApplyConfiguredTheme(ConfigurationState.Instance.UI.BaseStyle);
}

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Ava.UI.Windows
public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
{
Title = App.FormatTitle(LocaleKeys.Settings);
Title = RyujinxApp.FormatTitle(LocaleKeys.Settings);
DataContext = ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);