From bf531bb8b8ead11e93d117c4715bd007733bcd2f Mon Sep 17 00:00:00 2001 From: rmbgame Date: Fri, 20 Aug 2021 02:59:43 +0800 Subject: [PATCH] =?UTF-8?q?WinUI3=20=E5=BC=95=E7=94=A8=20=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=E5=AD=97=E4=BD=93=E7=AE=A1=E7=90=86=E5=99=A8=20?= =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=89=98=E7=9B=98=E7=AA=97=E5=8F=A3=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ST.Client.Desktop.Avalonia.App/App.axaml | 3 +- .../App.axaml.cs | 4 + .../Services/IDesktopAvaloniaAppService.cs | 10 +++ .../Implementation/ShowWindowServiceImpl.cs | 13 ++++ .../Application/UI/CustomFontManagerImpl.cs | 73 ++++++++++++++----- .../UI/Views/Controls/ScrollingTextBlock.cs | 6 +- .../UI/Views/Pages/GameListPage.axaml | 4 +- .../UI/Views/Pages/SteamAccountPage.axaml | 8 +- .../UI/Views/Windows/TaskBarWindow.axaml.cs | 1 - .../ST.Client.Desktop.Avalonia.csproj | 14 ++-- .../Services/IShowWindowService.cs | 1 + .../UI/Resx/AppResources.en.resx | 2 +- .../UI/ViewModels/Base/WindowViewModel.cs | 4 + .../Windows/TaskBarWindowViewModel.cs | 9 --- 14 files changed, 108 insertions(+), 44 deletions(-) diff --git a/src/ST.Client.Desktop.Avalonia.App/App.axaml b/src/ST.Client.Desktop.Avalonia.App/App.axaml index ae6d5e070..85d256849 100644 --- a/src/ST.Client.Desktop.Avalonia.App/App.axaml +++ b/src/ST.Client.Desktop.Avalonia.App/App.axaml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:System.Application.UI" xmlns:converters="clr-namespace:System.Application.Converters;assembly=System.Application.SteamTools.Client.Desktop.Avalonia" + xmlns:sty="using:FluentAvalonia.Styling" x:Class="System.Application.UI.App"> @@ -24,7 +25,7 @@ - + - + - + - + - + diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/TaskBarWindow.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/TaskBarWindow.axaml.cs index 34103de56..740e89a6e 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/TaskBarWindow.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/TaskBarWindow.axaml.cs @@ -72,7 +72,6 @@ namespace System.Application.UI.Views.Windows { if (this.DataContext is TaskBarWindowViewModel vm) { - vm.IsVisible = false; this.Hide(); } } diff --git a/src/ST.Client.Desktop.Avalonia/ST.Client.Desktop.Avalonia.csproj b/src/ST.Client.Desktop.Avalonia/ST.Client.Desktop.Avalonia.csproj index 45b280dc2..47d021bc6 100644 --- a/src/ST.Client.Desktop.Avalonia/ST.Client.Desktop.Avalonia.csproj +++ b/src/ST.Client.Desktop.Avalonia/ST.Client.Desktop.Avalonia.csproj @@ -73,19 +73,19 @@ - + - - - - + + + + - + - + diff --git a/src/ST.Client.Desktop/Services/IShowWindowService.cs b/src/ST.Client.Desktop/Services/IShowWindowService.cs index f79ec8e5d..dd671fedd 100644 --- a/src/ST.Client.Desktop/Services/IShowWindowService.cs +++ b/src/ST.Client.Desktop/Services/IShowWindowService.cs @@ -73,6 +73,7 @@ namespace System.Application.Services #if !__MOBILE__ void CloseWindow(WindowViewModel vm); + bool IsVisibleWindow(WindowViewModel vm); void HideWindow(WindowViewModel vm); void ShowWindow(WindowViewModel vm); #else diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx index 10f08bbb2..55a115dd8 100644 --- a/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx +++ b/src/ST.Client.Desktop/UI/Resx/AppResources.en.resx @@ -226,7 +226,7 @@ Comment=;Author=沙中金 - Unlocked at s0:yyy-MM-dd HH:mm:ss + Unlocked at {0:yyyy-MM-dd HH:mm:ss} Comment=;Author=沙中金 diff --git a/src/ST.Client.Desktop/UI/ViewModels/Base/WindowViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Base/WindowViewModel.cs index ae8e91c41..3a3f2dafd 100644 --- a/src/ST.Client.Desktop/UI/ViewModels/Base/WindowViewModel.cs +++ b/src/ST.Client.Desktop/UI/ViewModels/Base/WindowViewModel.cs @@ -78,6 +78,10 @@ namespace System.Application.UI.ViewModels [IgnoreDataMember] public bool IsInitialized { get; protected set; } + [IgnoreDataMember] + public bool IsVisible => + IShowWindowService.Instance.IsVisibleWindow(this); + /// /// 关闭当前viewmodel绑定的窗口 /// diff --git a/src/ST.Client.Desktop/UI/ViewModels/Windows/TaskBarWindowViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Windows/TaskBarWindowViewModel.cs index 8d5f109a1..68de41676 100644 --- a/src/ST.Client.Desktop/UI/ViewModels/Windows/TaskBarWindowViewModel.cs +++ b/src/ST.Client.Desktop/UI/ViewModels/Windows/TaskBarWindowViewModel.cs @@ -11,13 +11,6 @@ namespace System.Application.UI.ViewModels { public class TaskBarWindowViewModel : WindowViewModel { - private bool _IsVisible; - public bool IsVisible - { - get => _IsVisible; - set => this.RaiseAndSetIfChanged(ref _IsVisible, value); - } - public new string Title => ThisAssembly.AssemblyTrademark; public string Version => ThisAssembly.Version; @@ -32,7 +25,6 @@ namespace System.Application.UI.ViewModels public async void Show(int x, int y) { SetPosition(x, y); - IsVisible = true; await IShowWindowService.Instance.Show(CustomWindow.TaskBar, this, string.Empty, ResizeModeCompat.NoResize, isParent: false); } @@ -44,7 +36,6 @@ namespace System.Application.UI.ViewModels public override void Hide() { - IsVisible = false; base.Hide(); }