Browse Source

compdfkit(win) - Content Edit 快捷键

liuaoran 1 year ago
parent
commit
e55b23e349

+ 57 - 4
Demo/Examples/ContentEditor/MainWindow.xaml

@@ -15,8 +15,61 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+
+            <!-- Shortcut -->
+            <RoutedUICommand x:Key="Open" Text="Open"/>
+            <RoutedUICommand x:Key="Save" Text="Right rotate"/>
+            <RoutedUICommand x:Key="SaveAs" Text="Delete"/>
+            <RoutedUICommand x:Key="Undo" Text="Undo"/>
+            <RoutedUICommand x:Key="Redo" Text="Redo"/>
+            <RoutedUICommand x:Key="ControlLeftPanel" Text="Control left panel"/>
+            <RoutedUICommand x:Key="ControlRightPanel" Text="Control right panel"/>
+            <RoutedUICommand x:Key="GoToBookmark" Text="Go to bookmark"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToOutline" Text="Go to outline"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToThumbnail" Text="Go to thumbnail"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToSearch" Text="Go to search"></RoutedUICommand>
+            <RoutedUICommand x:Key="ScaleAdd" Text="Scale add"></RoutedUICommand>
+            <RoutedUICommand x:Key="ScaleSubtract" Text="Scale reduce"></RoutedUICommand>
+            <RoutedUICommand x:Key="DisplaySettings" Text="Display settings"></RoutedUICommand>
+            <RoutedUICommand x:Key="DocumentInfo" Text="Document infomation"></RoutedUICommand>
         </ResourceDictionary>
     </Window.Resources>
+
+    <Window.CommandBindings>
+        <CommandBinding Command="{StaticResource Open}" Executed="CommandBinding_Executed_Open"/>
+        <CommandBinding Command="{StaticResource Save}" Executed="CommandBinding_Executed_Save"/>
+        <CommandBinding Command="{StaticResource SaveAs}" Executed="CommandBinding_Executed_SaveAs"/>
+        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
+        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
+        <CommandBinding Command="{StaticResource ControlLeftPanel}" Executed="CommandBinding_Executed_ControlLeftPanel"></CommandBinding>
+        <CommandBinding Command="{StaticResource ControlRightPanel}" Executed="CommandBinding_Executed_ControlRightPanel"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToBookmark}" Executed="CommandBinding_Executed_Bookmark"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToOutline}" Executed="CommandBinding_Executed_Outline"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToSearch}" Executed="CommandBinding_Executed_Search"></CommandBinding>
+        <CommandBinding Command="{StaticResource ScaleAdd}" Executed="CommandBinding_Executed_ScaleAdd"></CommandBinding>
+        <CommandBinding Command="{StaticResource ScaleSubtract}" Executed="CommandBinding_Executed_ScaleSubtract"></CommandBinding>
+        <CommandBinding Command="{StaticResource DisplaySettings}" Executed="CommandBinding_Executed_DisplaySettings"></CommandBinding>
+        <CommandBinding Command="{StaticResource DocumentInfo}" Executed="CommandBinding_Executed_DocumentInfo"></CommandBinding>
+    </Window.CommandBindings>
+
+    <Window.InputBindings>
+        <KeyBinding Key="O" Modifiers="Control" Command="{StaticResource Open}"/>
+        <KeyBinding Key="S" Modifiers="Control" Command="{StaticResource Save}"/>
+        <KeyBinding Key="S" Modifiers="Control+Shift" Command="{StaticResource SaveAs}"/>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+        <KeyBinding Key="F4" Command="{StaticResource ControlLeftPanel}"/>
+        <KeyBinding Key="F4" Modifiers="Control" Command="{StaticResource ControlRightPanel}"/>
+        <KeyBinding Key="B" Modifiers="Control" Command="{StaticResource GoToBookmark}"></KeyBinding>
+        <KeyBinding Key="O" Modifiers="Control+Shift" Command="{StaticResource GoToOutline}"></KeyBinding>
+        <KeyBinding Key="T" Modifiers="Control" Command="{StaticResource GoToThumbnail}"></KeyBinding>
+        <KeyBinding Key="F" Modifiers="Control" Command="{StaticResource GoToSearch}"></KeyBinding>
+        <KeyBinding Key="Add" Modifiers="Control" Command="{StaticResource ScaleAdd}"></KeyBinding>
+        <KeyBinding Key="Subtract" Modifiers="Control" Command="{StaticResource ScaleSubtract}"></KeyBinding>
+        <KeyBinding Key="D" Modifiers="Control" Command="{StaticResource DisplaySettings}"></KeyBinding>
+        <KeyBinding Key="I" Modifiers="Control" Command="{StaticResource DocumentInfo}"></KeyBinding>
+    </Window.InputBindings>
+
     <Grid>
         <Grid>
             <Grid.RowDefinitions>
