Skip to content

Commit

Permalink
跟进Hex-Dragon#5812,更改名称
Browse files Browse the repository at this point in the history
  • Loading branch information
Open-KFC committed Mar 8, 2025
1 parent 6b7cceb commit 3a24776
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<local:MyCard x:Class="MyDlEntry"
<local:MyCard x:Class="MyTaskCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PCL">
<local:MyIconButton x:Name="BtnCancel" Logo="F1 M2,0 L0,2 8,10 0,18 2,20 10,12 18,20 20,18 12,10 20,2 18,0 10,8 2,0Z"
Height="20" Margin="0 10 10 0" LogoScale="1.1" HorizontalAlignment="Right" VerticalAlignment="Top" />
<ListBox x:Name="TaskListBox" ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MyDlEntry}, Path=TaskEntries}"
<ListBox x:Name="TaskListBox" ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MyTaskCard}, Path=TaskEntries}"
Background="Transparent" BorderThickness="0" IsHitTestVisible="False" Margin="14 40 15 10">
<ListBox.ItemTemplate>
<DataTemplate>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel

Public Class MyDlEntry
Public Class MyTaskCard
Inherits MyCard

''' <summary>
''' 卡片中每一条子下载任务的数据模型,将Loader作为唯一标识符
''' </summary>
Public Class MyDlTaskEntry
Public Class MySubTaskEntry
Implements INotifyPropertyChanged

Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Expand Down Expand Up @@ -105,14 +105,14 @@ Public Class MyDlEntry
''' <summary>
''' TaskListBox的数据源
''' </summary>
Public ReadOnly Property TaskEntries As New ObservableCollection(Of MyDlTaskEntry)
Public ReadOnly Property TaskEntries As New ObservableCollection(Of MySubTaskEntry)

Public Loader As LoaderBase

''' <summary>
''' 获取所有子下载任务
''' </summary>
Private ReadOnly Property SubDlTasks As List(Of LoaderBase)
Private ReadOnly Property SubTasks As List(Of LoaderBase)
Get
Return CType(Loader, Object).GetLoaderList()
End Get
Expand Down Expand Up @@ -156,10 +156,10 @@ Public Class MyDlEntry
If Loader.State = LoadState.Failed Then
Failed = True
Else
For Each DlTask As LoaderBase In SubDlTasks
Dim TaskEntry = TaskEntries.FirstOrDefault(Function(t) t.Loader Is DlTask)
For Each SubTask As LoaderBase In SubTasks
Dim TaskEntry = TaskEntries.FirstOrDefault(Function(t) t.Loader Is SubTask)
If TaskEntry Is Nothing Then '除了第一次调用之外不会进入这个case,因为LoaderCombo的子加载任务不会增加
TaskEntries.Add(New MyDlTaskEntry(DlTask))
TaskEntries.Add(New MySubTaskEntry(SubTask))
Else
TaskEntry.SyncValuesToUI()
End If
Expand Down
18 changes: 9 additions & 9 deletions Plain Craft Launcher 2/Pages/PageSpeedRight.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
''' <summary>
''' 寻找对应这个Loader的下载卡片,找不到返回Nothing
''' </summary>
Private Function FindDlCard(Loader As LoaderBase) As MyDlEntry
Private Function FindTaskCard(Loader As LoaderBase) As MyTaskCard
For Each Card In PanMain.Children
If TypeOf Card Is MyDlEntry AndAlso CType(Card, MyDlEntry).Loader Is Loader Then Return Card
If TypeOf Card Is MyTaskCard AndAlso CType(Card, MyTaskCard).Loader Is Loader Then Return Card
Next
Return Nothing
End Function
Expand All @@ -35,17 +35,17 @@
''' </summary>
Public Sub TaskRefresh(Loader As LoaderBase)
If Loader Is Nothing OrElse Not Loader.Show Then Exit Sub
Dim DlCard As MyDlEntry = FindDlCard(Loader)
Dim TaskCard As MyTaskCard = FindTaskCard(Loader)
Select Case Loader.State
Case LoadState.Failed, LoadState.Loading, LoadState.Waiting
If DlCard IsNot Nothing Then
DlCard.RefreshSubTasks()
If TaskCard IsNot Nothing Then
TaskCard.RefreshSubTasks()
Else
PanMain.Children.Add(New MyDlEntry(Loader) With {.Margin = New Thickness(0, 0, 0, 15)})
PanMain.Children.Add(New MyTaskCard(Loader) With {.Margin = New Thickness(0, 0, 0, 15)})
End If
Case LoadState.Finished, LoadState.Aborted
If DlCard IsNot Nothing Then
AniDispose(DlCard, True, AddressOf TryReturnToHome)
If TaskCard IsNot Nothing Then
AniDispose(TaskCard, True, AddressOf TryReturnToHome)
End If
End Select
End Sub
Expand All @@ -57,7 +57,7 @@
RunInUiWait(
Sub()
For Each Card In PanMain.Children
If TypeOf Card IsNot MyDlEntry OrElse CType(Card, MyDlEntry).Loader IsNot Loader Then Continue For
If TypeOf Card IsNot MyTaskCard OrElse CType(Card, MyTaskCard).Loader IsNot Loader Then Continue For
PanMain.Children.Remove(Card)
Next
End Sub)
Expand Down
11 changes: 3 additions & 8 deletions Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@
<Compile Include="Controls\MyComboBox.vb" />
<Compile Include="Controls\MyComboBoxItem.vb" />
<Compile Include="Controls\MyCard.vb" />
<Compile Include="Controls\MyDlEntry.xaml.vb">
<DependentUpon>MyDlEntry.xaml</DependentUpon>
<Compile Include="Controls\MyTaskCard.xaml.vb">
<DependentUpon>MyTaskCard.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\MyExtraTextButton.xaml.vb">
<DependentUpon>MyExtraTextButton.xaml</DependentUpon>
Expand All @@ -198,9 +198,6 @@
<Compile Include="Controls\MyIconTextButton.xaml.vb">
<DependentUpon>MyIconTextButton.xaml</DependentUpon>
</Compile>



<Compile Include="Modules\Minecraft\ModComp.vb" />
<Compile Include="Modules\Minecraft\ModJava.vb" />
<Compile Include="Modules\Minecraft\ModMod.vb" />
Expand Down Expand Up @@ -391,7 +388,7 @@
<Compile Include="Pages\PageSpeedRight.xaml.vb">
<DependentUpon>PageSpeedRight.xaml</DependentUpon>
</Compile>
<Page Include="Controls\MyDlEntry.xaml">
<Page Include="Controls\MyTaskCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down Expand Up @@ -496,7 +493,6 @@
<DependentUpon>FormMain.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>

<Page Include="Modules\Minecraft\MyLocalModItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -935,7 +931,6 @@
<Resource Include="Images\Heads\MCBBS.png" />
</ItemGroup>
<ItemGroup>

</ItemGroup>
<ItemGroup>
<Resource Include="Images\Blocks\NeoForge.png" />
Expand Down

0 comments on commit 3a24776

Please sign in to comment.