Skip to content

Commit

Permalink
修复 切换为All分组的时候 会刷新两次的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakoyu authored and Hakoyu committed Dec 8, 2022
1 parent 72497c2 commit decd64d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Tools/ModManager/ModManager.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</ListBoxItem>
<ListBoxItem Padding="0">
<Expander Header="{x:Static I18n:ModManager_I18n.GroupedByModType}" Style="{StaticResource Expander_Style}" Padding="0">
<ListBox x:Name="ListBox_GroupType" pu:IconHelper.Margin="0,0,10,0" HorizontalContentAlignment="Stretch" Style="{StaticResource ListBox_Style}" SelectionChanged="ListBox_ModsGroupMenu_SelectionChanged" PreviewMouseWheel="ListBox_PreviewMouseWheel">
<ListBox x:Name="ListBox_ModTypeGroup" pu:IconHelper.Margin="0,0,10,0" HorizontalContentAlignment="Stretch" Style="{StaticResource ListBox_Style}" SelectionChanged="ListBox_ModsGroupMenu_SelectionChanged" PreviewMouseWheel="ListBox_PreviewMouseWheel">
<ListBoxItem Content="{x:Static I18n:ModManager_I18n.Libraries}" ToolTip="{x:Static I18n:ModManager_I18n.Libraries}" Tag="{x:Static local:ModGroupType.Libraries}" Style="{StaticResource ListBoxItem_Style}">
<pu:ListBoxItemHelper.Icon>
<emoji:TextBlock Text="🔝"/>
Expand Down
31 changes: 17 additions & 14 deletions Tools/ModManager/ModManager.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public partial class ModManager : Page
bool groupMenuOpen = false;
bool showModInfo = false;
string? nowSelectedMod = null;
string nowGroup = ModGroupType.All;
string nowGroup = string.Empty;
Thread remindSaveThread = null!;
ListBoxItem? nowSelectedListBoxItem = null;
HashSet<string> allEnabledModsId = new();
Expand Down Expand Up @@ -271,29 +271,32 @@ private void ListBox_ModsGroupMenu_SelectionChanged(object sender, SelectionChan
{
if (listBox.Name == ListBox_ModsGroupMenu.Name)
{
ListBox_GroupType.SelectedIndex = -1;
ListBox_ModTypeGroup.SelectedIndex = -1;
ListBox_UserGroup.SelectedIndex = -1;
}
else if (listBox.Name == ListBox_GroupType.Name)
else if (listBox.Name == ListBox_ModTypeGroup.Name)
{
ListBox_ModsGroupMenu.SelectedIndex = -1;
ListBox_UserGroup.SelectedIndex = -1;
}
else if (listBox.Name == ListBox_UserGroup.Name)
{
ListBox_ModsGroupMenu.SelectedIndex = -1;
ListBox_GroupType.SelectedIndex = -1;
ListBox_ModTypeGroup.SelectedIndex = -1;
}
if (item != nowSelectedListBoxItem)
{
nowSelectedListBoxItem = item;
if (allUserGroups.ContainsKey(item.ToolTip.ToString()!))
Expander_RandomEnable.Visibility = Visibility.Visible;
else
Expander_RandomEnable.Visibility = Visibility.Collapsed;
nowGroup = item.Tag.ToString()!;
SearchMods(TextBox_SearchMods.Text);
ClearDataGridSelected();
CloseModInfo();
GC.Collect();
}
nowSelectedListBoxItem = item;
if (allUserGroups.ContainsKey(item.ToolTip.ToString()!))
Expander_RandomEnable.Visibility = Visibility.Visible;
else
Expander_RandomEnable.Visibility = Visibility.Collapsed;
nowGroup = item.Tag.ToString()!;
ClearDataGridSelected();
SearchMods(TextBox_SearchMods.Text);
CloseModInfo();
GC.Collect();
}
}
private void DataGridItem_Selected(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit decd64d

Please sign in to comment.