Просмотр исходного кода

fix: 全选逻辑问题、UI问题

tangge233 2 лет назад
Родитель
Сommit
0007a0ac72

+ 10 - 10
Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml

@@ -25,16 +25,16 @@
                         </Grid>
                     </local:MyCard>
                     <local:MyCard x:Name="PanListBack" VerticalAlignment="Top" Opacity="0" Margin="0,0,0,15" Title=" " MinHeight="40">
-                        <StackPanel Margin="13" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="20">
-                            <local:MyTextButton Height="20" Margin="3,0" Tag="All"  Text="全部" x:Name="BtnTypeAll"/>
-                            <TextBlock Text="|" Foreground="Gray"/>
-                            <local:MyTextButton Height="20" Margin="3,0" Tag="Enabled" Text="已启用" x:Name="BtnTypeEnabled"/>
-                            <TextBlock Text="|" Foreground="Gray"/>
-                            <local:MyTextButton Height="20" Margin="3,0" Tag="Disabled" Text="已禁用" x:Name="BtnTypeDisabled"/>
-                            <TextBlock Text="|" Foreground="Gray"/>
-                            <local:MyTextButton Height="20" Margin="3,0" Tag="CanUpdate" Text="可更新" x:Name="BtnTypeCanUpdate"/>
-                            <TextBlock Text="|" Foreground="Gray"/>
-                            <local:MyTextButton Height="20" Margin="3,0" Tag="Error" Text="错误" x:Name="BtnTypeError"/>
+                        <StackPanel Margin="0,11,10,0" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="20">
+                            <local:MyTextButton VerticalContentAlignment="Center" Height="20" Margin="3,0" Tag="All"  Text="全部" x:Name="BtnTypeAll"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyTextButton VerticalContentAlignment="Center" Height="20" Margin="3,0" Tag="Enabled" Text="已启用" x:Name="BtnTypeEnabled"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyTextButton VerticalContentAlignment="Center" Height="20" Margin="3,0" Tag="Disabled" Text="已禁用" x:Name="BtnTypeDisabled"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyTextButton VerticalContentAlignment="Center" Height="20" Margin="3,0" Tag="CanUpdate" Text="可更新" x:Name="BtnTypeCanUpdate"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyTextButton VerticalContentAlignment="Center" Height="20" Margin="3,0" Tag="Error" Text="错误" x:Name="BtnTypeError"/>
                         </StackPanel>
                         <StackPanel Margin="20,38,18,18" Name="PanList" VerticalAlignment="Top" />
                     </local:MyCard>

+ 19 - 3
Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb

@@ -229,9 +229,9 @@
     ''' </summary>
     Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click
         If SelectedMods.Count < PanList.Children.Count Then
-            ChangeAllSelected(True)
+            ChangeCurrentSelected(True)
         Else
-            ChangeAllSelected(False)
+            ChangeCurrentSelected(False)
         End If
     End Sub
 
@@ -337,7 +337,7 @@
     Private Sub ChangeAllSelected(Value As Boolean)
         AniControlEnabled += 1
         SelectedMods.Clear()
-        For Each Item As MyLocalModItem In PanList.Children
+        For Each Item As MyLocalModItem In ModItems.Values.ToList
             Item.Checked = Value
             If Value Then SelectedMods.Add(Item.Entry.RawFileName)
         Next
@@ -345,6 +345,22 @@
         '更新下边栏 UI
         RefreshBottomBar()
     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
         Dim CacheAniControlEnabled = AniControlEnabled
         AniControlEnabled = 0