@@ -12,6 +12,7 @@ Public Class PageOtherFeedback
1212 Public Property Tags As New List( Of String )
1313 Public Property Open As Boolean = True
1414 Public Property Type As String
15+ Public Property IsPullRequest As Boolean = False
1516 End Class
1617
1718 Enum TagID As Int64
@@ -41,17 +42,26 @@ Public Class PageOtherFeedback
4142
4243 Public Sub FeedbackListGet(Task As LoaderTask( Of Integer , List( Of Feedback)))
4344 Dim list As JArray
44- list = NetGetCodeByRequestRetry( "https://api.github.com/repos/PCL-Community/PCL2-CE/issues?state=all&sort=created&per_page=200" , IsJson:= True , UseBrowserUserAgent:= True ) ' 获取近期 200 条数据就够了
45+ list = NetGetCodeByRequestRetry( "https://api.github.com/repos/PCL-Community/PCL2-CE/issues?state=all&sort=created&per_page=200" , IsJson:= True , UseBrowserUserAgent:= True ) '获取近期 200 条数据就够了
4546 If list Is Nothing Then Throw New Exception( "无法获取到内容" )
4647 Dim res As List( Of Feedback) = New List( Of Feedback)
4748 For Each i As JObject In list
48- Dim item As Feedback = New Feedback With {.Title = i( "title" ).ToString(),
49+ Dim pullRequestToken As JToken = i( "pull_request" )
50+ If pullRequestToken IsNot Nothing AndAlso pullRequestToken.Type <> JTokenType.Null Then
51+ Continue For
52+ End If
53+
54+ Dim item As Feedback = New Feedback With {
55+ .Title = i( "title" ).ToString(),
4956 .Url = i( "html_url" ).ToString(),
5057 .Content = i( "body" ).ToString(),
5158 .Time = Date .Parse(i( "created_at" ).ToString()),
5259 .User = i( "user" )( "login" ).ToString(),
5360 .ID = i( "number" ),
54- .Open = i( "state" ).ToString().Equals( "open" )}
61+ .Open = i( "state" ).ToString().Equals( "open" ),
62+ .IsPullRequest = False
63+ }
64+
5565 Dim issueType As String = "未分类"
5666 Dim typeToken As JToken = i( "type" )
5767 If typeToken IsNot Nothing AndAlso typeToken.Type = JTokenType.Object Then
@@ -61,6 +71,7 @@ Public Class PageOtherFeedback
6171 End If
6272 End If
6373 item.Type = issueType
74+
6475 Dim thisTags As JArray = i( "labels" )
6576 For Each thisTag As JObject In thisTags
6677 item.Tags.Add(thisTag( "id" ))
@@ -69,22 +80,43 @@ Public Class PageOtherFeedback
6980 Next
7081 Task.Output = res
7182 End Sub
72- Private Function AppendTypeToStatus(status As String , typeName As String ) As String
73- If String .IsNullOrEmpty(typeName) Then Return status
7483
75- ' 统一转为小写比较
76- Dim lowerType = typeName.ToLower()
84+ Private Function CreateFeedbackItem(item As Feedback, logo As String ) As MyListItem
85+ Dim commonInfo = $ "{item.User} | {item.Time:yyyy-MM-dd HH:mm:ss}"
7786
78- ' 允许追加的类型列表
79- Dim allowedTypes As New List( Of String ) From { "bug" , "崩溃" , "新功能" , "优化" , "未分类" , "任务" }
87+ Dim li As New MyListItem()
88+ With li
89+ .Title = item.Title
90+ .Type = MyListItem.CheckType.Clickable
91+ .Info = commonInfo
92+ .Logo = PathImage & logo
93+ .Tags = item.Type
94+ End With
8095
81- ' 如果类型在允许列表中,则追加
82- If allowedTypes.Contains(lowerType) Then
83- Return status & "-" & typeName
84- End If
96+ AddHandler li.Click, Sub (sender As Object , e As RoutedEventArgs)
97+ ShowFeedbackDetail(item)
98+ End Sub
8599
86- Return status
100+ Return li
87101 End Function
102+
103+ Private Sub ShowFeedbackDetail(item As Feedback)
104+ Dim timeSpanText = TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False )
105+ Select Case MyMsgBoxMarkdown(
106+ $"提交者:{item.User}({timeSpanText})" & vbCrLf &
107+ $"类型:{item.Type}" & vbCrLf & vbCrLf &
108+ $"{item.Content}" ,
109+ $"#{item.ID} {item.Title}" ,
110+ Button2:= "查看详情" )
111+ Case 2
112+ OpenWebsite(item.Url)
113+ End Select
114+ End Sub
115+
116+ Private Sub SetPanelVisibility(panel As StackPanel, card As MyCard)
117+ card.Visibility = If (panel.Children.Count = 0 , Visibility.Collapsed, Visibility.Visible)
118+ End Sub
119+
88120 Public Sub RefreshList()
89121 PanListProcessing.Children.Clear()
90122 PanListWaitingProcess.Children.Clear()
@@ -94,254 +126,55 @@ Public Class PageOtherFeedback
94126 PanListCompleted.Children.Clear()
95127 PanListDecline.Children.Clear()
96128 PanListIgnored.Children.Clear()
97- For Each item In Loader.Output
98- Dim StatusDesc As String = "???"
99- Dim commonInfo = $"{item.User} | {item.Time} | 类型: {item.Type}"
100-
101- Dim clickHandler As Action = Sub ()
102- Select Case MyMsgBoxMarkdown(
103- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
104- $"状态:{item.Tags} | 类型:{item.Type}" & vbCrLf & vbCrLf &
105- $"{item.Content}" ,
106- $"#{item.ID} {item.Title}" ,
107- Button2:= "查看详情" )
108- Case 2
109- OpenWebsite(item.Url) ' 打开 GitHub Issue 链接
110- End Select
111- End Sub
112-
113- ' 正在处理
129+ PanListDuplicate.Children.Clear()
114130
131+ For Each item In Loader.Output
115132 If item.Tags.Contains(TagID.Processing) Then
116- Dim li As New MyListItem()
117- With li
118- .Title = item.Title
119- .Type = MyListItem.CheckType.Clickable
120- .Info = commonInfo
121- .Logo = PathImage & "Blocks/CommandBlock.png"
122- .Tags = item.Type
123- End With
124-
125- AddHandler li.Click,
126- Sub (sender As Object , e As RoutedEventArgs)
127- Select Case MyMsgBoxMarkdown(
128- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
129- $"类型:{item.Type}" & vbCrLf & vbCrLf &
130- $"{item.Content}" ,
131- $"#{item.ID} {item.Title}" ,
132- Button2:= "查看详情" )
133- Case 2
134- OpenWebsite(item.Url)
135- End Select
136- End Sub
137-
138- PanListProcessing.Children.Add(li)
133+ PanListProcessing.Children.Add(CreateFeedbackItem(item, "Blocks/CommandBlock.png" ))
139134 End If
140135
141- '等待处理
142-
143136 If item.Tags.Contains(TagID.WaitingProcess) Then
144- Dim li As New MyListItem()
145- With li
146- .Title = item.Title
147- .Type = MyListItem.CheckType.Clickable
148- .Info = commonInfo
149- .Logo = PathImage & "Blocks/RedstoneBlock.png"
150- .Tags = item.Type
151- End With
152-
153- AddHandler li.Click,
154- Sub (sender As Object , e As RoutedEventArgs)
155- Select Case MyMsgBoxMarkdown(
156- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
157- $"类型:{item.Type}" & vbCrLf & vbCrLf &
158- $"{item.Content}" ,
159- $"#{item.ID} {item.Title}" ,
160- Button2:= "查看详情" )
161- Case 2
162- OpenWebsite(item.Url)
163- End Select
164- End Sub
165-
166- PanListWaitingProcess.Children.Add(li)
137+ PanListWaitingProcess.Children.Add(CreateFeedbackItem(item, "Blocks/RedstoneBlock.png" ))
167138 End If
168139
169- 'WAIT
170-
171140 If item.Tags.Contains(TagID.Wait) Then
172- Dim li As New MyListItem()
173- With li
174- .Title = item.Title
175- .Type = MyListItem.CheckType.Clickable
176- .Info = commonInfo
177- .Logo = PathImage & "Blocks/Anvil.png"
178- .Tags = item.Type
179- End With
180-
181- AddHandler li.Click,
182- Sub (sender As Object , e As RoutedEventArgs)
183- Select Case MyMsgBoxMarkdown(
184- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
185- $"类型:{item.Type}" & vbCrLf & vbCrLf &
186- $"{item.Content}" ,
187- $"#{item.ID} {item.Title}" ,
188- Button2:= "查看详情" )
189- Case 2
190- OpenWebsite(item.Url)
191- End Select
192- End Sub
193-
194- PanListWait.Children.Add(li)
141+ PanListWait.Children.Add(CreateFeedbackItem(item, "Blocks/Anvil.png" ))
195142 End If
196143
197- 'PAUSE
198-
199144 If item.Tags.Contains(TagID.Pause) Then
200- Dim li As New MyListItem()
201- With li
202- .Title = item.Title
203- .Type = MyListItem.CheckType.Clickable
204- .Info = commonInfo
205- .Logo = PathImage & "Blocks/RedstoneLampOff.png"
206- .Tags = item.Type
207- End With
208-
209- AddHandler li.Click,
210- Sub (sender As Object , e As RoutedEventArgs)
211- Select Case MyMsgBoxMarkdown(
212- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
213- $"类型:{item.Type}" & vbCrLf & vbCrLf &
214- $"{item.Content}" ,
215- $"#{item.ID} {item.Title}" ,
216- Button2:= "查看详情" )
217- Case 2
218- OpenWebsite(item.Url)
219- End Select
220- End Sub
221-
222- PanListPause.Children.Add(li)
145+ PanListPause.Children.Add(CreateFeedbackItem(item, "Blocks/RedstoneLampOff.png" ))
223146 End If
224147
225- 'UP NEXT
226-
227148 If item.Tags.Contains(TagID.Upnext) Then
228- Dim li As New MyListItem()
229- With li
230- .Title = item.Title
231- .Type = MyListItem.CheckType.Clickable
232- .Info = commonInfo
233- .Logo = PathImage & "Blocks/RedstoneLampOn.png"
234- .Tags = item.Type
235- End With
236-
237- AddHandler li.Click,
238- Sub (sender As Object , e As RoutedEventArgs)
239- Select Case MyMsgBoxMarkdown(
240- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
241- $"类型:{item.Type}" & vbCrLf & vbCrLf &
242- $"{item.Content}" ,
243- $"#{item.ID} {item.Title}" ,
244- Button2:= "查看详情" )
245- Case 2
246- OpenWebsite(item.Url)
247- End Select
248- End Sub
249-
250- PanListUpnext.Children.Add(li)
149+ PanListUpnext.Children.Add(CreateFeedbackItem(item, "Blocks/RedstoneLampOn.png" ))
251150 End If
252151
253- '已完成
254-
255152 If item.Tags.Contains(TagID.Completed) Then
256- Dim li As New MyListItem()
257- With li
258- .Title = item.Title
259- .Type = MyListItem.CheckType.Clickable
260- .Info = commonInfo
261- .Logo = PathImage & "Blocks/Grass.png"
262- .Tags = item.Type
263- End With
264-
265- AddHandler li.Click,
266- Sub (sender As Object , e As RoutedEventArgs)
267- Select Case MyMsgBoxMarkdown(
268- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
269- $"类型:{item.Type}" & vbCrLf & vbCrLf &
270- $"{item.Content}" ,
271- $"#{item.ID} {item.Title}" ,
272- Button2:= "查看详情" )
273- Case 2
274- OpenWebsite(item.Url)
275- End Select
276- End Sub
277-
278- PanListCompleted.Children.Add(li)
153+ PanListCompleted.Children.Add(CreateFeedbackItem(item, "Blocks/Grass.png" ))
279154 End If
280155
281- '已拒绝
282-
283156 If item.Tags.Contains(TagID.Decline) Then
284- Dim li As New MyListItem()
285- With li
286- .Title = item.Title
287- .Type = MyListItem.CheckType.Clickable
288- .Info = commonInfo
289- .Logo = PathImage & "Blocks/CobbleStone.png"
290- .Tags = item.Type
291- End With
292-
293- AddHandler li.Click,
294- Sub (sender As Object , e As RoutedEventArgs)
295- Select Case MyMsgBoxMarkdown(
296- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
297- $"类型:{item.Type}" & vbCrLf & vbCrLf &
298- $"{item.Content}" ,
299- $"#{item.ID} {item.Title}" ,
300- Button2:= "查看详情" )
301- Case 2
302- OpenWebsite(item.Url)
303- End Select
304- End Sub
305-
306- PanListDecline.Children.Add(li)
157+ PanListDecline.Children.Add(CreateFeedbackItem(item, "Blocks/CobbleStone.png" ))
307158 End If
308159
309- '已忽略
310-
311160 If item.Tags.Contains(TagID.Ignored) Then
312- Dim li As New MyListItem()
313- With li
314- .Title = item.Title
315- .Type = MyListItem.CheckType.Clickable
316- .Info = commonInfo
317- .Logo = PathImage & "Blocks/CobbleStone.png"
318- .Tags = item.Type
319- End With
320-
321- AddHandler li.Click,
322- Sub (sender As Object , e As RoutedEventArgs)
323- Select Case MyMsgBoxMarkdown(
324- $"提交者:{item.User}({TimeUtils.GetTimeSpanString(item.Time - DateTime.Now, False)})" & vbCrLf &
325- $"类型:{item.Type}" & vbCrLf & vbCrLf &
326- $"{item.Content}" ,
327- $"#{item.ID} {item.Title}" ,
328- Button2:= "查看详情" )
329- Case 2
330- OpenWebsite(item.Url)
331- End Select
332- End Sub
161+ PanListIgnored.Children.Add(CreateFeedbackItem(item, "Blocks/CobbleStone.png" ))
162+ End If
333163
334- PanListIgnored.Children.Add(li)
164+ If item.Tags.Contains(TagID.Duplicate) Then
165+ PanListDuplicate.Children.Add(CreateFeedbackItem(item, "Blocks/CobbleStone.png" ))
335166 End If
336- PanContentDecline.Visibility = If (PanListDecline.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
337- PanContentCompleted.Visibility = If (PanListCompleted.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
338- PanContentWaitingProcess.Visibility = If (PanListWaitingProcess.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
339- PanContentProcessing.Visibility = If (PanListProcessing.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
340- PanContentIgnored.Visibility = If (PanListIgnored.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
341- PanContentWait.Visibility = If (PanListWait.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
342- PanContentPause.Visibility = If (PanListPause.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
343- PanContentUpnext.Visibility = If (PanListUpnext.Children.Count.Equals( 0 ), Visibility.Collapsed, Visibility.Visible)
344167 Next
168+
169+ SetPanelVisibility(PanListProcessing, PanContentProcessing)
170+ SetPanelVisibility(PanListWaitingProcess, PanContentWaitingProcess)
171+ SetPanelVisibility(PanListWait, PanContentWait)
172+ SetPanelVisibility(PanListPause, PanContentPause)
173+ SetPanelVisibility(PanListUpnext, PanContentUpnext)
174+ SetPanelVisibility(PanListCompleted, PanContentCompleted)
175+ SetPanelVisibility(PanListDecline, PanContentDecline)
176+ SetPanelVisibility(PanListIgnored, PanContentIgnored)
177+ SetPanelVisibility(PanListDuplicate, PanContentDuplicate)
345178 End Sub
346179
347180 Private Sub Feedback_Click(sender As Object , e As MouseButtonEventArgs)
0 commit comments