|
@@ -1,5 +1,6 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Runtime.CompilerServices;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
@@ -18,6 +19,8 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
/// </summary>
|
|
|
public event EventHandler<ScrollChangedEventArgs> ViewChanged;
|
|
|
|
|
|
+ private bool lockGoToPage;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// A list of thumbnail results
|
|
|
/// </summary>
|
|
@@ -32,7 +35,12 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
/// </summary>
|
|
|
private void ThumbListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
{
|
|
|
- SelectionChanged?.Invoke(this, ThumbListBox.SelectedIndex);
|
|
|
+ if (lockGoToPage)
|
|
|
+ {
|
|
|
+ SelectionChanged?.Invoke(this, ThumbListBox.SelectedIndex);
|
|
|
+
|
|
|
+ }
|
|
|
+ lockGoToPage = false;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -125,8 +133,27 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
ThumbListBox.SelectedIndex = checkIndex;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Select an object
|
|
|
+ /// </summary>
|
|
|
+ public void SelectItemWithoutGoTo(int checkIndex)
|
|
|
+ {
|
|
|
+ if (ThumbListBox != null && thumbResultList != null && thumbResultList.Count > checkIndex && checkIndex >= 0)
|
|
|
+ {
|
|
|
+ ThumbnailItem thumbItem = thumbResultList[checkIndex];
|
|
|
+ if (IsItemVisible(thumbItem) == false)
|
|
|
+ {
|
|
|
+ ThumbListBox.ScrollIntoView(thumbItem);
|
|
|
+ }
|
|
|
+ lockGoToPage = true;
|
|
|
+ ThumbListBox.SelectedIndex = checkIndex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Thumbnail object
|
|
|
/// </summary>
|