forked from BeyondDimension/SteamTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
34 changes: 26 additions & 8 deletions
34
src/ST.Client.Desktop.Avalonia/Application/UI/Views/Pages/UserCenter/UserItem.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.LogicalTree; | ||
using Avalonia.Markup.Xaml; | ||
using System.Application.Services; | ||
|
||
namespace System.Application.UI.Views.Pages | ||
namespace System.Application.UI.Views.Pages; | ||
|
||
public partial class UserItem : UserControl | ||
{ | ||
public partial class UserItem : UserControl | ||
public UserItem() | ||
{ | ||
public UserItem() | ||
{ | ||
InitializeComponent(); | ||
} | ||
InitializeComponent(); | ||
} | ||
|
||
private void InitializeComponent() | ||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) | ||
{ | ||
if (UserService.Current.User != null) | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
var lastSignInTime = UserService.Current.LastSignInTime; | ||
if (lastSignInTime.HasValue) | ||
{ | ||
if (DateTimeOffset.Now - lastSignInTime.Value >= TimeSpan.FromDays(1)) | ||
{ | ||
UserService.Current.User.IsSignIn = true; | ||
} | ||
} | ||
} | ||
|
||
base.OnAttachedToLogicalTree(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters