From 9de7058dbbf36964435925979a2f5fe4524ad2f5 Mon Sep 17 00:00:00 2001 From: rmbgame Date: Fri, 5 Mar 2021 11:50:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=B6=E9=97=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=BD=AC=E6=8D=A2=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App.axaml | 1 + .../Converters/DateFormatConverter.cs | 22 +++++++++++++++++++ .../UI/Pages/SteamAccountPage.axaml | 4 ++-- .../Pages/SteamAccountPageViewModel.cs | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 System.Application.SteamTools.Client.Desktop.Avalonia/Application/Converters/DateFormatConverter.cs diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml b/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml index 0d2ea9061..ce6e360f6 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml +++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/App.axaml @@ -11,6 +11,7 @@ + diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia/Application/Converters/DateFormatConverter.cs b/System.Application.SteamTools.Client.Desktop.Avalonia/Application/Converters/DateFormatConverter.cs new file mode 100644 index 000000000..2bc657265 --- /dev/null +++ b/System.Application.SteamTools.Client.Desktop.Avalonia/Application/Converters/DateFormatConverter.cs @@ -0,0 +1,22 @@ +using System.Globalization; +using Avalonia.Data.Converters; + +namespace System.Application.Converters +{ + public class DateFormatConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is DateTime date && date != null && parameter is string para && !string.IsNullOrEmpty(para)) + { + return date.ToString(para); + } + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Pages/SteamAccountPage.axaml b/System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Pages/SteamAccountPage.axaml index a8df6f4df..830bb72c9 100644 --- a/System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Pages/SteamAccountPage.axaml +++ b/System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Pages/SteamAccountPage.axaml @@ -60,8 +60,8 @@ - - + + diff --git a/System.Application.SteamTools.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs b/System.Application.SteamTools.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs index c2bc3743b..b4dbe53b0 100644 --- a/System.Application.SteamTools.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs +++ b/System.Application.SteamTools.Client.Desktop/UI/ViewModels/Pages/SteamAccountPageViewModel.cs @@ -62,7 +62,7 @@ namespace System.Application.UI.ViewModels public void SteamId_Click(string accountName) { - //steamService.SetCurrentUser(accountName); + steamService.SetCurrentUser(accountName); steamService.TryKillSteamProcess(); steamService.StartSteam(); }