@@ -91,8 +144,8 @@
                             <ToolTip Content="Save"></ToolTip>
                         </Button.ToolTip>
                     </Button>
- 
-                    <ToggleButton Name="ToolExpandBtn" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ToolExpand_Click">
+
+                    <ToggleButton Name="LeftToolPanelButton" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="LeftToolPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>
@@ -157,8 +210,8 @@
                             <ToolTip Content="Search"></ToolTip>
                         </Button.ToolTip>
                     </Button>
- 
-                    <ToggleButton Name="RightPanelBtn" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="RightPanelBtn_Click">
+
+                    <ToggleButton Name="RightPanelButton" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="RightPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>

+ 206 - 61
Demo/Examples/ContentEditor/MainWindow.xaml.cs

@@ -111,7 +111,6 @@ namespace ContentEditor
         }
 
         #region Load document
-
         private void LoadDocument()
         {
             pdfViewControl.PDFView?.Load();
@@ -671,13 +670,16 @@ namespace ContentEditor
             }
             SetImageEditProperty();
         }
-        private void RightPanelBtn_Click(object sender, RoutedEventArgs e)
+
+        private void ControlRightPanel()
         {
-            ViewSettingBtn.IsChecked = false;
-            ToggleButton toggleButton = sender as ToggleButton;
-            if (toggleButton != null)
+            if ((bool)ViewSettingBtn.IsChecked)
             {
-                if (toggleButton.IsChecked == true)
+                ViewSettingBtn.IsChecked = false;
+            }
+            if (RightPanelButton != null)
+            {
+                if (RightPanelButton.IsChecked == true)
                 {
                     if (PropertyContainer.Child is CPDFDisplaySettingsControl)
                     {
@@ -697,31 +699,41 @@ namespace ContentEditor
             }
         }
 
-        private void ToolExpand_Click(object sender, RoutedEventArgs e)
+        private void RightPanelButton_Click(object sender, RoutedEventArgs e)
+        {
+            ControlRightPanel();
+        }
+
+        private void ControlLeftPanel()
         {
-            ToggleButton expandBtn = sender as ToggleButton;
-            if (expandBtn != null)
+            if (LeftToolPanelButton != null)
             {
-                bool isExpand = expandBtn.IsChecked == true;
+                bool isExpand = LeftToolPanelButton.IsChecked == true;
                 ExpandLeftPanel(isExpand);
             }
         }
 
+        private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
+        {
+            ControlLeftPanel();
+        }
+
         private void ExpandSearchBtn_Click(object sender, RoutedEventArgs e)
         {
-            ToolExpandBtn.IsChecked = true;
+            LeftToolPanelButton.IsChecked = true;
             ExpandLeftPanel(true);
             BotaSideTool.SelectBotaTool(BOTATools.Search);
         }
 
-
-        private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
+        private void ShowViewSettings()
         {
-            RightPanelBtn.IsChecked = false;
-            ToggleButton toggleButton = sender as ToggleButton;
-            if (toggleButton != null)
+            if (RightPanelButton != null)
+            {
+                RightPanelButton.IsChecked = false;
+            }
+            if (ViewSettingBtn != null)
             {
-                if (toggleButton.IsChecked == true)
+                if (ViewSettingBtn.IsChecked == true)
                 {
                     CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
                     displayPanel.InitWithPDFViewer(pdfViewControl.PDFView);
@@ -745,6 +757,11 @@ namespace ContentEditor
             }
         }
 
+        private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ShowViewSettings();
+        }
+
         private void NextPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
             pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex + 1);
@@ -768,50 +785,48 @@ namespace ContentEditor
             PopupBorder.Visibility = Visibility.Collapsed;
         }
 
