Skip to content

Commit

Permalink
feat: 进入详情页面
Browse files Browse the repository at this point in the history
  • Loading branch information
tangge233 committed Oct 16, 2024
1 parent ff1b373 commit 3c177f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Public Class MyMiniCompItem
End Property

'按钮
Public ButtonHandler As Action(Of MyLocalModItem, EventArgs)
Public ButtonHandler As Action(Of MyMiniCompItem, EventArgs)
Public ButtonStack As FrameworkElement
Private _Buttons As IEnumerable(Of MyIconButton)
Public Property Buttons As IEnumerable(Of MyIconButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,37 @@
End Sub

Private CompItemList As New List(Of MyMiniCompItem)
Private SelectedItemList As New List(Of MyMiniCompItem)

'结果 UI 化
Private Sub Load_OnFinish()
CompItemList.Clear()
For Each item In Loader.Output
Dim CompItem = item.ToMiniCompItem()

'----添加按钮----
'删除按钮
Dim Btn_Delete As New MyIconButton
Btn_Delete.Logo = Logo.IconButtonDelete
AddHandler Btn_Delete.Click, Sub()
Btn_Delete.Logo = Logo.IconButtonLikeFill
Btn_Delete.ToolTip = "取消收藏"
ToolTipService.SetPlacement(Btn_Delete, Primitives.PlacementMode.Center)
ToolTipService.SetVerticalOffset(Btn_Delete, 30)
ToolTipService.SetHorizontalOffset(Btn_Delete, 2)
AddHandler Btn_Delete.Click, Sub(sender As Object, e As EventArgs)
If CompItem Is Nothing Then Exit Sub
If CompFavorites.Del(item.Id) Then Hint($"已取消收藏 {item.TranslatedName}!", HintType.Finish)
If CompFavorites.Del(CompItem.Entry.Id) Then Hint($"已取消收藏 {CompItem.Entry.TranslatedName}!", HintType.Finish)
CompItemList.Remove(CompItem)
RefreshContent()
RefreshCardTitle()
End Sub
CompItem.Buttons = {Btn_Delete}
'---操作逻辑---
'右键查看详细信息界面
AddHandler CompItem.MouseRightButtonUp, Sub(sender As Object, e As EventArgs)
FrmMain.PageChange(New FormMain.PageStackData With {.Page = FormMain.PageType.CompDetail,
.Additional = {CompItem.Entry, New List(Of String), String.Empty, CompModLoaderType.Any}})
End Sub

CompItemList.Add(CompItem)
Next
Try
Expand Down

0 comments on commit 3c177f9

Please sign in to comment.