Parcourir la source

压缩-压缩功能

liyijie il y a 2 ans
Parent
commit
a43001053e

+ 1 - 0
PDF Office/App.xaml.cs

@@ -89,6 +89,7 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<SetPasswordDialog>(DialogNames.SetPasswordDialog);
             containerRegistry.RegisterDialog<CheckPasswordDialog>(DialogNames.CheckPasswordDialog);
             containerRegistry.RegisterDialog<CancelPasswordDialog>(DialogNames.CancelPasswordDialog);
+            containerRegistry.RegisterDialog<ToolsProgressBarDialog>(DialogNames.ToolsProgressBarDialog);
         }
 
         protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)

+ 23 - 0
PDF Office/Model/Dialog/ToolsDialogs/CompressDialogModel.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.ToolsDialogs
+{
+    public class CompressDialogModel
+    {
+       public enum qualityLevel { 
+        
+        _large=100,
+        _standard=80,
+        _default=45,
+        _little =40,
+        _micro=10
+        }
+        public qualityLevel CompressQuality { get; set; }
+
+        public static string PageIndex { get; set; }
+    }
+}

+ 7 - 0
PDF Office/Model/DialogNames.cs

@@ -40,5 +40,12 @@ namespace PDF_Office.Model
         /// 解压缩弹窗
         /// </summary>
         public static string CancelPasswordDialog = "CancelPasswordDialog";
+
+        /// <summary>
+        /// 进度条
+        /// </summary>
+        public static string ToolsProgressBarDialog = "ToolsProgressBarDialog";
+
+        
     }
 }

+ 1 - 0
PDF Office/Model/ParameterNames.cs

@@ -24,5 +24,6 @@ namespace PDF_Office.Model
         public static string MainViewModel = "MainViewModel";
 
         public static string ViewContentViewModel = "ViewContentViewModel";
+
     }
 }

+ 9 - 0
PDF Office/PDF Office.csproj

@@ -125,6 +125,7 @@
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
       <DependentUpon>LoadingControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Model\Dialog\ToolsDialogs\CompressDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\PasswordModel.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
     <Compile Include="Model\ParameterNames.cs" />
@@ -147,6 +148,7 @@
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\CancelPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\CheckPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\SetPasswordDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\ToolsDialogs\ToolsProgressBarDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\VerifyPassWordDialogViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeCloudContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeGuidContentViewModel.cs" />
@@ -184,6 +186,9 @@
     <Compile Include="Views\Dialog\ToolsDialogs\SaftyDialogs\SetPasswordDialog.xaml.cs">
       <DependentUpon>SetPasswordDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\ToolsDialogs\ToolsProgressBarDialog.xaml.cs">
+      <DependentUpon>ToolsProgressBarDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\VerifyPassWordDialog.xaml.cs">
       <DependentUpon>VerifyPassWordDialog.xaml</DependentUpon>
     </Compile>
@@ -309,6 +314,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\ToolsDialogs\ToolsProgressBarDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\VerifyPassWordDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 34 - 0
PDF Office/Styles/CustomBtnStyle.xaml

@@ -165,6 +165,7 @@
                 <ControlTemplate TargetType="{x:Type Button}">
                     <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                         <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                        
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
@@ -187,4 +188,37 @@
         </Setter>
     </Style>
     
+    <Style x:Key="CompressBtn" TargetType="Button">
+        <Setter Property="Background" Value="White"/>
+        <Setter Property="BorderBrush" Value="White"/>
+        <Setter Property="Width" Value="528"/>
+        <Setter Property="Height" Value="64"/>
+        <Setter Property="HorizontalAlignment" Value="Center"/>
+        
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Button}">
+                    <Border x:Name="border" BorderBrush="Black" BorderThickness="1,1,1,1" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" CornerRadius="7,7,7,7">
+                        <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" TargetName="border" Value="#1A000000"/>
+                            <Setter Property="BorderBrush" TargetName="border" Value= "gray"/>
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter Property="Background" TargetName="border" Value="#26000000"/>
+                            <Setter Property="BorderBrush" TargetName="border" Value= "gray"/>
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter Property="Background" TargetName="border" Value="Transparent"/>
+                            <Setter Property="BorderBrush" TargetName="border" Value="#33000000"/>
+                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="#FF999999"/>
+                            <Setter Property="Opacity" TargetName="contentPresenter" Value="0.4"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 198 - 56
PDF Office/ViewModels/Dialog/ToolsDialogs/CompressDialogViewModel.cs

