Skip to content

Commit

Permalink
feat: 界面小调整
Browse files Browse the repository at this point in the history
  • Loading branch information
tangge233 committed Oct 12, 2024
1 parent dc345f8 commit 10a5dc8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
</Grid.RowDefinitions>
<local:MyCard Margin="0,0,0,25" x:Name="CardIntro">
<StackPanel Margin="22,18,22,19" x:Name="PanIntro">
<StackPanel Orientation="Horizontal" Height="35">
<local:MyButton x:Name="BtnIntroWeb" MinWidth="140" Text="转到 CurseForge" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" />
<local:MyButton x:Name="BtnIntroWiki" MinWidth="140" Text="转到 MC 百科" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
<local:MyButton x:Name="BtnIntroCopy" MinWidth="140" Text="复制名称" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
<local:MyIconTextButton x:Name="BtnFavorites" Text="收藏"/>
</StackPanel>
<Grid Height="35">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<local:MyButton x:Name="BtnIntroWeb" MinWidth="140" Text="转到 CurseForge" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" />
<local:MyButton x:Name="BtnIntroWiki" MinWidth="140" Text="转到 MC 百科" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
<local:MyButton x:Name="BtnIntroCopy" MinWidth="140" Text="复制名称" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
</StackPanel>
<local:MyIconTextButton x:Name="BtnFavorites" LogoScale="0.75" HorizontalAlignment="Right"/>
</Grid>
</StackPanel>
</local:MyCard>
<StackPanel Grid.Row="1" Grid.RowSpan="2" Name="PanMain" Grid.IsSharedSizeScope="True" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")}", "")
'初始化字典
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 10a5dc8

Please sign in to comment.