|
@@ -50,10 +50,6 @@ namespace DocsEditor
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
|
- {
|
|
|
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
|
- }
|
|
|
|
|
|
public MainWindow()
|
|
|
{
|
|
@@ -69,6 +65,8 @@ namespace DocsEditor
|
|
|
LoadDefaultDocument();
|
|
|
}
|
|
|
|
|
|
+ #region Load document
|
|
|
+
|
|
|
private void LoadDefaultDocument()
|
|
|
{
|
|
|
string defaultFilePath = "PDF32000_2008.pdf";
|
|
@@ -80,97 +78,65 @@ namespace DocsEditor
|
|
|
pdfViewControl.PDFView.InitDocument(defaultFilePath);
|
|
|
LoadDocument();
|
|
|
}
|
|
|
-
|
|
|
- private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
|
|
|
- {
|
|
|
- if (e.Key == "Zoom")
|
|
|
- {
|
|
|
- CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private double CheckZoomLevel(double zoom, bool IsGrowth)
|
|
|
+
|
|
|
+ private void LoadDocument()
|
|
|
{
|
|
|
- double standardZoom = 100;
|
|
|
- if (zoom <= 0.01)
|
|
|
- {
|
|
|
- return 0.01;
|
|
|
- }
|
|
|
- if (zoom >= 10)
|
|
|
+ pdfViewControl.PDFView?.SetMouseMode(MouseModes.Viewer);
|
|
|
+ pdfViewControl.PDFView?.Load();
|
|
|
+ pdfViewControl.PDFView?.SetShowLink(true);
|
|
|
+ if (ViewComboBox.SelectedIndex == 0)
|
|
|
{
|
|
|
- return 10;
|
|
|
+ PDFGrid.Child = pdfViewControl;
|
|
|
}
|
|
|
-
|
|
|
- zoom *= 100;
|
|
|
- for (int i = 0; i < zoomLevelList.Length - 1; i++)
|
|
|
+ else
|
|
|
{
|
|
|
- if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
|
|
|
- {
|
|
|
- standardZoom = zoomLevelList[i + 1];
|
|
|
- break;
|
|
|
- }
|
|
|
- if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
|
|
|
+ ToolBarContainer.Visibility = Visibility.Visible;
|
|
|
+ if (pageEditControl == null)
|
|
|
{
|
|
|
- standardZoom = zoomLevelList[i];
|
|
|
- break;
|
|
|
+ pageEditControl = new CPDFPageEditControl();
|
|
|
}
|
|
|
- }
|
|
|
- return standardZoom / 100;
|
|
|
- }
|
|
|
+ pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
|
|
|
+ pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
|
|
|
|
|
|
- private void CopyImage_Click(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView?.GetSelectedImages();
|
|
|
+ pageEditControl.PageMoved -= PageEditControl_PageMoved;
|
|
|
+ pageEditControl.PageMoved += PageEditControl_PageMoved;
|
|
|
|
|
|
- if (imageDict != null && imageDict.Count > 0)
|
|
|
- {
|
|
|
- foreach (int pageIndex in imageDict.Keys)
|
|
|
- {
|
|
|
- List<Bitmap> imageList = imageDict[pageIndex];
|
|
|
- foreach (Bitmap image in imageList)
|
|
|
- {
|
|
|
- MemoryStream ms = new MemoryStream();
|
|
|
- image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
|
|
|
- BitmapImage imageData = new BitmapImage();
|
|
|
- imageData.BeginInit();
|
|
|
- imageData.StreamSource = ms;
|
|
|
- imageData.CacheOption = BitmapCacheOption.OnLoad;
|
|
|
- imageData.EndInit();
|
|
|
- imageData.Freeze();
|
|
|
- Clipboard.SetImage(imageData);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
|
|
|
+ CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
|
|
|
+ pageEditControl.LoadThumbnails(pdfViewControl.PDFView);
|
|
|
+ PDFGrid.Child = pageEditControl;
|
|
|
+ FloatPageTool.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- private void ExtraImage_Click(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
|
|
|
- if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
- {
|
|
|
- string choosePath = folderDialog.SelectedPath;
|
|
|
- string openPath = choosePath;
|
|
|
- Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView?.GetSelectedImages();
|
|
|
+ pdfViewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
|
|
|
+ pdfViewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
|
|
|
+ pdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
|
|
|
+ pdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
|
|
|
+ pdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
+ pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
+ pdfViewControl.PDFView.SetFormFieldHighlight(true);
|
|
|
+ PasswordUI.Closed -= PasswordUI_Closed;
|
|
|
+ PasswordUI.Canceled -= PasswordUI_Canceled;
|
|
|
+ PasswordUI.Confirmed -= PasswordUI_Confirmed;
|
|
|
+ PasswordUI.Closed += PasswordUI_Closed;
|
|
|
+ PasswordUI.Canceled += PasswordUI_Canceled;
|
|
|
+ PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
|
|
|
- if (imageDict != null && imageDict.Count > 0)
|
|
|
- {
|
|
|
- foreach (int pageIndex in imageDict.Keys)
|
|
|
- {
|
|
|
- List<Bitmap> imageList = imageDict[pageIndex];
|
|
|
- foreach (Bitmap image in imageList)
|
|
|
- {
|
|
|
- string savePath = System.IO.Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
|
|
|
- image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
- openPath = savePath;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- Process.Start("explorer", "/select,\"" + openPath + "\"");
|
|
|
+ pdfViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
|
|
|
+ CPDFSaclingControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)));
|
|
|
|
|
|
- }
|
|
|
+ ViewSettingBtn.IsChecked = false;
|
|
|
+ PropertyContainer.Child = null;
|
|
|
+ PropertyContainer.Visibility = Visibility.Collapsed;
|
|
|
+ FloatPageTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Context menu
|
|
|
+
|
|
|
private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
|
{
|
|
|
if (e != null && e.CommandType == CommandType.Context)
|
|
@@ -324,6 +290,62 @@ namespace DocsEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void CopyImage_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView?.GetSelectedImages();
|
|
|
+
|
|
|
+ if (imageDict != null && imageDict.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (int pageIndex in imageDict.Keys)
|
|
|
+ {
|
|
|
+ List<Bitmap> imageList = imageDict[pageIndex];
|
|
|
+ foreach (Bitmap image in imageList)
|
|
|
+ {
|
|
|
+ MemoryStream ms = new MemoryStream();
|
|
|
+ image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
|
|
|
+ BitmapImage imageData = new BitmapImage();
|
|
|
+ imageData.BeginInit();
|
|
|
+ imageData.StreamSource = ms;
|
|
|
+ imageData.CacheOption = BitmapCacheOption.OnLoad;
|
|
|
+ imageData.EndInit();
|
|
|
+ imageData.Freeze();
|
|
|
+ Clipboard.SetImage(imageData);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ExtraImage_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
|
|
|
+ if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
+ {
|
|
|
+ string choosePath = folderDialog.SelectedPath;
|
|
|
+ string openPath = choosePath;
|
|
|
+ Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView?.GetSelectedImages();
|
|
|
+
|
|
|
+ if (imageDict != null && imageDict.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (int pageIndex in imageDict.Keys)
|
|
|
+ {
|
|
|
+ List<Bitmap> imageList = imageDict[pageIndex];
|
|
|
+ foreach (Bitmap image in imageList)
|
|
|
+ {
|
|
|
+ string savePath = System.IO.Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
|
|
|
+ image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
+ openPath = savePath;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Process.Start("explorer", "/select,\"" + openPath + "\"");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region password
|
|
|
private void PasswordUI_Canceled(object sender, EventArgs e)
|
|
|
{
|
|
|
PopupBorder.Visibility = Visibility.Collapsed;
|
|
@@ -357,72 +379,48 @@ namespace DocsEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void LoadDocument()
|
|
|
- {
|
|
|
- pdfViewControl.PDFView?.SetMouseMode(MouseModes.Viewer);
|
|
|
- pdfViewControl.PDFView?.Load();
|
|
|
- pdfViewControl.PDFView?.SetShowLink(true);
|
|
|
- if (ViewComboBox.SelectedIndex == 0)
|
|
|
- {
|
|
|
- PDFGrid.Child = pdfViewControl;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ToolBarContainer.Visibility = Visibility.Visible;
|
|
|
- if (pageEditControl == null)
|
|
|
- {
|
|
|
- pageEditControl = new CPDFPageEditControl();
|
|
|
- }
|
|
|
- pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
|
|
|
- pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
|
|
|
+ #endregion
|
|
|
+
|
|
|
|
|
|
- pageEditControl.PageMoved -= PageEditControl_PageMoved;
|
|
|
- pageEditControl.PageMoved += PageEditControl_PageMoved;
|
|
|
+ #region Expand and collapse Panel
|
|
|
|
|
|
- CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
|
|
|
- CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
|
|
|
- pageEditControl.LoadThumbnails(pdfViewControl.PDFView);
|
|
|
- PDFGrid.Child = pageEditControl;
|
|
|
- FloatPageTool.Visibility = Visibility.Collapsed;
|
|
|
+ public void ExpandRightPropertyPanel(UIElement properytPanel, Visibility visible)
|
|
|
+ {
|
|
|
+ PropertyContainer.Width = 260;
|
|
|
+ PropertyContainer.Child = properytPanel;
|
|
|
+ PropertyContainer.Visibility = visible;
|
|
|
+ if (visible == Visibility.Hidden || visible == Visibility.Collapsed)
|
|
|
+ {
|
|
|
+ RightToolPanelButton.IsChecked = false;
|
|
|
}
|
|
|
- pdfViewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
|
|
|
- pdfViewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
|
|
|
- pdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
|
|
|
- pdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
|
|
|
- pdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
- pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
- pdfViewControl.PDFView.SetFormFieldHighlight(true);
|
|
|
- PasswordUI.Closed -= PasswordUI_Closed;
|
|
|
- PasswordUI.Canceled -= PasswordUI_Canceled;
|
|
|
- PasswordUI.Confirmed -= PasswordUI_Confirmed;
|
|
|
- PasswordUI.Closed += PasswordUI_Closed;
|
|
|
- PasswordUI.Canceled += PasswordUI_Canceled;
|
|
|
- PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
-
|
|
|
- pdfViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
|
|
|
- CPDFSaclingControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)));
|
|
|
-
|
|
|
- ViewSettingBtn.IsChecked = false;
|
|
|
- PropertyContainer.Child = null;
|
|
|
- PropertyContainer.Visibility = Visibility.Collapsed;
|
|
|
- FloatPageTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
}
|
|
|
|
|
|
- private void PageEditControl_PageMoved(object sender, RoutedEventArgs e)
|
|
|
+
|
|
|
+ private void ExpandLeftPanel(bool isExpand)
|
|
|
{
|
|
|
- if (pdfViewControl == null || pdfViewControl.PDFView == null)
|
|
|
+ BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
|
|
|
+ Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
|
|
|
+ if (isExpand)
|
|
|
{
|
|
|
- return;
|
|
|
+ BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
|
|
|
+ BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
|
|
|
+ BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
|
|
|
}
|
|
|
- BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
}
|
|
|
|
|
|
- private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region UI
|
|
|
+ private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- OnPropertyChanged(e.PropertyName);
|
|
|
+ PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
+ FileInfoUI.Visibility = Visibility.Visible;
|
|
|
+ FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ PopupBorder.Visibility = Visibility.Visible;
|
|
|
}
|
|
|
|
|
|
private void OpenFile_Click(object sender, RoutedEventArgs e)
|
|
@@ -462,32 +460,6 @@ namespace DocsEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ExpandLeftPanel(bool isExpand)
|
|
|
- {
|
|
|
- BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
|
|
|
- Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
|
|
|
- if (isExpand)
|
|
|
- {
|
|
|
- BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
|
|
|
- BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
|
|
|
- BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <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 LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ToggleButton expandBtn = sender as ToggleButton;
|
|
@@ -504,28 +476,6 @@ namespace DocsEditor
|
|
|
pdfViewControl.PDFView.UndoManager.CanSave = false;
|
|
|
}
|
|
|
|
|
|
- private void SaveFile()
|
|
|
- {
|
|
|
- if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
|
|
|
- {
|
|
|
- CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
|
|
|
- if (pdfDoc.WriteToLoadedPath())
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- SaveFileDialog saveDialog = new SaveFileDialog();
|
|
|
- saveDialog.Filter = "(*.pdf)|*.pdf";
|
|
|
- saveDialog.DefaultExt = ".pdf";
|
|
|
- saveDialog.OverwritePrompt = true;
|
|
|
-
|
|
|
- if (saveDialog.ShowDialog() == true)
|
|
|
- {
|
|
|
- pdfDoc.WriteToFilePath(saveDialog.FileName);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void FileInfoCloseBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
PopupBorder.Visibility = Visibility.Collapsed;
|
|
@@ -539,17 +489,6 @@ namespace DocsEditor
|
|
|
BotaSideTool.SelectBotaTool(BOTATools.Search);
|
|
|
}
|
|
|
|
|
|
- public void ExpandRightPropertyPanel(UIElement properytPanel, Visibility visible)
|
|
|
- {
|
|
|
- PropertyContainer.Width = 260;
|
|
|
- PropertyContainer.Child = properytPanel;
|
|
|
- PropertyContainer.Visibility = visible;
|
|
|
- if (visible == Visibility.Hidden || visible == Visibility.Collapsed)
|
|
|
- {
|
|
|
- RightToolPanelButton.IsChecked = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void RightToolPanelButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ToggleButton toggleButton = sender as ToggleButton;
|
|
@@ -595,16 +534,65 @@ namespace DocsEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
|
|
|
+ private double CheckZoomLevel(double zoom, bool IsGrowth)
|
|
|
{
|
|
|
- PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
- FileInfoUI.Visibility = Visibility.Visible;
|
|
|
- FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
- PopupBorder.Visibility = Visibility.Visible;
|
|
|
+ double standardZoom = 100;
|
|
|
+ if (zoom <= 0.01)
|
|
|
+ {
|
|
|
+ return 0.01;
|
|
|
+ }
|
|
|
+ if (zoom >= 10)
|
|
|
+ {
|
|
|
+ return 10;
|
|
|
+ }
|
|
|
+
|
|
|
+ zoom *= 100;
|
|
|
+ for (int i = 0; i < zoomLevelList.Length - 1; i++)
|
|
|
+ {
|
|
|
+ if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
|
|
|
+ {
|
|
|
+ standardZoom = zoomLevelList[i + 1];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
|
|
|
+ {
|
|
|
+ standardZoom = zoomLevelList[i];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return standardZoom / 100;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Save file
|
|
|
+ private void SaveFile()
|
|
|
+ {
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
|
|
|
+ {
|
|
|
+ CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
|
|
|
+ if (pdfDoc.WriteToLoadedPath())
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ SaveFileDialog saveDialog = new SaveFileDialog();
|
|
|
+ saveDialog.Filter = "(*.pdf)|*.pdf";
|
|
|
+ saveDialog.DefaultExt = ".pdf";
|
|
|
+ saveDialog.OverwritePrompt = true;
|
|
|
+
|
|
|
+ if (saveDialog.ShowDialog() == true)
|
|
|
+ {
|
|
|
+ pdfDoc.WriteToFilePath(saveDialog.FileName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region Selection changed
|
|
|
-
|
|
|
+
|
|
|
private void ViewComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
{
|
|
|
if (isFirstLoad)
|
|
@@ -666,6 +654,7 @@ namespace DocsEditor
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ #region Event handle
|
|
|
private void CPDFPageEditBarControl_PageEditEvent(object sender, string e)
|
|
|
{
|
|
|
pageEditControl.PageEdit(e);
|
|
@@ -675,5 +664,37 @@ namespace DocsEditor
|
|
|
{
|
|
|
ViewComboBox.SelectedIndex = 0;
|
|
|
}
|
|
|
+
|
|
|
+ private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
+ {
|
|
|
+ OnPropertyChanged(e.PropertyName);
|
|
|
+ }
|
|
|
+ private void PageEditControl_PageMoved(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (pdfViewControl == null || pdfViewControl.PDFView == null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ BotaSideTool.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
|
|
|
+ {
|
|
|
+ if (e.Key == "Zoom")
|
|
|
+ {
|
|
|
+ CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Property changed
|
|
|
+
|
|
|
+ protected void OnPropertyChanged([CallerMemberName] string name = null)
|
|
|
+ {
|
|
|
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|