|
@@ -57,7 +57,7 @@ namespace PDF_Master.Views.BOTA
|
|
BookMarkListView.SelectedIndex = -1;
|
|
BookMarkListView.SelectedIndex = -1;
|
|
foreach (var item in BookMarkListView.Items)
|
|
foreach (var item in BookMarkListView.Items)
|
|
{
|
|
{
|
|
- ListViewItem listItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(item));
|
|
|
|
|
|
+ ListBoxItem listItem = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(item));
|
|
if (listItem != null)
|
|
if (listItem != null)
|
|
{
|
|
{
|
|
TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listItem);
|
|
TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listItem);
|
|
@@ -81,7 +81,7 @@ namespace PDF_Master.Views.BOTA
|
|
{
|
|
{
|
|
object[] objects = new object[] { sender, e };
|
|
object[] objects = new object[] { sender, e };
|
|
TextBlock textBlock = null;
|
|
TextBlock textBlock = null;
|
|
- ListViewItem listBoxItem = (sender as ListViewItem);
|
|
|
|
|
|
+ ListBoxItem listBoxItem = (sender as ListBoxItem);
|
|
if (e.LeftButton == MouseButtonState.Pressed)
|
|
if (e.LeftButton == MouseButtonState.Pressed)
|
|
{
|
|
{
|
|
if (e.ClickCount >= 2)
|
|
if (e.ClickCount >= 2)
|
|
@@ -115,48 +115,59 @@ namespace PDF_Master.Views.BOTA
|
|
viewModel.ListViewItemMouseDownCommand.Execute(sender);
|
|
viewModel.ListViewItemMouseDownCommand.Execute(sender);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //else if (e.RightButton == MouseButtonState.Pressed)
|
|
|
|
- //{
|
|
|
|
- // ContextMenu contextMenu = listBoxItem.ContextMenu;
|
|
|
|
- // if (contextMenu.Items.Count == 3)
|
|
|
|
- // {
|
|
|
|
- // MenuItem rename = contextMenu.Items[0] as MenuItem;
|
|
|
|
- // MenuItem editPageIndex = contextMenu.Items[1] as MenuItem;
|
|
|
|
- // MenuItem del = contextMenu.Items[2] as MenuItem;
|
|
|
|
- // if (isSelects)
|
|
|
|
- // {
|
|
|
|
- // rename.IsEnabled = false;
|
|
|
|
- // editPageIndex.IsEnabled = false;
|
|
|
|
- // //isSelects = false;
|
|
|
|
- // }
|
|
|
|
- // else
|
|
|
|
- // {
|
|
|
|
- // CPDFBookmark bookmark = (CPDFBookmark)listBoxItem.DataContext;
|
|
|
|
- // if (viewModel.PDFViewer.CurrentIndex == bookmark.PageIndex)
|
|
|
|
- // {
|
|
|
|
- // editPageIndex.IsEnabled = false;
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // rename.IsEnabled = true;
|
|
|
|
- // editPageIndex.IsEnabled = true;
|
|
|
|
- // editPageIndex.CommandParameter = listBoxItem.DataContext;
|
|
|
|
- // editPageIndex.Command = viewModel.EditPageIndexCommand;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
+ else if (e.RightButton == MouseButtonState.Pressed)
|
|
|
|
+ {
|
|
|
|
+ if (histotyListBoxItem != listBoxItem)
|
|
|
|
+ {
|
|
|
|
+ if (histotyListBoxItem != null)
|
|
|
|
+ {
|
|
|
|
+ histotyListBoxItem.IsSelected = false;
|
|
|
|
+ textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
|
|
|
|
+ textBlock.Visibility = Visibility.Visible;
|
|
|
|
+ textBlock.Focusable = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private bool isSelects = false;
|
|
private bool isSelects = false;
|
|
|
|
|
|
private void BookMarkListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void BookMarkListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
- var a1 = (sender as ListView).SelectedItems.Count;
|
|
|
|
- if (a1 > 1)
|
|
|
|
|
|
+ MenuItem rename = ContextMenuBook.Items[0] as MenuItem;
|
|
|
|
+ MenuItem editPageIndex = ContextMenuBook.Items[1] as MenuItem;
|
|
|
|
+ MenuItem del = ContextMenuBook.Items[2] as MenuItem;
|
|
|
|
+ var a1 = (sender as ListBox).SelectedItems.Count;
|
|
|
|
+ if (a1 >= 1)
|
|
{
|
|
{
|
|
isSelects = true;
|
|
isSelects = true;
|
|
|
|
+ ContextMenuBook.Visibility = Visibility.Visible;
|
|
|
|
+
|
|
|
|
+ if (a1 > 1)
|
|
|
|
+ {
|
|
|
|
+ rename.IsEnabled = false;
|
|
|
|
+ editPageIndex.IsEnabled = false;
|
|
|
|
+ }
|
|
|
|
+ if (a1 == 1)
|
|
|
|
+ {
|
|
|
|
+ isSelects = false;
|
|
|
|
+ CPDFBookmark bookmark = null;
|
|
|
|
+ if (BookMarkListView.SelectedItem != null)
|
|
|
|
+ {
|
|
|
|
+ bookmark = (CPDFBookmark)BookMarkListView.SelectedItem;
|
|
|
|
+ if (viewModel.PDFViewer.CurrentIndex == bookmark.PageIndex)
|
|
|
|
+ {
|
|
|
|
+ editPageIndex.IsEnabled = false;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ rename.IsEnabled = true;
|
|
|
|
+ editPageIndex.IsEnabled = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ ContextMenuBook.Visibility = Visibility.Collapsed;
|
|
isSelects = false;
|
|
isSelects = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -192,7 +203,7 @@ namespace PDF_Master.Views.BOTA
|
|
/// <param name="e"></param>
|
|
/// <param name="e"></param>
|
|
private void ListViewItem_LostFocus(object sender, RoutedEventArgs e)
|
|
private void ListViewItem_LostFocus(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
- ListViewItem listItem = sender as ListViewItem;
|
|
|
|
|
|
+ ListBoxItem listItem = sender as ListBoxItem;
|
|
if (listItem != null)
|
|
if (listItem != null)
|
|
{
|
|
{
|
|
BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
|
|
BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
|
|
@@ -272,7 +283,7 @@ namespace PDF_Master.Views.BOTA
|
|
{
|
|
{
|
|
BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
|
|
BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
|
|
isRename = true;
|
|
isRename = true;
|
|
- ListViewItem listBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(bookmark));
|
|
|
|
|
|
+ ListBoxItem listBoxItem = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(bookmark));
|
|
histotyListBoxItem = listBoxItem;
|
|
histotyListBoxItem = listBoxItem;
|
|
|
|
|
|
TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
|
|
TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
|
|
@@ -297,12 +308,12 @@ namespace PDF_Master.Views.BOTA
|
|
if (result != null)
|
|
if (result != null)
|
|
{
|
|
{
|
|
//获取当前鼠标指针下的容器
|
|
//获取当前鼠标指针下的容器
|
|
- var listBoxItem = CommonHelper.FindVisualParent<ListViewItem>(result.VisualHit);
|
|
|
|
|
|
+ var listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
|
|
if (listBoxItem == null)
|
|
if (listBoxItem == null)
|
|
{
|
|
{
|
|
if (BookMarkListView.SelectedItem != null)
|
|
if (BookMarkListView.SelectedItem != null)
|
|
{
|
|
{
|
|
- ListViewItem item = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(BookMarkListView.SelectedItem));
|
|
|
|
|
|
+ ListBoxItem item = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(BookMarkListView.SelectedItem));
|
|
item.IsSelected = false;
|
|
item.IsSelected = false;
|
|
TextBlock box = CommonHelper.FindVisualChild<TextBlock>(item);
|
|
TextBlock box = CommonHelper.FindVisualChild<TextBlock>(item);
|
|
box.Visibility = Visibility.Visible;
|
|
box.Visibility = Visibility.Visible;
|
|
@@ -366,7 +377,7 @@ namespace PDF_Master.Views.BOTA
|
|
if (viewModel.IsHasBookmark == false)
|
|
if (viewModel.IsHasBookmark == false)
|
|
{
|
|
{
|
|
BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
|
|
BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
|
|
- ListViewItem myListBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
|
|
|
|
|
|
+ ListBoxItem myListBoxItem = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
|
|
if (myListBoxItem == null)
|
|
if (myListBoxItem == null)
|
|
{
|
|
{
|
|
BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
|
|
BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
|
|
@@ -388,7 +399,7 @@ namespace PDF_Master.Views.BOTA
|
|
if (itemContainer.Status == GeneratorStatus.ContainersGenerated)
|
|
if (itemContainer.Status == GeneratorStatus.ContainersGenerated)
|
|
{
|
|
{
|
|
BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
|
|
BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
|
|
- ListViewItem myListBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
|
|
|
|
|
|
+ ListBoxItem myListBoxItem = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
|
|
if (myListBoxItem != null)
|
|
if (myListBoxItem != null)
|
|
{
|
|
{
|
|
if (myListBoxItem.RenderSize.Width < 0 && myListBoxItem.RenderSize.Height < 0)
|
|
if (myListBoxItem.RenderSize.Width < 0 && myListBoxItem.RenderSize.Height < 0)
|