mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-29 10:09:49 +08:00
@@ -16,6 +16,12 @@ internal static class RuntimeHelper
|
||||
public static bool IsElevated { get; } = GetElevated();
|
||||
public static bool IsDebuggerAttached => Debugger.IsAttached;
|
||||
public static bool IsDesignMode { get; } = GetDesignMode();
|
||||
public static bool IsDebug =>
|
||||
#if DEBUG
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
private static bool GetElevated()
|
||||
{
|
||||
|
||||
@@ -32,9 +32,15 @@ public partial class MainWindow : FluentWindow, INavigationWindow
|
||||
TryApplySystemBackdrop();
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
App.GetService<NotifyIconViewModel>()?.Exit();
|
||||
}
|
||||
|
||||
private void OnNotifyIconLeftDoubleClick(NotifyIcon sender, RoutedEventArgs e)
|
||||
{
|
||||
NotifyIconViewModel.ShowOrHide();
|
||||
App.GetService<NotifyIconViewModel>()?.ShowOrHide();
|
||||
}
|
||||
|
||||
public INavigationView GetNavigation() => RootNavigation;
|
||||
|
||||
@@ -22,7 +22,7 @@ public partial class MainWindowViewModel : ObservableObject
|
||||
{
|
||||
private readonly ILogger<MainWindowViewModel> _logger;
|
||||
private readonly IConfigService _configService;
|
||||
public string Title { get; set; } = $"BetterGI · 更好的原神 · {Global.Version}";
|
||||
public string Title => $"BetterGI · 更好的原神 · {Global.Version}{(RuntimeHelper.IsDebug ? " · Dev" : string.Empty)}";
|
||||
|
||||
[ObservableProperty]
|
||||
public bool _isVisible = true;
|
||||
@@ -37,9 +37,6 @@ public partial class MainWindowViewModel : ObservableObject
|
||||
_configService = configService;
|
||||
Config = _configService.Get();
|
||||
_logger = App.GetLogger<MainWindowViewModel>();
|
||||
#if DEBUG
|
||||
Title += " · Dev";
|
||||
#endif
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace BetterGenshinImpact.ViewModel;
|
||||
public partial class NotifyIconViewModel : ObservableObject
|
||||
{
|
||||
[RelayCommand]
|
||||
public static void ShowOrHide()
|
||||
public void ShowOrHide()
|
||||
{
|
||||
if (Application.Current.MainWindow.Visibility == Visibility.Visible)
|
||||
{
|
||||
@@ -27,7 +27,7 @@ public partial class NotifyIconViewModel : ObservableObject
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public static void Exit()
|
||||
public void Exit()
|
||||
{
|
||||
App.GetService<IConfigService>()?.Save();
|
||||
Application.Current.Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user