|
@@ -34,6 +34,7 @@ namespace Forms
|
|
/// </summary>
|
|
/// </summary>
|
|
public partial class MainWindow : Window, INotifyPropertyChanged
|
|
public partial class MainWindow : Window, INotifyPropertyChanged
|
|
{
|
|
{
|
|
|
|
+ #region property
|
|
private PDFViewControl passwordViewer;
|
|
private PDFViewControl passwordViewer;
|
|
private PDFViewControl pdfViewControl;
|
|
private PDFViewControl pdfViewControl;
|
|
private CPDFSearchControl searchControl = null;
|
|
private CPDFSearchControl searchControl = null;
|
|
@@ -80,11 +81,13 @@ namespace Forms
|
|
}
|
|
}
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
+ #endregion
|
|
|
|
|
|
protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
{
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
}
|
|
}
|
|
|
|
+
|
|
public MainWindow()
|
|
public MainWindow()
|
|
{
|
|
{
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
@@ -92,13 +95,16 @@ namespace Forms
|
|
DataContext = this;
|
|
DataContext = this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #region Usercontrol loaded unload initialize
|
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
BotaSideTool.AddBOTAContent(BOTATools.Thumbnail | BOTATools.Outline | BOTATools.Bookmark | BOTATools.Search);
|
|
BotaSideTool.AddBOTAContent(BOTATools.Thumbnail | BOTATools.Outline | BOTATools.Bookmark | BOTATools.Search);
|
|
fromPropertyControl = new FromPropertyControl();
|
|
fromPropertyControl = new FromPropertyControl();
|
|
LoadDefaultDocument();
|
|
LoadDefaultDocument();
|
|
}
|
|
}
|
|
|
|
+ #endregion
|
|
|
|
|
|
|
|
+ #region Open and close document
|
|
private void LoadDocument()
|
|
private void LoadDocument()
|
|
{
|
|
{
|
|
pdfViewControl.PDFView?.Load();
|
|
pdfViewControl.PDFView?.Load();
|
|
@@ -131,12 +137,22 @@ namespace Forms
|
|
BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
}
|
|
}
|
|
|
|
+ private void LoadDefaultDocument()
|
|
|
|
+ {
|
|
|
|
+ string defaultFilePath = "Form_Widgets_Test.pdf";
|
|
|
|
+ pdfViewControl = new PDFViewControl();
|
|
|
|
+ pdfViewControl.PDFView.InitDocument(defaultFilePath);
|
|
|
|
+ LoadDocument();
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
|
|
private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
{
|
|
{
|
|
OnPropertyChanged(e.PropertyName);
|
|
OnPropertyChanged(e.PropertyName);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #region Context menu
|
|
private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
{
|
|
{
|
|
if (e != null && e.CommandType == CommandType.Context)
|
|
if (e != null && e.CommandType == CommandType.Context)
|
|
@@ -290,6 +306,9 @@ namespace Forms
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region Password
|
|
private void PasswordUI_Confirmed(object sender, string e)
|
|
private void PasswordUI_Confirmed(object sender, string e)
|
|
{
|
|
{
|
|
if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
|
|
if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
|
|
@@ -322,6 +341,8 @@ namespace Forms
|
|
PopupBorder.Visibility = Visibility.Collapsed;
|
|
PopupBorder.Visibility = Visibility.Collapsed;
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
|
|
private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
|
|
private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
|
|
{
|
|
{
|
|
@@ -361,24 +382,7 @@ namespace Forms
|
|
return standardZoom / 100;
|
|
return standardZoom / 100;
|
|
}
|
|
}
|
|
|
|
|
|
- private void LoadDefaultDocument()
|
|
|
|
- {
|
|
|
|
- string defaultFilePath = "Form_Widgets_Test.pdf";
|
|
|
|
- pdfViewControl = new PDFViewControl();
|
|
|
|
- pdfViewControl.PDFView.InitDocument(defaultFilePath);
|
|
|
|
- LoadDocument();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// 展开Bota工具
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="isExpand"></param>
|
|
|
|
- private void ExpandBotaTool(bool isExpand)
|
|
|
|
- {
|
|
|
|
- BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
- Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
- }
|
|
|
|
|
|
|
|
private void ToolExpand_Click(object sender, RoutedEventArgs e)
|
|
private void ToolExpand_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
@@ -460,25 +464,6 @@ namespace Forms
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- private void ZoomInBtn_Click(object sender, RoutedEventArgs e)
|
|
|
|
- {
|
|
|
|
- if (pdfViewControl != null)
|
|
|
|
- {
|
|
|
|
- double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
|
|
|
|
- pdfViewControl.PDFView.Zoom(newZoom);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void ZoomOutBtn_Click(object sender, RoutedEventArgs e)
|
|
|
|
- {
|
|
|
|
- if (pdfViewControl != null)
|
|
|
|
- {
|
|
|
|
- double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
|
|
|
|
- pdfViewControl.PDFView.Zoom(newZoom);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void NextPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
private void NextPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
{
|
|
pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex + 1);
|
|
pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex + 1);
|
|
@@ -496,6 +481,7 @@ namespace Forms
|
|
FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
PopupBorder.Visibility = Visibility.Visible;
|
|
PopupBorder.Visibility = Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
+
|
|
public void ExpandRightPropertyPanel(UIElement properytPanel, Visibility visible)
|
|
public void ExpandRightPropertyPanel(UIElement properytPanel, Visibility visible)
|
|
{
|
|
{
|
|
PropertyContainer.Child = properytPanel;
|
|
PropertyContainer.Child = properytPanel;
|
|
@@ -547,7 +533,6 @@ namespace Forms
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -623,12 +608,14 @@ namespace Forms
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #region Selection changed]
|
|
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
SetFromMode();
|
|
SetFromMode();
|
|
}
|
|
}
|
|
|
|
+
|
|
private void SetFromMode()
|
|
private void SetFromMode()
|
|
- {
|
|
|
|
|
|
+ {
|
|
if (LoadPDFFormTool)
|
|
if (LoadPDFFormTool)
|
|
{
|
|
{
|
|
PDFFormTool.ClearAllToolState();
|
|
PDFFormTool.ClearAllToolState();
|
|
@@ -671,6 +658,8 @@ namespace Forms
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
public void InitialPDFViewControl(PDFViewControl newPDFViewer)
|
|
public void InitialPDFViewControl(PDFViewControl newPDFViewer)
|
|
{
|
|
{
|
|
PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, fromPropertyControl);
|
|
PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, fromPropertyControl);
|
|
@@ -795,7 +784,6 @@ namespace Forms
|
|
private void PDFFormTool_Unloaded(object sender, RoutedEventArgs e)
|
|
private void PDFFormTool_Unloaded(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
LoadPDFFormTool = false;
|
|
LoadPDFFormTool = false;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void SaveFile()
|
|
private void SaveFile()
|