-        private void OpenFile_Click(object sender, RoutedEventArgs e)
+        private void OpenFile()
         {
-            try
+            string filePath = CommonHelper.GetFilePathOrEmpty();
+            if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
             {
-                string filePath = CommonHelper.GetFilePathOrEmpty();
-                if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
+                if (pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
                 {
-                    if (pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+                    string oldFilePath = pdfViewControl.PDFView.Document.FilePath;
+                    if (oldFilePath.ToLower() == filePath.ToLower())
                     {
-                        string oldFilePath = pdfViewControl.PDFView.Document.FilePath;
-                        if (oldFilePath.ToLower() == filePath.ToLower())
-                        {
-                            return;
-                        }
-                    }
-
-                    passwordViewer = new PDFViewControl();
-                    passwordViewer.PDFView.InitDocument(filePath);
-                    if (passwordViewer.PDFView.Document == null)
-                    {
-                        MessageBox.Show("Open File Failed");
                         return;
                     }
+                }
 
-                    if (passwordViewer.PDFView.Document.IsLocked)
-                    {
-                        PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " password encrypted.");
-                        PasswordUI.ClearPassword();
-                        PopupBorder.Visibility = Visibility.Visible;
-                        PasswordUI.Visibility = Visibility.Visible;
-                    }
-                    else
-                    {
-                        pdfViewControl = passwordViewer;
-                        LoadDocument();
-                    }
+                passwordViewer = new PDFViewControl();
+                passwordViewer.PDFView.InitDocument(filePath);
+                if (passwordViewer.PDFView.Document == null)
+                {
+                    MessageBox.Show("Open File Failed");
+                    return;
                 }
-            }
-            catch (Exception ex)
-            {
 
+                if (passwordViewer.PDFView.Document.IsLocked)
+                {
+                    PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " password encrypted.");
+                    PasswordUI.ClearPassword();
+                    PopupBorder.Visibility = Visibility.Visible;
+                    PasswordUI.Visibility = Visibility.Visible;
+                }
+                else
+                {
+                    pdfViewControl = passwordViewer;
+                    LoadDocument();
+                }
             }
         }
 
+        private void OpenFile_Click(object sender, RoutedEventArgs e)
+        {
+            OpenFile();
+        }
+
         private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
         {
             SaveFile();
@@ -853,13 +868,13 @@ namespace ContentEditor
                     pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
                     pdfViewControl.PDFView?.ReloadDocument();
-                   
+
                     pdfViewControl.PDFView?.SetPDFEditParam(createParam);
                     if (textEditControl == null)
                     {
                         textEditControl = new PDFTextEditControl();
                     }
-                   
+
                     textEditControl.SetPDFTextEditData(createParam);
                     PropertyContainer.Child = textEditControl;
                     PropertyContainer.Visibility = Visibility.Visible;
@@ -867,7 +882,7 @@ namespace ContentEditor
                     {
                         ViewSettingBtn.IsChecked = false;
                     }
-                    RightPanelBtn.IsChecked = true;
+                    RightPanelButton.IsChecked = true;
                     pdfTextCreateParam = createParam;
                 }
                 else
@@ -876,7 +891,7 @@ namespace ContentEditor
                     pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage | CPDFEditType.EditText);
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
                     pdfViewControl.PDFView?.ReloadDocument();
