|
@@ -21,6 +21,7 @@ using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using static Dropbox.Api.TeamLog.AdminAlertSeverityEnum;
|
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
using ListViewItem = System.Windows.Controls.ListViewItem;
|
|
|
using TextBox = System.Windows.Controls.TextBox;
|
|
|
|
|
@@ -150,7 +151,7 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
if (parameter.Parameter is TextBox)
|
|
|
{
|
|
|
TextBox textBox = (TextBox)parameter.Parameter;
|
|
|
- textBox.PreviewMouseDown += new MouseButtonEventHandler(TxtTitleInput_PreviewMouseLeftButtonDown);
|
|
|
+
|
|
|
|
|
|
var item = CommonHelper.FindVisualParent<ListViewItem>(textBox);
|
|
|
if (item != null)
|
|
@@ -188,30 +189,39 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
if (mouse.LeftButton == MouseButtonState.Pressed)
|
|
|
{
|
|
|
TextBlock box = null;
|
|
|
- Grid grid = null;
|
|
|
+ StackPanel stackPanel = null;
|
|
|
+ ListBoxItem listBoxItem = (objs[0] as ListBoxItem);
|
|
|
if (mouse.ClickCount >= 2)
|
|
|
{
|
|
|
if (mouse.OriginalSource is TextBlock)
|
|
|
{
|
|
|
box = (TextBlock)mouse.OriginalSource;
|
|
|
- grid = (box.Parent as StackPanel).Parent as Grid;
|
|
|
+ stackPanel = (box.Parent as Grid).Parent as StackPanel;
|
|
|
|
|
|
-
|
|
|
if (box != null)
|
|
|
{
|
|
|
+ listBoxItem.IsSelected = true;
|
|
|
+ listBoxItem.Focus();
|
|
|
box.Visibility = Visibility.Collapsed;
|
|
|
- TextBox textBox = CommonHelper.FindVisualChild<TextBox>(grid);
|
|
|
- textBox.PreviewMouseDown += new MouseButtonEventHandler(TxtTitleInput_PreviewMouseLeftButtonDown);
|
|
|
- TxtTitleInput_PreviewMouseLeftButtonDown(textBox, mouse);
|
|
|
+ TextBox textBox = CommonHelper.FindVisualChild<TextBox>(stackPanel);
|
|
|
+ textBox.Dispatcher.BeginInvoke(new Action(() =>
|
|
|
+ {
|
|
|
+ textBox.Focus();
|
|
|
+ textBox.SelectAll();
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
isSelete = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (mouse.ClickCount == 1)
|
|
|
{
|
|
|
- ListBoxItem listBoxItem = (objs[0] as ListBoxItem);
|
|
|
if (listBoxItem != null)
|
|
|
{
|
|
|
+ box = CommonHelper.FindVisualChild<TextBlock>(listBoxItem);
|
|
|
+
|
|
|
+
|
|
|
int index = (listBoxItem.DataContext as CPDFBookmark).PageIndex;
|
|
|
PDFViewer.GoToPage(index);
|
|
|
isSelete = false;
|
|
@@ -235,11 +245,20 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
{
|
|
|
TextBlock box = CommonHelper.FindVisualChild<TextBlock>(grid);
|
|
|
|
|
|
- if (box != null)
|
|
|
- {
|
|
|
- box.Visibility = Visibility.Visible;
|
|
|
- }
|
|
|
ListBoxItem myListBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(grid);
|
|
|
+ box.Visibility = Visibility.Visible;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|
|
@@ -258,11 +277,14 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
if (grid != null)
|
|
|
{
|
|
|
TextBlock box = CommonHelper.FindVisualChild<TextBlock>(grid);
|
|
|
+ ListBoxItem listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(grid);
|
|
|
if (box != null)
|
|
|
{
|
|
|
box.Visibility = Visibility.Visible;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- ListBoxItem myListBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(grid);
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|
|
@@ -292,7 +314,8 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
|
|
|
myListBoxItem.IsSelected = true;
|
|
|
myListBoxItem.Focus();
|
|
|
- listView.SelectedItem = myListBoxItem;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
return;
|
|
@@ -302,26 +325,26 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
value.Add(ParameterNames.Bookmark, mark);
|
|
|
value.Add(ParameterNames.Title, "创建一个新的书签");
|
|
|
dialogs.ShowDialog(DialogNames.AddBookmarkDialog, value, e =>
|
|
|
- {
|
|
|
- if (e.Result == ButtonResult.OK && e.Parameters != null)
|
|
|
- {
|
|
|
- if (e.Parameters.ContainsKey(ParameterNames.Bookmark))
|
|
|
- {
|
|
|
- mark = e.Parameters.GetValue<string>(ParameterNames.Bookmark).ToString();
|
|
|
- CPDFBookmark bookmark = new CPDFBookmark();
|
|
|
- bookmark.Title = mark;
|
|
|
- bookmark.Date = DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\'') + "\n";
|
|
|
- bookmark.PageIndex = PDFViewer.CurrentIndex;
|
|
|
-
|
|
|
- if (PDFViewer.Document.AddBookmark(bookmark))
|
|
|
- {
|
|
|
- PDFViewer.UndoManager.CanSave = true;
|
|
|
-
|
|
|
- Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ {
|
|
|
+ if (e.Result == ButtonResult.OK && e.Parameters != null)
|
|
|
+ {
|
|
|
+ if (e.Parameters.ContainsKey(ParameterNames.Bookmark))
|
|
|
+ {
|
|
|
+ mark = e.Parameters.GetValue<string>(ParameterNames.Bookmark).ToString();
|
|
|
+ CPDFBookmark bookmark = new CPDFBookmark();
|
|
|
+ bookmark.Title = mark;
|
|
|
+ bookmark.Date = DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\'') + "\n";
|
|
|
+ bookmark.PageIndex = PDFViewer.CurrentIndex;
|
|
|
+
|
|
|
+ if (PDFViewer.Document.AddBookmark(bookmark))
|
|
|
+ {
|
|
|
+ PDFViewer.UndoManager.CanSave = true;
|
|
|
+
|
|
|
+ Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public void MouseClickEvent(object obj)
|
|
@@ -342,7 +365,7 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
if (grid != null)
|
|
|
{
|
|
|
box = CommonHelper.FindVisualChild<TextBlock>(grid);
|
|
|
- grid.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(selectColcr));
|
|
|
+
|
|
|
if (box != null)
|
|
|
{
|
|
|
box.Visibility = Visibility.Collapsed;
|
|
@@ -359,7 +382,7 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
box = (TextBlock)mouse.Source;
|
|
|
grid = (box.Parent as StackPanel).Parent as Grid;
|
|
|
|
|
|
- grid.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(selectColcr));
|
|
|
+
|
|
|
if (box != null)
|
|
|
{
|
|
|
box.Visibility = Visibility.Collapsed;
|