|
@@ -209,6 +209,7 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
{
|
|
|
Bookmarklist.Remove(bookmark);
|
|
|
isAddBookMark = true;
|
|
|
+ PDFViewer.UndoManager.CanSave = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -311,7 +312,7 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
DialogParameters value = new DialogParameters();
|
|
|
value.Add(ParameterNames.Bookmark, mark);
|
|
|
value.Add(ParameterNames.Title, "创建一个新的书签");
|
|
|
- dialogs.ShowDialog(DialogNames.AddBookmarkDialog, value, async e =>
|
|
|
+ dialogs.ShowDialog(DialogNames.AddBookmarkDialog, value, e =>
|
|
|
{
|
|
|
if (e.Result == ButtonResult.OK && e.Parameters != null)
|
|
|
{
|
|
@@ -347,30 +348,44 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
{
|
|
|
if (listView.SelectedItem != bookmark)
|
|
|
{
|
|
|
- listView.SelectedItem = bookmark;
|
|
|
- listView.ScrollIntoView(bookmark);
|
|
|
- ListViewItem myListBoxItem = (ListViewItem)(listView.ItemContainerGenerator.ContainerFromItem(bookmark));
|
|
|
- TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
|
|
|
- TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
|
|
|
- textBlock.Visibility = Visibility.Collapsed;
|
|
|
-
|
|
|
- textBox.Focus();
|
|
|
- textBox.SelectAll();
|
|
|
+ //listView.SelectedItem = bookmark;
|
|
|
+ //listView.ScrollIntoView(bookmark);
|
|
|
+
|
|
|
+ //ListViewItem myListBoxItem = (ListViewItem)(listView.ItemContainerGenerator.ContainerFromItem(bookmark));
|
|
|
//if (myListBoxItem == null)
|
|
|
//{
|
|
|
- // await Task.Delay(3);
|
|
|
- // while (listView.RenderSize.Width <= 0 && listView.RenderSize.Height <= 0)
|
|
|
- // {
|
|
|
- // await Task.Delay(3);
|
|
|
- // }
|
|
|
+ // listView.UpdateLayout();
|
|
|
+ // listView.ScrollIntoView(bookmark);
|
|
|
// myListBoxItem = (ListViewItem)(listView.ItemContainerGenerator.ContainerFromItem(bookmark));
|
|
|
- // TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
|
|
|
- // TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
|
|
|
- // textBlock.Visibility = Visibility.Collapsed;
|
|
|
-
|
|
|
- // textBox.Focus();
|
|
|
- // textBox.SelectAll();
|
|
|
//}
|
|
|
+
|
|
|
+ listView.ItemContainerGenerator.StatusChanged += (sender, e) =>
|
|
|
+ {
|
|
|
+ listView.Dispatcher.Invoke(() =>
|
|
|
+ {
|
|
|
+ if (listView.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated)
|
|
|
+ {
|
|
|
+ ListViewItem myListBoxItem = (ListViewItem)(listView.ItemContainerGenerator.ContainerFromItem(bookmark));
|
|
|
+ if (myListBoxItem != null)
|
|
|
+ {
|
|
|
+ myListBoxItem.IsSelected = true;
|
|
|
+
|
|
|
+ if (myListBoxItem.RenderSize.Width < 0 && myListBoxItem.RenderSize.Height < 0)
|
|
|
+ {
|
|
|
+ listView.UpdateLayout();
|
|
|
+ myListBoxItem.UpdateLayout();
|
|
|
+ listView.ScrollIntoView(bookmark);
|
|
|
+ }
|
|
|
+ TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
|
|
|
+ TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
|
|
|
+ textBlock.Visibility = Visibility.Collapsed;
|
|
|
+
|
|
|
+ textBox.Focus();
|
|
|
+ textBox.SelectAll();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -378,6 +393,11 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
{
|
|
|
bool isExistBookmark = false;
|
|
|
int index = PDFViewer.CurrentIndex;
|
|
|
+ if (PDFViewer.Document == null)
|
|
|
+ {
|
|
|
+ isExistBookmark = true;
|
|
|
+ return isExistBookmark;
|
|
|
+ }
|
|
|
//检测是否已存在相同数据
|
|
|
var list = PDFViewer.Document.GetBookmarkList().FindAll(q => q.PageIndex == index);
|
|
|
|
|
@@ -420,8 +440,6 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
|
|
|
private ListViewItem selectListViewItem = null;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|