-                    RightPanelBtn.IsChecked = false;
+                    RightPanelButton.IsChecked = false;
                     if ((bool)ViewSettingBtn.IsChecked)
                     {
                         return;
@@ -909,7 +924,7 @@ namespace ContentEditor
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
                     pdfViewControl.PDFView?.ReloadDocument();
 
-                    RightPanelBtn.IsChecked = false;
+                    RightPanelButton.IsChecked = false;
                     if (PropertyContainer.Child != null && !(bool)ViewSettingBtn.IsChecked)
                     {
                         PropertyContainer.Child = empytPanel;
@@ -999,7 +1014,7 @@ namespace ContentEditor
             if ((bool)ViewSettingBtn.IsChecked)
             {
                 ViewSettingBtn.IsChecked = false;
-                RightPanelBtn.IsChecked = true;
+                RightPanelButton.IsChecked = true;
             }
             if (e == null)
             {
@@ -1051,10 +1066,32 @@ namespace ContentEditor
             }
         }
 
-        #endregion 
+        #endregion
 
         #region Save file
 
+        /// <summary>
+        /// Save the file to another PDF file.
+        /// </summary>
+        public void SaveAsFile()
+        {
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+                {
+                    CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
+                    SaveFileDialog saveDialog = new SaveFileDialog();
+                    saveDialog.Filter = "(*.pdf)|*.pdf";
+                    saveDialog.DefaultExt = ".pdf";
+                    saveDialog.OverwritePrompt = true;
+
+                    if (saveDialog.ShowDialog() == true)
+                    {
+                        pdfDoc.WriteToFilePath(saveDialog.FileName);
+                    }
+                }
+            }
+        }
+
         private void SaveFile()
         {
             if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
@@ -1132,7 +1169,7 @@ namespace ContentEditor
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
                     pdfViewControl.PDFView?.ReloadDocument();
                 }
-                RightPanelBtn.IsChecked = false;
+                RightPanelButton.IsChecked = false;
                 ViewSettingBtn.IsChecked = false;
                 PropertyContainer.Visibility = Visibility.Collapsed;
                 if (PropertyContainer != null)
@@ -1245,9 +1282,7 @@ namespace ContentEditor
                 }
             }
         }
-
-
-        #endregion 
+        #endregion
 
         #region Close window
 
@@ -1271,7 +1306,117 @@ namespace ContentEditor
             }
         }
 
-        #endregion 
+        #endregion
+
+        #region 
+        private void CommandBinding_Executed_Open(object sender, ExecutedRoutedEventArgs e)
+        {
+            OpenFile();
+        }
+
+        private void CommandBinding_Executed_Save(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (CanSave)
+            {
+                SaveFile();
+            }
+        }
+
+        private void CommandBinding_Executed_SaveAs(object sender, ExecutedRoutedEventArgs e)
+        {
+            SaveAsFile();
+        }
+
+        private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null && CanUndo)
+            {
+                pdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null && CanRedo)
+            {
+                pdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        private void CommandBinding_Executed_ControlLeftPanel(object sender, ExecutedRoutedEventArgs e)
+        {
+            LeftToolPanelButton.IsChecked = !LeftToolPanelButton.IsChecked;
+            ControlLeftPanel();
+        }
+
+        private void CommandBinding_Executed_ControlRightPanel(object sender, ExecutedRoutedEventArgs e)
+        {
+            RightPanelButton.IsChecked = !RightPanelButton.IsChecked;
+            ControlRightPanel();
+        }
+
+        private void CommandBinding_Executed_Bookmark(object sender, ExecutedRoutedEventArgs e)
+        {
+            ExpandLeftPanel(true);
+            LeftToolPanelButton.IsChecked = true;
+            BotaSideTool.SelectBotaTool(BOTATools.Bookmark);
+        }
+
+        private void CommandBinding_Executed_Outline(object sender, ExecutedRoutedEventArgs e)
+        {
+            ExpandLeftPanel(true);
+            LeftToolPanelButton.IsChecked = true;
+            BotaSideTool.SelectBotaTool(BOTATools.Outline);
+        }
+
+        private void CommandBinding_Executed_Thumbnail(object sender, ExecutedRoutedEventArgs e)
+        {
+            ExpandLeftPanel(true);
+            LeftToolPanelButton.IsChecked = true;
+            BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
+        }
+
+        private void CommandBinding_Executed_Search(object sender, ExecutedRoutedEventArgs e)
+        {
+            ExpandLeftPanel(true);
+            LeftToolPanelButton.IsChecked = true;
+            BotaSideTool.SelectBotaTool(BOTATools.Search);
+        }
+
+        private void CommandBinding_Executed_ScaleAdd(object sender, ExecutedRoutedEventArgs e)
+        {
+            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+            pdfViewControl.PDFView?.Zoom(newZoom);
+        }
+
+        private void CommandBinding_Executed_ScaleSubtract(object sender, ExecutedRoutedEventArgs e)
+        {
+            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+            pdfViewControl.PDFView?.Zoom(newZoom);
+        }
+
+        private void CommandBinding_Executed_DisplaySettings(object sender, ExecutedRoutedEventArgs e)
+        {
+            ViewSettingBtn.IsChecked = !ViewSettingBtn.IsChecked;
+            ShowViewSettings();
+        }
+
+        private void CommandBinding_Executed_DocumentInfo(object sender, ExecutedRoutedEventArgs e)
+        {
+            if (PopupBorder.Visibility != Visibility.Visible)
+            {
+                PasswordUI.Visibility = Visibility.Collapsed;
+                FileInfoUI.Visibility = Visibility.Visible;
+                FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
+                PopupBorder.Visibility = Visibility.Visible;
+            }
+            else
+            {
+                FileInfoUI.Visibility = Visibility.Collapsed;
+                PopupBorder.Visibility = Visibility.Collapsed;
+            }
+        }
+        #endregion
     }
 }
 

