fix: 用枚举替代字符串
This commit is contained in:
@@ -26,15 +26,15 @@
|
|||||||
</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,9,10,0" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="24">
|
<StackPanel Margin="0,9,10,0" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="24">
|
||||||
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Tag="All" Text="全部" x:Name="BtnTypeAll" ColorType="Highlight" Checked="True"/>
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="全部" x:Name="BtnTypeAll" ColorType="Highlight" Checked="True"/>
|
||||||
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Tag="Enabled" Text="已启用" x:Name="BtnTypeEnabled" ColorType="Highlight"/>
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="已启用" x:Name="BtnTypeEnabled" ColorType="Highlight"/>
|
||||||
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Tag="Disabled" Text="已禁用" x:Name="BtnTypeDisabled" ColorType="Highlight"/>
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="已禁用" x:Name="BtnTypeDisabled" ColorType="Highlight"/>
|
||||||
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Tag="CanUpdate" Text="可更新" x:Name="BtnTypeCanUpdate" ColorType="Highlight"/>
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="可更新" x:Name="BtnTypeCanUpdate" ColorType="Highlight"/>
|
||||||
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
<TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
|
||||||
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Tag="Error" Text="错误" x:Name="BtnTypeError" ColorType="Highlight"/>
|
<local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="错误" x:Name="BtnTypeError" ColorType="Highlight"/>
|
||||||
</StackPanel>
|
</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>
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -25,7 +30,7 @@
|
|||||||
''' 刷新 Mod 列表。
|
''' 刷新 Mod 列表。
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Public Sub RefreshList(Optional ForceReload As Boolean = False)
|
Public Sub RefreshList(Optional ForceReload As Boolean = False)
|
||||||
ViewModType = "All"
|
ViewModType = ViewType.All
|
||||||
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 列表")
|
||||||
PanBack.ScrollToHome()
|
PanBack.ScrollToHome()
|
||||||
@@ -128,21 +133,21 @@
|
|||||||
Private Sub RefreshResult(Mods As List(Of McMod))
|
Private Sub RefreshResult(Mods As List(Of McMod))
|
||||||
Dim ShowMods As List(Of McMod) = New List(Of McMod)
|
Dim ShowMods As List(Of McMod) = New List(Of McMod)
|
||||||
Select Case ViewModType
|
Select Case ViewModType
|
||||||
Case "All"
|
Case ViewType.All
|
||||||
ShowMods = Mods
|
ShowMods = Mods
|
||||||
Case "Enabled"
|
Case ViewType.Enabled
|
||||||
For Each Item In Mods
|
For Each Item In Mods
|
||||||
If Item.State.Equals(McMod.McModState.Fine) Then ShowMods.Add(Item)
|
If Item.State.Equals(McMod.McModState.Fine) Then ShowMods.Add(Item)
|
||||||
Next
|
Next
|
||||||
Case "Disabled"
|
Case ViewType.Disabled
|
||||||
For Each Item In Mods
|
For Each Item In Mods
|
||||||
If Item.State.Equals(McMod.McModState.Disabled) Then ShowMods.Add(Item)
|
If Item.State.Equals(McMod.McModState.Disabled) Then ShowMods.Add(Item)
|
||||||
Next
|
Next
|
||||||
Case "CanUpdate"
|
Case ViewType.CanUpdate
|
||||||
For Each Item In Mods
|
For Each Item In Mods
|
||||||
If Item.CanUpdate Then ShowMods.Add(Item)
|
If Item.CanUpdate Then ShowMods.Add(Item)
|
||||||
Next
|
Next
|
||||||
Case "Error"
|
Case ViewType.InError
|
||||||
For Each Item In Mods
|
For Each Item In Mods
|
||||||
If Item.State.Equals(McMod.McModState.Unavaliable) Then ShowMods.Add(Item)
|
If Item.State.Equals(McMod.McModState.Unavaliable) Then ShowMods.Add(Item)
|
||||||
Next
|
Next
|
||||||
@@ -188,15 +193,15 @@
|
|||||||
PanListBack.Title = "无搜索结果 - "
|
PanListBack.Title = "无搜索结果 - "
|
||||||
End If
|
End If
|
||||||
Select Case ViewModType
|
Select Case ViewModType
|
||||||
Case "All"
|
Case ViewType.All
|
||||||
PanListBack.Title += BtnTypeAll.Text
|
PanListBack.Title += BtnTypeAll.Text
|
||||||
Case "Enabled"
|
Case ViewType.Enabled
|
||||||
PanListBack.Title += BtnTypeEnabled.Text
|
PanListBack.Title += BtnTypeEnabled.Text
|
||||||
Case "Disabled"
|
Case ViewType.Disabled
|
||||||
PanListBack.Title += BtnTypeDisabled.Text
|
PanListBack.Title += BtnTypeDisabled.Text
|
||||||
Case "CanUpdate"
|
Case ViewType.CanUpdate
|
||||||
PanListBack.Title += BtnTypeCanUpdate.Text
|
PanListBack.Title += BtnTypeCanUpdate.Text
|
||||||
Case "Error"
|
Case ViewType.InError
|
||||||
PanListBack.Title += BtnTypeError.Text
|
PanListBack.Title += BtnTypeError.Text
|
||||||
End Select
|
End Select
|
||||||
PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed)
|
PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed)
|
||||||
@@ -383,7 +388,15 @@
|
|||||||
If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeCurrentSelected(True)
|
If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeCurrentSelected(True)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private ViewModType As String = "All"
|
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
|
Private Sub ChangeViewType(sender As MyRadioButton, raiseByMouse As Boolean) Handles BtnTypeAll.Check, BtnTypeCanUpdate.Check, BtnTypeDisabled.Check, BtnTypeEnabled.Check, BtnTypeError.Check
|
||||||
ViewModType = sender.Tag
|
ViewModType = sender.Tag
|
||||||
|
|||||||
Reference in New Issue
Block a user