diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml index 09814b08..2addf147 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml @@ -13,12 +13,14 @@ - - - - - - + + + + + + + + diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb index 2ea1cb50..0ed03944 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb @@ -48,6 +48,14 @@ End Sub End Class Private Sub Load_OnFinish() + If CompFavorites.Has(Project) Then + BtnFavorites.Text = "取消收藏" + BtnFavorites.Logo = Logo.IconButtonLikeFill + Else + BtnFavorites.Text = "收藏" + BtnFavorites.Logo = Logo.IconButtonLikeLine + End If + Dim TargetCardName As String = If(TargetVersion <> "" OrElse TargetLoader <> CompModLoaderType.Any, $"所选版本:{TargetVersion} {If(TargetLoader <> CompModLoaderType.Any, TargetLoader, "")}", "") '初始化字典 @@ -112,14 +120,6 @@ If PanMain.Children.Count = 1 Then CType(PanMain.Children(0), MyCard).IsSwaped = False End If - - If CompFavorites.Has(Project) Then - BtnFavorites.Text = "取消收藏" - BtnFavorites.Logo = Logo.IconButtonLikeFill - Else - BtnFavorites.Text = "收藏" - BtnFavorites.Logo = Logo.IconButtonLikeLine - End If Catch ex As Exception Log(ex, "可视化工程下载列表出错", LogLevel.Feedback) End Try diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompFavorites.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompFavorites.xaml.vb index 75d4ff2c..20368d4d 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompFavorites.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompFavorites.xaml.vb @@ -3,9 +3,16 @@ '加载器信息 Public Shared Loader As New LoaderTask(Of List(Of CompProject), Integer)("CompProject Favorites", AddressOf CompFavoritesGet, AddressOf LoaderInput) + Private IsSearching As Boolean = False + Private Sub PageDownloadMod_Inited(sender As Object, e As EventArgs) Handles Me.Initialized PageLoaderInit(Load, PanLoad, PanContent, Nothing, Loader, AddressOf Load_OnFinish, AddressOf LoaderInput) End Sub + Private Sub PageDownloadCompDetail_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded + 'Initialized 只会执行一次 + If Loader.ShouldStart(LoaderInput()) Then Loader.Start() + End Sub + Private Shared Function LoaderInput() As List(Of CompProject) Return CompFavorites.GetAll() End Function @@ -50,11 +57,22 @@ PanProjectsModpack.Children.Add(NoContentTip) End If End If + + RefreshCardTitle() Catch ex As Exception Log(ex, "可视化收藏夹列表出错", LogLevel.Feedback) End Try End Sub + Private Sub RefreshCardTitle() + If IsSearching Then + + Else + CardProjectsMod.Title = $"Mod ({If(Loader.Input.Exists(Function(e) e.Type = CompType.Mod), PanProjectsMod.Children.Count, 0)})" + CardProjectsModpack.Title = $"整合包 ({If(Loader.Input.Exists(Function(e) e.Type = CompType.ModPack), PanProjectsModpack.Children.Count, 0)})" + End If + End Sub + '自动重试 Private Sub Load_State(sender As Object, state As MyLoading.MyLoadingState, oldState As MyLoading.MyLoadingState) Handles Load.StateChanged Select Case Loader.State