+ 3 - 0
Demo/Examples/Forms/MainWindow.xaml

@@ -14,6 +14,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <!-- Shortcut --> 
             <RoutedUICommand x:Key="Open" Text="Open"/>
             <RoutedUICommand x:Key="Save" Text="Right rotate"/>
             <RoutedUICommand x:Key="SaveAs" Text="Delete"/>
@@ -31,6 +32,7 @@
             <RoutedUICommand x:Key="DocumentInfo" Text="Document infomation"></RoutedUICommand>
         </ResourceDictionary>
     </Window.Resources>
+    
     <Window.CommandBindings>
         <CommandBinding Command="{StaticResource Open}" Executed="CommandBinding_Executed_Open"/>
         <CommandBinding Command="{StaticResource Save}" Executed="CommandBinding_Executed_Save"/>
@@ -66,6 +68,7 @@
         <KeyBinding Key="D" Modifiers="Control" Command="{StaticResource DisplaySettings}"></KeyBinding>
         <KeyBinding Key="I" Modifiers="Control" Command="{StaticResource DocumentInfo}"></KeyBinding>
     </Window.InputBindings>
+    
     <Grid>
         <Grid>
             <Grid.RowDefinitions>

+ 1 - 1
Demo/Examples/Forms/MainWindow.xaml.cs

@@ -881,7 +881,7 @@ namespace Forms
         }
         #endregion
 
-        #region
+        #region Shortcut
         private void CommandBinding_Executed_Open(object sender, ExecutedRoutedEventArgs e)
         {
             OpenFile();

+ 1 - 1
Demo/Examples/PDFViewer/MainPage.xaml

@@ -15,7 +15,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
-            
+            <!-- Shortcut -->
             <RoutedUICommand x:Key="Open" Text="Open"/>
             <RoutedUICommand x:Key="Save" Text="Right rotate"/>
             <RoutedUICommand x:Key="SaveAs" Text="Delete"/>

+ 5 - 6
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -992,8 +992,7 @@ namespace PDFViewer
         }
 
         public void OpenFile()
-        {
-
+        { 
             string filePath = CommonHelper.GetFilePathOrEmpty();
             string oldFilePath = pdfViewControl.PDFView.Document.FilePath;
 
@@ -1070,6 +1069,10 @@ namespace PDFViewer
 
         private void ControlRightPanel()
         {
+            if ((bool)ViewSettingBtn.IsChecked)
+            {
+                ViewSettingBtn.IsChecked = false;
+            }
             if (RightPanelButton != null)
             {
                 if (RightPanelButton.IsChecked == true)
@@ -1110,10 +1113,6 @@ namespace PDFViewer
                             ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
                         }
                     }
-                    if ((bool)ViewSettingBtn.IsChecked)
-                    {
-                        ViewSettingBtn.IsChecked = false;
-                    }
                 }
                 else
                 {

+ 1 - 0
Demo/Examples/Samples/ImageExtractTest/ImageExtractTest.cs

@@ -31,6 +31,7 @@ namespace ImageExtractTest
             }
 
             ExtractImage(document);
+            
             Console.WriteLine("--------------------");
             Console.WriteLine("Done");
             Console.WriteLine("--------------------");