@@ -1,63 +1,205 @@
-using Prism.Commands;
-using Prism.Mvvm;
-using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
-{
-    public class CompressDialogViewModel : BindableBase,IDialogAware
-    {
-        public DelegateCommand LargeQualityCommand { get; set; }
-
-        public DelegateCommand StandardQualityCommand { get; set; }
-
-        public DelegateCommand LittleQualityCommand { get; set; }
-
-        public DelegateCommand MicroQualityCommand { get; set; }
-
-        public DelegateCommand WhiteSmokeCommand { get; set; }
-
-    public CompressDialogViewModel()
-        {
-            LargeQualityCommand = new DelegateCommand(LargeQuality);
-            StandardQualityCommand = new DelegateCommand(StandardQuality);
-            LittleQualityCommand = new DelegateCommand(LittleQuality);
-            MicroQualityCommand = new DelegateCommand(MicroQuality);
-            WhiteSmokeCommand = new DelegateCommand(MicroQuality);
-        }
-        private void LargeQuality() { 
-        
-        }
-        private void StandardQuality()
+using PDF_Office.Model.Dialog.ToolsDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows.Forms;
+using Forms = System.Windows.Forms;
+using System.Xml.Linq;
+using ComPDFKit.PDFDocument;
+using PDF_Office.Model;
+using System.Threading.Tasks;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+using System.Windows.Controls;
+using System.Windows;
+using MessageBox = System.Windows.Forms.MessageBox;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
+
+namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
+{
+    public class CompressDialogViewModel : BindableBase,IDialogAware
+    {
+        private CPDFDocument document;
+
+        public IDialogService dialogs;
+
+        public DelegateCommand LargeQualityCommand { get; set; }
+
+        public DelegateCommand StandardQualityCommand { get; set; }
+
+        public DelegateCommand LittleQualityCommand { get; set; }
+
+        public DelegateCommand MicroQualityCommand { get; set; }
+
+        public DelegateCommand CompressCommand { get; set; }
+
+        public DelegateCommand ConfirmCompressCommand { get; set; }
+
+        private Visibility _compressLargeStyle = Visibility.Hidden;
+        public Visibility CompressLargeStyle
         {
+            get { return _compressLargeStyle; }
+            set
+            {
+                SetProperty(ref _compressLargeStyle, value);
+            }
+        }
 
-        }
-        private void LittleQuality()
+        private Visibility _compressStandardStyle = Visibility.Hidden;
+        public Visibility CompressStandardStyle
+        {
+            get { return _compressStandardStyle; }
+            set
+            {
+                SetProperty(ref _compressStandardStyle, value);
+            }
+        }
+        private Visibility _compressLittleStyle = Visibility.Hidden;
+        public Visibility CompressLittleStyle
+        {
+            get { return _compressLittleStyle; }
+            set
+            {
+                SetProperty(ref _compressLittleStyle, value);
+            }
+        }
+        private Visibility _compressMicroStyle = Visibility.Hidden;
+        public Visibility CompressMicroStyle
+        {
+            get { return _compressMicroStyle; }
+            set
+            {
+                SetProperty(ref _compressMicroStyle, value);
+            }
+        }
+
+        private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
+
+        CompressDialogModel compressDialogModel { get; set; }
+
+        private IntPtr compressingIntpr = IntPtr.Zero;
+
+        public CompressDialogViewModel(IDialogService dialogService)
         {
+            LargeQualityCommand = new DelegateCommand(LargeQuality);
+            StandardQualityCommand = new DelegateCommand(StandardQuality);
+            LittleQualityCommand = new DelegateCommand(LittleQuality);
+            MicroQualityCommand = new DelegateCommand(MicroQuality);
+            CompressCommand = new DelegateCommand(Compress);
+            ConfirmCompressCommand = new DelegateCommand(ConfirmCompress);
+            dialogs = dialogService;
+        }
 
-        }
+        private void LargeQuality() {
+            compressDialogModel.CompressQuality=CompressDialogModel.qualityLevel._large;
+            CompressLargeStyle = Visibility.Visible;
+            CompressStandardStyle = Visibility.Hidden;
+            CompressLittleStyle = Visibility.Hidden;
+            CompressMicroStyle = Visibility.Hidden;
+        }
+        private void StandardQuality()
+        {
+            compressDialogModel.CompressQuality =CompressDialogModel.qualityLevel._standard;
+            CompressLargeStyle = Visibility.Hidden;
+            CompressStandardStyle = Visibility.Visible;
+            CompressLittleStyle = Visibility.Hidden;
+            CompressMicroStyle = Visibility.Hidden;
+        }
+        private void LittleQuality()
+        {
+            compressDialogModel.CompressQuality = CompressDialogModel.qualityLevel._little;
+            CompressLargeStyle = Visibility.Hidden;
+            CompressStandardStyle = Visibility.Hidden;
+            CompressLittleStyle = Visibility.Visible;
+            CompressMicroStyle = Visibility.Hidden;
+        }
         private void MicroQuality()
         {
+            compressDialogModel.CompressQuality = CompressDialogModel.qualityLevel._micro;
+            CompressLargeStyle = Visibility.Hidden;
+            CompressStandardStyle = Visibility.Hidden;
+            CompressLittleStyle = Visibility.Hidden;
+            CompressMicroStyle = Visibility.Visible;
+        }
+
+        private void ConfirmCompress()
+        {
+            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        private int GetIndex(int pageindex)
+        {
+            Trace.WriteLine(pageindex);
+            return 0;
+        }
+        private async void  Compress() {
+
+            FolderBrowserDialog folderDialog = new FolderBrowserDialog();
+            Forms.SaveFileDialog sfd = new Forms.SaveFileDialog();
+            /*
+             *设置这个对话框的起始保存路径
+             */
+            sfd.InitialDirectory = document.FilePath;
+            /*
+             *设置保存的文件的类型,注意过滤器的语法 例子:“文件类型|*.后缀名;*.后缀名;”
+             */
+            sfd.Filter = "PDF|*.pdf;";
+            /*
+             *调用ShowDialog()方法显示该对话框,该方法的返回值代表用户是否点击了确定按钮
+             **/
+            sfd.FileName = document.FileName + "_CompressFile.pdf";
+            if (sfd.ShowDialog() == Forms.DialogResult.OK)
+            {
+                /*
+                 * 做一些工作
+                 */
+                
+                Trace.WriteLine("compressDialogModel.CompressQuality:  " + compressDialogModel.CompressQuality);
+                DialogParameters value = new DialogParameters();
+                value.Add(ParameterNames.PDFDocument,document );
+                value.Add(ParameterNames.FilePath, sfd.FileName);
+                value.Add("compressDialogModel.CompressQuality", (int)compressDialogModel.CompressQuality);
+                RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+                dialogs.ShowDialog(DialogNames.ToolsProgressBarDialog, value, e => {
 
-        }
-
-        public string Title => "";
-
-        public event Action<IDialogResult> RequestClose;
-
-        public bool CanCloseDialog()
-        {
-            return true;
-        }
-
-        public void OnDialogClosed()
-        {
-        }
-
-        public void OnDialogOpened(IDialogParameters parameters)
-        {
-        }
-    }
-}
+                });
+                
+                
+                
+            }
+            else
+            {
+                MessageBox.Show("Cancel.");
+            }
+
+        }
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFDocument doc = null;
+            parameters.TryGetValue<CPDFDocument>(ParameterNames.PDFDocument, out doc);
+            if (doc != null)
+            {
+                 CompressDialogModel compressdialogmodel =new CompressDialogModel();
+                 document = doc;
+                 compressDialogModel = compressdialogmodel;
+                 compressDialogModel.CompressQuality =CompressDialogModel.qualityLevel._default;
+            }
+        }
+    }
+}

