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(); }