Преглед на файлове

其他-补充OCR进度条

ZhouJieSheng преди 2 години
родител
ревизия
71cf6d34c6
променени са 2 файла, в които са добавени 97 реда и са изтрити 0 реда
  1. 62 0
      PDF Office/ViewModels/MainWindowViewModel.cs
  2. 35 0
      PDF Office/Views/MainWindow.xaml

+ 62 - 0
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -41,6 +41,52 @@ namespace PDF_Office.ViewModels
             }
             }
         }
         }
 
 
+        private double value = 0;
+        /// <summary>
+        /// 进度条当前值
+        /// </summary>
+        public double Value
+        {
+            get { return value; }
+            set
+            {
+                SetProperty(ref value, value);
+            }
+        }
+
+        private double maxValue = 100;
+        /// <summary>
+        /// 进度条最大值
+        /// </summary>
+        public double MaxValue
+        {
+            get { return maxValue; }
+            set
+            {
+                SetProperty(ref maxValue, value);
+            }
+        }
+
+
+        private Visibility isProcessVisible = Visibility.Collapsed;
+        /// <summary>
+        /// OCR进度条是否显示
+        /// </summary>
+        public Visibility IsProcessVisible
+        {
+            get { return isProcessVisible; }
+            set
+            {
+                SetProperty(ref isProcessVisible, value);
+            }
+        }
+
+        /// <summary>
+        /// 进度条关闭的事件
+        /// </summary>
+        public Action ProcessCloseAction;
+
+
         private CPDFViewer pdfViewer;
         private CPDFViewer pdfViewer;
 
 
         /// <summary>
         /// <summary>
@@ -54,6 +100,10 @@ namespace PDF_Office.ViewModels
 
 
         public DelegateCommand AddTab { get; set; }
         public DelegateCommand AddTab { get; set; }
 
 
+        /// <summary>
+        /// 关闭OCR进度条
+        /// </summary>
+        public DelegateCommand CloseOCRCommand { get; set; }
 
 
         public IRegionManager region;
         public IRegionManager region;
 
 
@@ -80,6 +130,7 @@ namespace PDF_Office.ViewModels
             InterTabClient = new InterTabClient(container);
             InterTabClient = new InterTabClient(container);
 
 
             AddTab = new DelegateCommand(AddTabItem);
             AddTab = new DelegateCommand(AddTabItem);
+            CloseOCRCommand = new DelegateCommand(closeocr);
 
 
             //第一次打开时需要自动加载Home页
             //第一次打开时需要自动加载Home页
             if (App.IsFirstOpen)
             if (App.IsFirstOpen)
@@ -93,6 +144,17 @@ namespace PDF_Office.ViewModels
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 关闭OCR
+        /// </summary>
+        private void closeocr()
+        {
+            if(ProcessCloseAction!=null)
+            {
+                ProcessCloseAction.Invoke();
+            }
+        }
+
         /// <summary>
         /// <summary>
         /// 单击+号时添加页签
         /// 单击+号时添加页签
         /// </summary>
         /// </summary>

+ 35 - 0
PDF Office/Views/MainWindow.xaml

@@ -248,6 +248,41 @@
                     <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
                     <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
                 </Button>
                 </Button>
             </StackPanel>
             </StackPanel>
+
+            <!--  OCR Progress Control  -->
+            <Grid Grid.RowSpan="2" Visibility="{Binding IsProcessVisible}">
+                <Grid.Background>
+                    <SolidColorBrush Opacity="0.05" Color="Black" />
+                </Grid.Background>
+                <Border
+                    Width="226"
+                    Height="58"
+                    Background="{StaticResource color.sys.layout.dark.bg}"
+                    BorderThickness="0"
+                    CornerRadius="{StaticResource border-radius.8}"
+                    Effect="{StaticResource shadow.neutral.m}">
+                    <Grid Margin="16,13" Background="Transparent">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="Text" />
+                            <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding Value, StringFormat={}({0})}" />
+                        </StackPanel>
+                        <Button
+                            Width="12"
+                            Height="12"
+                            HorizontalAlignment="Right"
+                            VerticalAlignment="Top"
+                            Command="{Binding CloseOCRCommand}" />
+                        <ProgressBar
+                            Height="4"
+                            Margin="0,0,0,4"
+                            VerticalAlignment="Bottom"
+                            BorderThickness="0"
+                            Foreground="{StaticResource color.slider.track-filled.norm}"
+                            Maximum="{Binding MaxValue}"
+                            Value="{Binding Value}" />
+                    </Grid>
+                </Border>
+            </Grid>
         </Grid>
         </Grid>
     </Border>
     </Border>
 </Window>
 </Window>