Compare commits
5 Commits
Canary-1.2
...
Canary-1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31e5f74e05 | ||
|
|
f2f099bddb | ||
|
|
2616dc57fb | ||
|
|
0cdf7cfe21 | ||
|
|
2ecf999569 |
@@ -489,7 +489,7 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device.Processes.ActiveApplication, Program.Version);
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowTitleBar);
|
||||||
});
|
});
|
||||||
|
|
||||||
_viewModel.SetUiProgressHandlers(Device);
|
_viewModel.SetUiProgressHandlers(Device);
|
||||||
@@ -872,7 +872,7 @@ namespace Ryujinx.Ava
|
|||||||
Device?.System.TogglePauseEmulation(false);
|
Device?.System.TogglePauseEmulation(false);
|
||||||
|
|
||||||
_viewModel.IsPaused = false;
|
_viewModel.IsPaused = false;
|
||||||
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version);
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowTitleBar);
|
||||||
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed");
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,7 +881,7 @@ namespace Ryujinx.Ava
|
|||||||
Device?.System.TogglePauseEmulation(true);
|
Device?.System.TogglePauseEmulation(true);
|
||||||
|
|
||||||
_viewModel.IsPaused = true;
|
_viewModel.IsPaused = true;
|
||||||
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, LocaleManager.Instance[LocaleKeys.Paused]);
|
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowTitleBar, LocaleManager.Instance[LocaleKeys.Paused]);
|
||||||
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
|
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ namespace Ryujinx.Ava.Common
|
|||||||
{
|
{
|
||||||
public static class ThemeManager
|
public static class ThemeManager
|
||||||
{
|
{
|
||||||
public static event EventHandler ThemeChanged;
|
public static event Action ThemeChanged;
|
||||||
|
|
||||||
public static void OnThemeChanged()
|
public static void OnThemeChanged()
|
||||||
{
|
{
|
||||||
ThemeChanged?.Invoke(null, EventArgs.Empty);
|
ThemeChanged?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DiscordRPC;
|
|||||||
using Gommon;
|
using Gommon;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using Humanizer.Localisation;
|
using Humanizer.Localisation;
|
||||||
|
using Ryujinx.Ava.Utilities;
|
||||||
using Ryujinx.Ava.Utilities.AppLibrary;
|
using Ryujinx.Ava.Utilities.AppLibrary;
|
||||||
using Ryujinx.Ava.Utilities.Configuration;
|
using Ryujinx.Ava.Utilities.Configuration;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
@@ -97,7 +98,7 @@ namespace Ryujinx.Ava
|
|||||||
},
|
},
|
||||||
Details = TruncateToByteLength($"Playing {appMeta.Title}"),
|
Details = TruncateToByteLength($"Playing {appMeta.Title}"),
|
||||||
State = appMeta.LastPlayed.HasValue && appMeta.TimePlayed.TotalSeconds > 5
|
State = appMeta.LastPlayed.HasValue && appMeta.TimePlayed.TotalSeconds > 5
|
||||||
? $"Total play time: {appMeta.TimePlayed.Humanize(2, false, maxUnit: TimeUnit.Hour)}"
|
? $"Total play time: {ValueFormatUtils.FormatTimeSpan(appMeta.TimePlayed)}"
|
||||||
: "Never played",
|
: "Never played",
|
||||||
Timestamps = Timestamps.Now
|
Timestamps = Timestamps.Now
|
||||||
});
|
});
|
||||||
|
|||||||
48
src/Ryujinx/UI/Helpers/Commands.cs
Normal file
48
src/Ryujinx/UI/Helpers/Commands.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.UI.Helpers
|
||||||
|
{
|
||||||
|
#nullable enable
|
||||||
|
public static class Commands
|
||||||
|
{
|
||||||
|
public static RelayCommand Create(Action action)
|
||||||
|
=> new(action);
|
||||||
|
public static RelayCommand CreateConditional(Action action, Func<bool> canExecute)
|
||||||
|
=> new(action, canExecute);
|
||||||
|
|
||||||
|
public static RelayCommand<T> CreateWithArg<T>(Action<T?> action)
|
||||||
|
=> new(action);
|
||||||
|
public static RelayCommand<T> CreateConditionalWithArg<T>(Action<T?> action, Predicate<T?> canExecute)
|
||||||
|
=> new(action, canExecute);
|
||||||
|
|
||||||
|
public static AsyncRelayCommand Create(Func<Task> action)
|
||||||
|
=> new(action, AsyncRelayCommandOptions.None);
|
||||||
|
public static AsyncRelayCommand CreateConcurrent(Func<Task> action)
|
||||||
|
=> new(action, AsyncRelayCommandOptions.AllowConcurrentExecutions);
|
||||||
|
public static AsyncRelayCommand CreateSilentFail(Func<Task> action)
|
||||||
|
=> new(action, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler);
|
||||||
|
|
||||||
|
public static AsyncRelayCommand<T> CreateWithArg<T>(Func<T?, Task> action)
|
||||||
|
=> new(action, AsyncRelayCommandOptions.None);
|
||||||
|
public static AsyncRelayCommand<T> CreateConcurrentWithArg<T>(Func<T?, Task> action)
|
||||||
|
=> new(action, AsyncRelayCommandOptions.AllowConcurrentExecutions);
|
||||||
|
public static AsyncRelayCommand<T> CreateSilentFailWithArg<T>(Func<T?, Task> action)
|
||||||
|
=> new(action, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler);
|
||||||
|
|
||||||
|
public static AsyncRelayCommand CreateConditional(Func<Task> action, Func<bool> canExecute)
|
||||||
|
=> new(action, canExecute, AsyncRelayCommandOptions.None);
|
||||||
|
public static AsyncRelayCommand CreateConcurrentConditional(Func<Task> action, Func<bool> canExecute)
|
||||||
|
=> new(action, canExecute, AsyncRelayCommandOptions.AllowConcurrentExecutions);
|
||||||
|
public static AsyncRelayCommand CreateSilentFailConditional(Func<Task> action, Func<bool> canExecute)
|
||||||
|
=> new(action, canExecute, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler);
|
||||||
|
|
||||||
|
public static AsyncRelayCommand<T> CreateConditionalWithArg<T>(Func<T?, Task> action, Predicate<T?> canExecute)
|
||||||
|
=> new(action, canExecute, AsyncRelayCommandOptions.None);
|
||||||
|
public static AsyncRelayCommand<T> CreateConcurrentConditionalWithArg<T>(Func<T?, Task> action, Predicate<T?> canExecute)
|
||||||
|
=> new(action, canExecute, AsyncRelayCommandOptions.AllowConcurrentExecutions);
|
||||||
|
public static AsyncRelayCommand<T> CreateSilentFailConditionalWithArg<T>(Func<T?, Task> action, Predicate<T?> canExecute)
|
||||||
|
=> new(action, canExecute, AsyncRelayCommandOptions.FlowExceptionsToTaskScheduler);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
ThemeManager.ThemeChanged += ThemeManager_ThemeChanged;
|
ThemeManager.ThemeChanged += ThemeManager_ThemeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThemeManager_ThemeChanged(object sender, EventArgs e)
|
private void ThemeManager_ThemeChanged()
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() => UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value));
|
Dispatcher.UIThread.Post(() => UpdateLogoTheme(ConfigurationState.Instance.UI.BaseStyle.Value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,13 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
PauseEmulationMenuItem.Command = new RelayCommand(() => ViewModel.AppHost?.Pause());
|
PauseEmulationMenuItem.Command = new RelayCommand(() => ViewModel.AppHost?.Pause());
|
||||||
ResumeEmulationMenuItem.Command = new RelayCommand(() => ViewModel.AppHost?.Resume());
|
ResumeEmulationMenuItem.Command = new RelayCommand(() => ViewModel.AppHost?.Resume());
|
||||||
StopEmulationMenuItem.Command = new AsyncRelayCommand(() => ViewModel.AppHost?.ShowExitPrompt().OrCompleted());
|
StopEmulationMenuItem.Command = new AsyncRelayCommand(() => ViewModel.AppHost?.ShowExitPrompt().OrCompleted());
|
||||||
CheatManagerMenuItem.Command = new AsyncRelayCommand(OpenCheatManagerForCurrentApp);
|
CheatManagerMenuItem.Command = new AsyncRelayCommand(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await OpenCheatManagerForCurrentApp();
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
InstallFileTypesMenuItem.Command = new AsyncRelayCommand(InstallFileTypes);
|
InstallFileTypesMenuItem.Command = new AsyncRelayCommand(InstallFileTypes);
|
||||||
UninstallFileTypesMenuItem.Command = new AsyncRelayCommand(UninstallFileTypes);
|
UninstallFileTypesMenuItem.Command = new AsyncRelayCommand(UninstallFileTypes);
|
||||||
XciTrimmerMenuItem.Command = new AsyncRelayCommand(() => XCITrimmerWindow.Show(ViewModel));
|
XciTrimmerMenuItem.Command = new AsyncRelayCommand(() => XCITrimmerWindow.Show(ViewModel));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
{
|
{
|
||||||
public static class TitleHelper
|
public static class TitleHelper
|
||||||
{
|
{
|
||||||
public static string ActiveApplicationTitle(ProcessResult activeProcess, string applicationVersion, string pauseString = "")
|
public static string ActiveApplicationTitle(ProcessResult activeProcess, string applicationVersion, bool customTitlebar, string pauseString = "")
|
||||||
{
|
{
|
||||||
if (activeProcess == null)
|
if (activeProcess == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -14,7 +14,9 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
|
string titleIdSection = $" ({activeProcess.ProgramIdText.ToUpper()})";
|
||||||
string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
|
string titleArchSection = activeProcess.Is64Bit ? " (64-bit)" : " (32-bit)";
|
||||||
|
|
||||||
string appTitle = $"Ryujinx {applicationVersion} -{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
|
string appTitle = customTitlebar
|
||||||
|
? $"Ryujinx {applicationVersion}\n{titleNameSection.Trim()}\n{titleVersionSection.Trim()}\n{titleIdSection.Trim()}{titleArchSection}"
|
||||||
|
: $"Ryujinx {applicationVersion} -{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
|
||||||
|
|
||||||
return !string.IsNullOrEmpty(pauseString)
|
return !string.IsNullOrEmpty(pauseString)
|
||||||
? appTitle + $" ({pauseString})"
|
? appTitle + $" ({pauseString})"
|
||||||
|
|||||||
Reference in New Issue
Block a user