Skip to content

Commit

Permalink
🚧 改进主页数据加载逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Nov 16, 2023
1 parent fd119ae commit d34a5d3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public partial class HomePage : ReactiveUserControl<HomePageViewModel>
public HomePage()
{
InitializeComponent();
this.SetViewModel<HomePageViewModel>(false);
this.SetViewModel<HomePageViewModel>(true);

//ShopsScrollViewer.PointerWheelChanged += ShopsScrollViewer_PointerWheelChanged;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ protected override void OnOpened(EventArgs e)
}
Task2.InBackground(async () =>
{
IViewModelManager.Instance.Get<HomePageViewModel>().GetServerContent();
await AdvertiseService.Current.RefrshAdvertiseAsync();
NoticeService.Current.GetNewsAsync();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ public IdleCardPageViewModel()
this.IdleManualRunNext = ReactiveCommand.Create(ManualRunNext);
this.LoginSteamCommand = ReactiveCommand.Create(async () =>
{
await LoginSteam();
await SteamAppsSort();
if (!IsLoaing)
{
IsLoaing = true;
await LoginSteam();
await SteamAppsSort();
IsLoaing = false;
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public sealed partial class IdleCardPageViewModel

public ICommand IdleManualRunNext { get; }

[Reactive]
public bool IsLoaing { get; set; }

[Reactive]
public bool RunLoaingState { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<StackPanel />
</spp:PageBase.PaneContent>

<spp:ContentLoader IsLoading="False">
<spp:ContentLoader IsLoading="{Binding IsLoaing}">
<Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto,*">
<spp:OptionsDisplayItem
Expands="True"
Expand Down Expand Up @@ -89,7 +89,7 @@
VerticalAlignment="Center"
Orientation="Vertical"
Spacing="6">
<TextBlock FontWeight="SemiBold">
<TextBlock Margin="0,6,0,0" FontWeight="SemiBold">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource StringFormatConverter}">
<CompiledBinding
Expand All @@ -104,6 +104,7 @@
</TextBlock>
<ProgressBar
Height="10"
Margin="0,0,0,6"
Classes="Material"
Maximum="100"
Value="{Binding UserIdleInfo.NextLevelExpPercentage}" />
Expand Down
6 changes: 6 additions & 0 deletions src/BD.WTTS.Client/UI/ViewModels/Pages/HomePageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public HomePageViewModel()

NavgationToMenuPageCommand = ReactiveCommand.Create<TabItemViewModel>(NavgationToMenuPage);

//GetServerContent();
}

public override void Activation()
{
base.Activation();
GetServerContent();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,16 @@ public override async Task Initialize()

//public async override void Activation()
//{
// if (IsFirstActivation)
// {
// if (UISettings.DoNotShowMessageBoxs.Value?.Contains(MessageBox.DontPromptType.Donate) == false)
// {
// //INotificationService.Instance.Notify("如果你觉得 Watt Toolkit 好用,你可以考虑给我们一些捐助以支持我们继续开发,谢谢!", NotificationType.Message);
// await MessageBox.ShowAsync("如果你觉得 Watt Toolkit 好用,你可以考虑给我们一些捐助以支持我们继续开发,谢谢!", button: MessageBox.Button.OK,
// rememberChooseKey: MessageBox.DontPromptType.Donate);
// }
// }
// //if (IsFirstActivation)
// //{
// // if (UISettings.DoNotShowMessageBoxs.Value?.Contains(MessageBox.DontPromptType.Donate) == false)
// // {
// // //INotificationService.Instance.Notify("如果你觉得 Watt Toolkit 好用,你可以考虑给我们一些捐助以支持我们继续开发,谢谢!", NotificationType.Message);
// // await MessageBox.ShowAsync("如果你觉得 Watt Toolkit 好用,你可以考虑给我们一些捐助以支持我们继续开发,谢谢!", button: MessageBox.Button.OK,
// // rememberChooseKey: MessageBox.DontPromptType.Donate);
// // }
// //}

// base.Activation();
//}

Expand Down

0 comments on commit d34a5d3

Please sign in to comment.