Skip to content

Commit

Permalink
🎨 改进主窗口数据加载
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Mar 15, 2024
1 parent 056a73e commit 077a333
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/BD.WTTS.Client.Avalonia/UI/Views/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ protected override void OnClosing(WindowClosingEventArgs e)
}
}

DateTime lastOpenedTime;

protected override async void OnOpened(EventArgs e)
{
base.OnOpened(e);
Expand All @@ -51,9 +53,14 @@ protected override async void OnOpened(EventArgs e)
INavigationService.Instance.Navigate(typeof(HomePage));
}
}
await IViewModelManager.Instance.Get<HomePageViewModel>().GetServerContent();
await AdvertiseService.Current.RefrshAdvertiseAsync();
await NoticeService.Current.GetNewsAsync();
if (lastOpenedTime == default ||
(DateTime.Now - lastOpenedTime) > TimeSpan.FromSeconds(30))
{
lastOpenedTime = DateTime.Now;
await IViewModelManager.Instance.Get<HomePageViewModel>().GetServerContent();
await AdvertiseService.Current.RefrshAdvertiseAsync();
await NoticeService.Current.GetNewsAsync();
}
try // 在主窗口显示时调用此函数检查是否需要显示新版本通知窗口
{
Ioc.Get_Nullable<IAppUpdateService>()?.OnMainOpenTryShowNewVersionWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"BD.WTTS.Client.Tools.Publish": {
"commandName": "Project",
"commandLineArgs": "nsis --rids win-x64 --hsm-sign --t 240314_1523131679333",
"commandLineArgs": "run --rids win-x64 --hsm-sign --stm-upload",
"commandLineArgs_release": "run --rids win-x64 --hsm-sign --stm-upload",
"commandLineArgs_nsis": "nsis --rids win-x64 --hsm-sign --t 240314_1523131679333",
"commandLineArgs_debug": "run --rids win-x64 --hsm-sign --stm-upload --debug",
Expand Down

0 comments on commit 077a333

Please sign in to comment.