+ 5 - 1
PDF Office/ViewModels/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialogViewModel.cs

@@ -25,6 +25,8 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
 
         public DelegateCommand InputPasswordCommand { get; set; }
 
+        private PasswordModel passwordModel = new PasswordModel();
+
         private string _permissionPassword;
         public string PermissionPassword
         {
@@ -85,12 +87,13 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
             sfd.FileName = document.FileName + "_SetPassword.pdf";
             if (sfd.ShowDialog() == Forms.DialogResult.OK)
             {
-                PasswordModel passwordModel = new PasswordModel();
+                
                 /*
                  * 做一些工作
                  */
                 if (AllowsCopying == "True")
                 {
+                    Trace.WriteLine("111111111"+"True");
                     passwordModel.PermissionsInfo.AllowsCopying = true;
                 }
                 else {
@@ -101,6 +104,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
                     passwordModel.PermissionsInfo.AllowsPrinting = true;
                 }
                 else {
+                    Trace.WriteLine("2222222"+"false");
                     passwordModel.PermissionsInfo.AllowsPrinting = false; 
                 }
                 passwordModel.PermissionPassword=PermissionPassword;

+ 99 - 0
PDF Office/ViewModels/Dialog/ToolsDialogs/ToolsProgressBarDialogViewModel.cs

@@ -0,0 +1,99 @@
+using ComPDFKit.PDFDocument;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ToolsDialogs;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
+
+namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
+{
+    public class ToolsProgressBarDialogViewModel : BindableBase, IDialogAware
+    {
+        private IntPtr compressingIntpr = IntPtr.Zero;
+
+        private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
+
+        private CPDFDocument tempDocument;
+
+        private string _pageIndex = "0";
+        /// <summary>
+        /// 页面尺寸
+        /// </summary>
+        public string PageIndex
+        {
+            get { return _pageIndex; }
+            set
+            {
+                SetProperty(ref _pageIndex, value);
+            }
+        }
+
+        private string _pageNumber = "";
+        /// <summary>
+        /// 页面尺寸
+        /// </summary>
+        public string PageNumber
+        {
+            get { return _pageNumber; }
+            set
+            {
+                SetProperty(ref _pageNumber, value);
+            }
+        }
+
+        private int GetIndex(int pageindex)
+        {
+            PageIndex= pageindex.ToString();
+            return 0;
+        }
+
+        public ToolsProgressBarDialogViewModel()
+        {
+
+        }
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+            tempDocument.CompressFile_Cancel(compressingIntpr);
+        }
+
+        public async void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFDocument doc = null;
+            string filepath = "";
+            int compressquality=45;
+            parameters.TryGetValue<CPDFDocument>(ParameterNames.PDFDocument, out doc);
+            parameters.TryGetValue<string>(ParameterNames.FilePath, out filepath);
+            parameters.TryGetValue<int>("compressDialogModel.CompressQuality", out compressquality);
+            if (doc != null)
+            {
+                PageNumber = doc.PageCount.ToString();
+                CPDFDocument document = CPDFDocument.InitWithFilePath(doc.FilePath);
+                indexDelegate += GetIndex;
+                compressingIntpr = document.CompressFile_Init(compressquality, indexDelegate);
+                //GC.KeepAlive(indexDelegate);
+                tempDocument = document;
+                Trace.WriteLine("compressDialogModel.CompressQuality" + compressquality);
+                await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filepath); });
+                RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
+                document.Release();
+            }
+        }
+    }
+}

