@@ -7,7 +7,8 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Grid x:Name="PanAllBack">
|
<Grid x:Name="PanAllBack">
|
||||||
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
|
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
|
||||||
<StackPanel x:Name="PanMain" Margin="25,10,25,10" Grid.IsSharedSizeScope="True"> <!-- 若显示多选模块则为 92 -->
|
<StackPanel x:Name="PanMain" Margin="25,10,25,10" Grid.IsSharedSizeScope="True">
|
||||||
|
<!-- 若显示多选模块则为 92 -->
|
||||||
<local:MySearchBox Margin="0,15" HintText="搜索 Mod 名称 / 描述 / 标签" x:Name="SearchBox" />
|
<local:MySearchBox Margin="0,15" HintText="搜索 Mod 名称 / 描述 / 标签" x:Name="SearchBox" />
|
||||||
<local:MyCard Grid.Row="0" Margin="0,0,0,15" x:Name="PanManage">
|
<local:MyCard Grid.Row="0" Margin="0,0,0,15" x:Name="PanManage">
|
||||||
<Grid Margin="15,15,0,15" Height="35">
|
<Grid Margin="15,15,0,15" Height="35">
|
||||||
@@ -24,6 +25,17 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</local:MyCard>
|
</local:MyCard>
|
||||||
<local:MyCard x:Name="PanListBack" VerticalAlignment="Top" Opacity="0" Margin="0,0,0,15" Title=" " MinHeight="40">
|
<local:MyCard x:Name="PanListBack" VerticalAlignment="Top" Opacity="0" Margin="0,0,0,15" Title=" " MinHeight="40">
|
||||||
|
<StackPanel Margin="0,8,9,0" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="24">
|
||||||
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="全部" x:Name="BtnTypeAll" ColorType="Highlight" Checked="True"/>
|
||||||
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="已启用" x:Name="BtnTypeEnabled" ColorType="Highlight"/>
|
||||||
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="已禁用" x:Name="BtnTypeDisabled" ColorType="Highlight"/>
|
||||||
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="可更新" x:Name="BtnTypeCanUpdate" ColorType="Highlight"/>
|
||||||
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="错误" x:Name="BtnTypeError" ColorType="Highlight"/>
|
||||||
|
</StackPanel>
|
||||||
<StackPanel Margin="20,38,18,18" Name="PanList" VerticalAlignment="Top" />
|
<StackPanel Margin="20,38,18,18" Name="PanList" VerticalAlignment="Top" />
|
||||||
</local:MyCard>
|
</local:MyCard>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
|
|
||||||
Private IsLoad As Boolean = False
|
Private IsLoad As Boolean = False
|
||||||
Public Sub PageOther_Loaded() Handles Me.Loaded
|
Public Sub PageOther_Loaded() Handles Me.Loaded
|
||||||
|
BtnTypeAll.Tag = ViewType.All
|
||||||
|
BtnTypeEnabled.Tag = ViewType.Enabled
|
||||||
|
BtnTypeDisabled.Tag = ViewType.Disabled
|
||||||
|
BtnTypeCanUpdate.Tag = ViewType.CanUpdate
|
||||||
|
BtnTypeError.Tag = ViewType.InError
|
||||||
|
|
||||||
If FrmMain.PageLast.Page <> FormMain.PageType.CompDetail Then PanBack.ScrollToHome()
|
If FrmMain.PageLast.Page <> FormMain.PageType.CompDetail Then PanBack.ScrollToHome()
|
||||||
AniControlEnabled += 1
|
AniControlEnabled += 1
|
||||||
@@ -27,6 +32,8 @@
|
|||||||
Public Sub RefreshList(Optional ForceReload As Boolean = False)
|
Public Sub RefreshList(Optional ForceReload As Boolean = False)
|
||||||
If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then
|
If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then
|
||||||
Log("[System] 已刷新 Mod 列表")
|
Log("[System] 已刷新 Mod 列表")
|
||||||
|
ViewModType = ViewType.All
|
||||||
|
BtnTypeAll.Checked = True
|
||||||
PanBack.ScrollToHome()
|
PanBack.ScrollToHome()
|
||||||
SearchBox.Text = ""
|
SearchBox.Text = ""
|
||||||
End If
|
End If
|
||||||
@@ -125,33 +132,81 @@
|
|||||||
''' 刷新结果显示。
|
''' 刷新结果显示。
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub RefreshResult(Mods As List(Of McMod))
|
Private Sub RefreshResult(Mods As List(Of McMod))
|
||||||
|
If PanList Is Nothing Then Exit Sub
|
||||||
|
Dim ShowMods As List(Of McMod) = New List(Of McMod)
|
||||||
|
Select Case ViewModType
|
||||||
|
Case ViewType.All
|
||||||
|
ShowMods = Mods
|
||||||
|
Case ViewType.Enabled
|
||||||
|
For Each Item In Mods
|
||||||
|
If Item.State.Equals(McMod.McModState.Fine) Then ShowMods.Add(Item)
|
||||||
|
Next
|
||||||
|
Case ViewType.Disabled
|
||||||
|
For Each Item In Mods
|
||||||
|
If Item.State.Equals(McMod.McModState.Disabled) Then ShowMods.Add(Item)
|
||||||
|
Next
|
||||||
|
Case ViewType.CanUpdate
|
||||||
|
For Each Item In Mods
|
||||||
|
If Item.CanUpdate Then ShowMods.Add(Item)
|
||||||
|
Next
|
||||||
|
Case ViewType.InError
|
||||||
|
For Each Item In Mods
|
||||||
|
If Item.State.Equals(McMod.McModState.Unavaliable) Then ShowMods.Add(Item)
|
||||||
|
Next
|
||||||
|
End Select
|
||||||
PanList.Children.Clear()
|
PanList.Children.Clear()
|
||||||
For Each TargetMod In Mods
|
For Each TargetMod In ShowMods
|
||||||
PanList.Children.Add(ModItems(TargetMod.RawFileName))
|
PanList.Children.Add(ModItems(TargetMod.RawFileName))
|
||||||
Next
|
Next
|
||||||
|
Dim ModEnabled As Integer = 0
|
||||||
|
Dim ModDisabled As Integer = 0
|
||||||
|
Dim ModCanUpdate As Integer = 0
|
||||||
|
Dim ModError As Integer = 0
|
||||||
|
For Each ModItem In ModItems
|
||||||
|
If ModItem.Value.Entry.CanUpdate Then
|
||||||
|
ModCanUpdate += 1
|
||||||
|
End If
|
||||||
|
If ModItem.Value.Entry.State.Equals(McMod.McModState.Fine) Then
|
||||||
|
ModEnabled += 1
|
||||||
|
End If
|
||||||
|
If ModItem.Value.Entry.State.Equals(McMod.McModState.Disabled) Then
|
||||||
|
ModDisabled += 1
|
||||||
|
End If
|
||||||
|
If ModItem.Value.Entry.State.Equals(McMod.McModState.Unavaliable) Then
|
||||||
|
ModError += 1
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModError}) "
|
||||||
|
BtnTypeCanUpdate.Text = $"可更新 ({ModCanUpdate}) "
|
||||||
|
BtnTypeEnabled.Text = $"已启用 ({ModEnabled}) "
|
||||||
|
BtnTypeDisabled.Text = $"已禁用 ({ModDisabled}) "
|
||||||
|
BtnTypeError.Text = $"错误 ({ModError}) "
|
||||||
RefreshTitle()
|
RefreshTitle()
|
||||||
End Sub
|
End Sub
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' 刷新卡片标题。
|
''' 刷新卡片标题。
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub RefreshTitle()
|
Private Sub RefreshTitle()
|
||||||
Dim Mods = PanList.Children.Cast(Of MyLocalModItem).Select(Function(i) i.Entry).ToList
|
|
||||||
Dim Counter = {0, 0, 0}
|
|
||||||
For Each ModEntity As McMod In Mods
|
|
||||||
Counter(ModEntity.State) += 1
|
|
||||||
Next
|
|
||||||
Dim TypeList As New List(Of String)
|
|
||||||
If Counter(McMod.McModState.Disabled) > 0 Then TypeList.Add("禁用 " & Counter(McMod.McModState.Disabled))
|
|
||||||
If Counter(McMod.McModState.Unavaliable) > 0 Then TypeList.Add("错误 " & Counter(McMod.McModState.Unavaliable))
|
|
||||||
If Counter(McMod.McModState.Fine) > 0 Then TypeList.Insert(0, If(TypeList.Any, "启用 ", "") & Counter(McMod.McModState.Fine))
|
|
||||||
If Not IsSearching Then
|
If Not IsSearching Then
|
||||||
PanListBack.Title = "Mod 列表 (" & Join(TypeList, ",") & ")"
|
PanListBack.Title = "Mod 列表 - "
|
||||||
ElseIf TypeList.Any() Then
|
ElseIf PanList.Children.Count > 0 Then
|
||||||
PanListBack.Title = "搜索结果 (" & Join(TypeList, ",") & ")"
|
PanListBack.Title = "搜索结果 - "
|
||||||
Else
|
Else
|
||||||
PanListBack.Title = "无搜索结果"
|
PanListBack.Title = "无搜索结果 - "
|
||||||
End If
|
End If
|
||||||
PanList.Visibility = If(Mods.Any(), Visibility.Visible, Visibility.Collapsed)
|
Select Case ViewModType
|
||||||
|
Case ViewType.All
|
||||||
|
PanListBack.Title += BtnTypeAll.Text
|
||||||
|
Case ViewType.Enabled
|
||||||
|
PanListBack.Title += BtnTypeEnabled.Text
|
||||||
|
Case ViewType.Disabled
|
||||||
|
PanListBack.Title += BtnTypeDisabled.Text
|
||||||
|
Case ViewType.CanUpdate
|
||||||
|
PanListBack.Title += BtnTypeCanUpdate.Text
|
||||||
|
Case ViewType.InError
|
||||||
|
PanListBack.Title += BtnTypeError.Text
|
||||||
|
End Select
|
||||||
|
PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
@@ -192,10 +247,14 @@
|
|||||||
''' 全选。
|
''' 全选。
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click
|
Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click
|
||||||
If SelectedMods.Count < PanList.Children.Count Then
|
Dim CurrentSelected As Integer = 0
|
||||||
ChangeAllSelected(True)
|
For Each Item In PanList.Children.OfType(Of MyLocalModItem).ToList
|
||||||
|
If Item.Checked Then CurrentSelected += 1
|
||||||
|
Next
|
||||||
|
If CurrentSelected < PanList.Children.Count Then
|
||||||
|
ChangeCurrentSelected(True)
|
||||||
Else
|
Else
|
||||||
ChangeAllSelected(False)
|
ChangeCurrentSelected(False)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -303,7 +362,7 @@
|
|||||||
Private Sub ChangeAllSelected(Value As Boolean)
|
Private Sub ChangeAllSelected(Value As Boolean)
|
||||||
AniControlEnabled += 1
|
AniControlEnabled += 1
|
||||||
SelectedMods.Clear()
|
SelectedMods.Clear()
|
||||||
For Each Item As MyLocalModItem In PanList.Children
|
For Each Item As MyLocalModItem In ModItems.Values.ToList
|
||||||
Item.Checked = Value
|
Item.Checked = Value
|
||||||
If Value Then SelectedMods.Add(Item.Entry.RawFileName)
|
If Value Then SelectedMods.Add(Item.Entry.RawFileName)
|
||||||
Next
|
Next
|
||||||
@@ -311,6 +370,22 @@
|
|||||||
'更新下边栏 UI
|
'更新下边栏 UI
|
||||||
RefreshBottomBar()
|
RefreshBottomBar()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ChangeCurrentSelected(Value As Boolean)
|
||||||
|
AniControlEnabled += 1
|
||||||
|
For Each Item As MyLocalModItem In PanList.Children
|
||||||
|
Item.Checked = Value
|
||||||
|
If Value Then
|
||||||
|
If Not SelectedMods.Contains(Item.Entry.RawFileName) Then SelectedMods.Add(Item.Entry.RawFileName)
|
||||||
|
Else
|
||||||
|
If SelectedMods.Contains(Item.Entry.RawFileName) Then SelectedMods.Remove(Item.Entry.RawFileName)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
AniControlEnabled -= 1
|
||||||
|
'更新下边栏 UI
|
||||||
|
RefreshBottomBar()
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub UnselectedAllWithAnimation() Handles Load.StateChanged, Me.PageExit
|
Private Sub UnselectedAllWithAnimation() Handles Load.StateChanged, Me.PageExit
|
||||||
Dim CacheAniControlEnabled = AniControlEnabled
|
Dim CacheAniControlEnabled = AniControlEnabled
|
||||||
AniControlEnabled = 0
|
AniControlEnabled = 0
|
||||||
@@ -318,7 +393,26 @@
|
|||||||
AniControlEnabled += CacheAniControlEnabled
|
AniControlEnabled += CacheAniControlEnabled
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub PageVersionMod_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
Private Sub PageVersionMod_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
||||||
If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeAllSelected(True)
|
If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeCurrentSelected(True)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private ViewModType As ViewType = ViewType.All
|
||||||
|
|
||||||
|
Private Enum ViewType As Integer
|
||||||
|
All
|
||||||
|
Enabled
|
||||||
|
Disabled
|
||||||
|
CanUpdate
|
||||||
|
InError
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Private Sub ChangeViewType(sender As MyRadioButton, raiseByMouse As Boolean) Handles BtnTypeAll.Check, BtnTypeCanUpdate.Check, BtnTypeDisabled.Check, BtnTypeEnabled.Check, BtnTypeError.Check
|
||||||
|
ViewModType = sender.Tag
|
||||||
|
If IsSearching Then
|
||||||
|
SearchRun()
|
||||||
|
Else
|
||||||
|
RefreshResult(McModLoader.Output)
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
@@ -330,6 +424,7 @@
|
|||||||
EDMods(McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)),
|
EDMods(McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)),
|
||||||
Not sender.Equals(BtnSelectDisable))
|
Not sender.Equals(BtnSelectDisable))
|
||||||
ChangeAllSelected(False)
|
ChangeAllSelected(False)
|
||||||
|
RefreshResult(McModLoader.Output)
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub EDMods(ModList As IEnumerable(Of McMod), IsEnable As Boolean)
|
Private Sub EDMods(ModList As IEnumerable(Of McMod), IsEnable As Boolean)
|
||||||
Dim IsSuccessful As Boolean = True
|
Dim IsSuccessful As Boolean = True
|
||||||
|
|||||||
Reference in New Issue
Block a user