Browse Source

Multiple Refresh calls sholud just trigger one refresh cycle.

pull/3295/head
tom-englert 2 years ago
parent
commit
48ca7904f1
  1. 8
      ILSpy/AssemblyTree/AssemblyTreeModel.cs

8
ILSpy/AssemblyTree/AssemblyTreeModel.cs

@ -67,6 +67,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
AssemblyListPane? activeView; AssemblyListPane? activeView;
AssemblyListTreeNode? assemblyListTreeNode; AssemblyListTreeNode? assemblyListTreeNode;
private readonly DispatcherThrottle refreshThrottle;
readonly NavigationHistory<NavigationState> history = new(); readonly NavigationHistory<NavigationState> history = new();
private bool isNavigatingHistory; private bool isNavigatingHistory;
@ -83,6 +84,8 @@ namespace ICSharpCode.ILSpy.AssemblyTree
var selectionChangeThrottle = new DispatcherThrottle(DispatcherPriority.Input, TreeView_SelectionChanged); var selectionChangeThrottle = new DispatcherThrottle(DispatcherPriority.Input, TreeView_SelectionChanged);
SelectedItems.CollectionChanged += (_, _) => selectionChangeThrottle.Tick(); SelectedItems.CollectionChanged += (_, _) => selectionChangeThrottle.Tick();
refreshThrottle = new DispatcherThrottle(DispatcherPriority.Background, RefreshInternal);
} }
private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e) private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e)
@ -897,6 +900,11 @@ namespace ICSharpCode.ILSpy.AssemblyTree
} }
public void Refresh() public void Refresh()
{
refreshThrottle.Tick();
}
private void RefreshInternal()
{ {
using (Keyboard.FocusedElement.PreserveFocus()) using (Keyboard.FocusedElement.PreserveFocus())
{ {

Loading…
Cancel
Save