+ 19 - 10
PDF Office/Views/Dialog/ToolsDialogs/CompressDialog.xaml

@@ -8,6 +8,13 @@
              d:DesignHeight="500"
              d:DesignWidth="600"
              mc:Ignorable="d">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
     <Grid >
         <Grid.RowDefinitions>
             <RowDefinition Name="HeadRow" Height="40" />
@@ -17,43 +24,45 @@
         <TextBlock Grid.Row="0" Text="压缩PDF" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
         <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1">
             <StackPanel>
-                <Button HorizontalAlignment="Center" Width="528" Height="64" Margin="0,10,0,16" Background="WhiteSmoke" Command="{Binding LargeQualityCommand}">
+                
+                <Button  Style="{StaticResource CompressBtn}" Margin="0,10,0,16"  Command="{Binding LargeQualityCommand}">
                     <StackPanel Orientation="Horizontal" >
                         <Border HorizontalAlignment="Right" Margin="0,0,350,0">
                             <TextBlock Text="大型文件" FontSize="18"></TextBlock>
                         </Border>
                         <Border>
-                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill"/>
+                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill" Visibility="{Binding CompressLargeStyle}"/>
                         </Border>
                     </StackPanel>
                 </Button>
-                <Button HorizontalAlignment="Center" Width="528" Height="64" Margin="0,0,0,16" Background="WhiteSmoke" Command="{Binding StandardQualityCommand}">
+                
+                <Button Style="{StaticResource CompressBtn}" Margin="0,0,0,16"  Command="{Binding StandardQualityCommand}">
                     <StackPanel Orientation="Horizontal" >
                         <Border HorizontalAlignment="Right" Margin="0,0,350,0">
                             <TextBlock Text="标准文件" FontSize="18" Foreground="Black" ></TextBlock>
                         </Border>
                         <Border>
-                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill"/>
+                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill" Visibility="{Binding CompressStandardStyle}"/>
                         </Border>
                     </StackPanel>
                 </Button>
-                <Button HorizontalAlignment="Center" Width="528" Height="64" Margin="0,0,0,16" Background="WhiteSmoke" Command="{Binding LittleQualityCommand}">
+                <Button Style="{StaticResource CompressBtn}" Margin="0,0,0,16"  Command="{Binding LittleQualityCommand}">
                     <StackPanel Orientation="Horizontal" >
                         <Border HorizontalAlignment="Right" Margin="0,0,280,0">
                             <TextBlock Text="小型文件(推荐)" FontSize="18" Foreground="Black"></TextBlock>
                         </Border>
                         <Border>
-                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill"/>
+                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill" Visibility="{Binding CompressLittleStyle}"/>
                         </Border>
                     </StackPanel>
                 </Button>
-                <Button HorizontalAlignment="Center" Width="528" Height="64" Margin="0,0,0,64" Background="WhiteSmoke" Command="{Binding MicroQualityCommand}">
+                <Button Style="{StaticResource CompressBtn}" Margin="0,0,0,64"  Command="{Binding MicroQualityCommand}">
                     <StackPanel Orientation="Horizontal" >
                         <Border HorizontalAlignment="Right" Margin="0,0,350,0">
                             <TextBlock Text="微型文件" FontSize="18" Foreground="Black"></TextBlock>
                         </Border>
                         <Border>
-                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill"/>
+                            <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 0L4 4 L12 -3" Height="10" Stretch="Fill" Visibility="{Binding CompressMicroStyle}"/>
                         </Border>
                     </StackPanel>
                 </Button>
@@ -68,12 +77,12 @@
                 </Button>
             </StackPanel>
             <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
-                <Button Background="WhiteSmoke" Width="100" Height="25" Margin="0,0,10,0" Command="{Binding WhiteSmokeCommand}">
+                <Button Background="WhiteSmoke" Width="100" Height="25" Margin="0,0,10,0" Command="{Binding CompressCommand}">
                     <Border>
                         <TextBlock Text="压缩"></TextBlock>
                     </Border>
                 </Button>
-                <Button Background="WhiteSmoke" Width="100" Height="25" Margin="0,0,10,0">
+                <Button Background="WhiteSmoke" Width="100" Height="25" Margin="0,0,10,0" Command="{Binding ConfirmCompressCommand}">
                     <Border>
                         <TextBlock Text="取消" ></TextBlock>
                     </Border>

+ 25 - 0
PDF Office/Views/Dialog/ToolsDialogs/ToolsProgressBarDialog.xaml

@@ -0,0 +1,25 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.ToolsDialogs.ToolsProgressBarDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             d:DesignHeight="40"
+             d:DesignWidth="220"
+             mc:Ignorable="d">
+    <Grid Height="40" Width="220">
+        <StackPanel>
+            <StackPanel Orientation="Horizontal" Margin="13,5,0,10">
+                <TextBlock Text="Compress  "></TextBlock>
+                <TextBlock Text="("></TextBlock>
+                <TextBlock Text="{Binding PageIndex}"></TextBlock>
+                <TextBlock Text="/"></TextBlock>
+                <TextBlock Text="{Binding PageNumber}"></TextBlock>
+                <TextBlock Text=")"></TextBlock>
+
+            </StackPanel>
+            <ProgressBar Minimum="0" Maximum="{Binding PageNumber}" Value="{Binding PageIndex}"  Height="4" Width="194"/>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/ToolsDialogs/ToolsProgressBarDialog.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.ToolsDialogs
+{
+    /// <summary>
+    /// Interaction logic for ToolsProgressBarDialog
+    /// </summary>
+    public partial class ToolsProgressBarDialog : UserControl
+    {
+        public ToolsProgressBarDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 0 - 1
PDF Office/Views/ViewContent.xaml

@@ -180,6 +180,5 @@
             Grid.Row="{Binding GridToolRow}"
             prism:RegionManager.RegionName="{Binding ToolsBarContentRegionName}"
             Visibility="{Binding ToolsBarContentVisible}" />
-
     </Grid>
 </UserControl>