ソースを参照

综合- 补充自动保存逻辑

ZhouJieSheng 1 年間 前
コミット
3d609bdd00

+ 2 - 0
PDF Office/CustomControl/AlertsMessage.xaml

@@ -68,6 +68,7 @@
                     Content="Cancel"
                     FontSize="14"
                     FontWeight="SemiBold"
+                    IsCancel="True"
                     Style="{StaticResource btn.sec}" />
                 <Button
                     x:Name="MiddleCancelBtn"
@@ -88,6 +89,7 @@
                     Content="Save"
                     FontSize="14"
                     FontWeight="SemiBold"
+                    IsDefault="True"
                     Style="{StaticResource Btn.cta}" />
             </Grid>
         </Grid>

+ 1 - 1
PDF Office/CustomControl/ColorDropBox.xaml.cs

@@ -136,7 +136,7 @@ namespace PDF_Master.CustomControl
                 else if(offset.Y+ colorPop.DesiredSize.Height+SystemParameters.ResizeFrameVerticalBorderWidth * 2 > parentWnd.ActualHeight)
                 {
                     //超出窗体高度时 重新计算定位
-                    colorPop.SetValue(Canvas.TopProperty, parentWnd.ActualHeight - colorPop.DesiredSize.Height-15);
+                    colorPop.SetValue(Canvas.TopProperty, parentWnd.ActualHeight - 260);
                     colorPop.SetValue(Canvas.LeftProperty, offset.X+25);
                 }
                 else

+ 64 - 1
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -50,6 +50,60 @@ namespace PDF_Master.ViewModels.BOTA
             }
         }
 
+        private string tip_Thumbnail;
+
+        public string Tip_Thumbnail
+        {
+            get { return tip_Thumbnail; }
+            set
+            {
+                SetProperty(ref tip_Thumbnail, value);
+            }
+        }
+
+        private string tip_OutLine;
+
+        public string Tip_OutLine
+        {
+            get { return tip_OutLine; }
+            set
+            {
+                SetProperty(ref tip_OutLine, value);
+            }
+        }
+
+        private string tip_BookMark;
+
+        public string Tip_BookMark
+        {
+            get { return tip_BookMark; }
+            set
+            {
+                SetProperty(ref tip_BookMark, value);
+            }
+        }
+
+        private string tip_Search;
+
+        public string Tip_Search
+        {
+            get { return tip_Search; }
+            set
+            {
+                SetProperty(ref tip_Search, value);
+            }
+        }
+
+        private string tip_Annote;
+
+        public string Tip_Annote
+        {
+            get { return tip_Annote; }
+            set
+            {
+                SetProperty(ref tip_Annote, value);
+            }
+        }
 
         public string CurrentBar = "";
 
@@ -64,7 +118,7 @@ namespace PDF_Master.ViewModels.BOTA
             viewNameByTabItem = new Dictionary<string, string>();
             InitDictionartViewNameByTabItem(ref viewNameByTabItem);
 
-    
+            InitString();
         }
 
         private void TabControlSelectionChangedEvent(object e)
@@ -80,6 +134,15 @@ namespace PDF_Master.ViewModels.BOTA
             }
         }
 
+        private void InitString()
+        {
+            Tip_Annote = App.MainPageLoader.GetString("ViewTopToolbar_Annotation");
+            Tip_OutLine = App.MainPageLoader.GetString("Outline_Title");
+            Tip_BookMark = App.MainPageLoader.GetString("Bookmark_Title");
+            Tip_Search = App.MainPageLoader.GetString("ViewRightMenu_Search");
+            Tip_Thumbnail = App.MainPageLoader.GetString("Thumbnails_Title");
+        }
+
         /// <summary>
         /// 初始化名称-视图字典
         /// </summary>

+ 7 - 1
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -488,12 +488,18 @@ namespace PDF_Master.ViewModels
             {
                 region.Regions[RegionNames.MainRegion].Remove(item);
                 CheckViewsCount();
+
+                //关闭子窗体的最后一个页签时,子窗体关闭(不显示首页),参考福昕逻辑
+                if((App.Current.MainWindow as MainWindow).TabablzControl.Items.Count==0)
+                {
+                    App.Current.MainWindow.Close();
+                }
             }
             else
             {
                 if (maincontentViewModel.PDFViewer != null)
                 {
-                    //如果是打开文档的页签 则回到首页
+                    //如果是关闭文档的页签 则回到首页
                     region.Regions[RegionNames.MainRegion].Remove(item);
                     region.RequestNavigate(RegionNames.MainRegion, "MainContent");
                 }

+ 60 - 0
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -38,6 +38,7 @@ using PDF_Master.Views.BOTA;
 using System.Drawing;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using PDF_Master.Model.FillAndSign;
+using System.Windows.Threading;
 
 namespace PDF_Master.ViewModels
 {
@@ -657,6 +658,12 @@ namespace PDF_Master.ViewModels
 
         public string unicode = null;
 
+
+        /// <summary>
+        /// 自动保存的定时器
+        /// </summary>
+        private DispatcherTimer autoSaveTimer = new DispatcherTimer();
+
         /// <summary>
         /// 用来避免重复触发导航事件的标志符
         /// </summary>
@@ -825,6 +832,50 @@ namespace PDF_Master.ViewModels
             //TODO:根据缓存 选择用户上次选择的菜单
             CurrentBar = "TabItemAnnotation";
             EnterSelectedBar("TabItemAnnotation");
+
+            StartAutoSave();
+        }
+
+        /// <summary>
+        /// 开始自动保存
+        /// </summary>
+        public void StartAutoSave()
+        {
+            var autoSave = Settings.Default.AppProperties.Description.AutoSave;
+            if(autoSave)
+            {
+                var interval = Settings.Default.AppProperties.Description.AutoSaveInterval;
+                if(autoSaveTimer==null)
+                {
+                    autoSaveTimer = new DispatcherTimer();
+                }
+                autoSaveTimer.Stop();
+                autoSaveTimer.Interval = TimeSpan.FromMinutes(interval);
+                autoSaveTimer.Tick -= AutoSaveTimer_Tick;
+                autoSaveTimer.Tick += AutoSaveTimer_Tick;
+                autoSaveTimer.Start();
+            }
+        }
+
+        /// <summary>
+        /// 释放定时器
+        /// 不释放定时器可能会一直运行并占用内存,导致内存泄露
+        /// </summary>
+        public void CloseAutoSave()
+        {
+            autoSaveTimer.Stop();
+            autoSaveTimer.Tick -= AutoSaveTimer_Tick;
+            autoSaveTimer = null;
+        }
+
+        private void AutoSaveTimer_Tick(object sender, EventArgs e)
+        {
+            var autoSave = Settings.Default.AppProperties.Description.AutoSave;
+            if (autoSave&&!mainViewModel.NewFile)
+            {
+                //自动保存仅针对已经有文件路径的文档
+                saveFile();
+            }
         }
 
         private void MouseDownEvent()
@@ -1318,6 +1369,15 @@ namespace PDF_Master.ViewModels
             {
                 PDFViewer.SetBackgroundBrush(new System.Windows.Media.SolidColorBrush(Settings.Default.AppProperties.InitialVIew.BackGround));
             }
+
+            if(Settings.Default.AppProperties.Description.AutoSave)
+            {
+                StartAutoSave();
+            }
+            else
+            {
+                CloseAutoSave();
+            }
         }
 
         private bool CanSaveExcute()

+ 5 - 0
PDF Office/Views/BOTA/BOTAContent.xaml

@@ -94,6 +94,7 @@
                 Width="48"
                 Height="48"
                 IsVisibleChanged="TabItemThumbnail_IsVisibleChanged"
+                ToolTip="{Binding Tip_Thumbnail}"
                 Visibility="{Binding ElementName=MenuThumbnail, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                 <customcontrol:IconAndTextTabItem.NormalPathIcon>
                     <PathGeometry Figures="M15 9V17H5L5 3L9 3V7C9 8.10457 9.89543 9 11 9H15ZM14.1716 7H11V3.82843L12.5858 5.41421L14.1716 7ZM17 8V17C17 18.1046 16.1046 19 15 19H5C3.89543 19 3 18.1046 3 17V3C3 1.89543 3.89543 1 5 1H10H10.1716C10.702 1 11.2107 1.21071 11.5858 1.58579L14 4L16.4142 6.41421C16.7893 6.78929 17 7.29799 17 7.82843V8Z" />
@@ -108,6 +109,7 @@
                 Height="48"
                 Header="大纲"
                 IsVisibleChanged="TabItemThumbnail_IsVisibleChanged"
+                ToolTip="{Binding Tip_OutLine}"
                 Visibility="{Binding ElementName=MenuOutLine, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                 <customcontrol:IconAndTextTabItem.NormalPathIcon>
                     <PathGeometry Figures="M3 6H6V5C6 4.44772 6.44772 4 7 4H18C18.5523 4 19 4.44772 19 5V9C19 9.55228 18.5523 10 18 10H7C6.44772 10 6 9.55228 6 9V8H3V14L6 14V13C6 12.4477 6.44772 12 7 12H18C18.5523 12 19 12.4477 19 13V17C19 17.5523 18.5523 18 18 18H7C6.44772 18 6 17.5523 6 17V16H3C1.89543 16 1 15.1046 1 14V6V2H3V6ZM8 6V8H17V6H8ZM8 16V14H17V16H8Z" />
@@ -122,6 +124,7 @@
                 Height="48"
                 Header="书签"
                 IsVisibleChanged="TabItemThumbnail_IsVisibleChanged"
+                ToolTip="{Binding Tip_BookMark}"
                 Visibility="{Binding ElementName=MenuBookMark, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                 <customcontrol:IconAndTextTabItem.NormalPathIcon>
                     <PathGeometry Figures="M11.3793 12.8851C10.6069 12.1494 9.3931 12.1494 8.62069 12.8851L5 16.3333V3H15V16.3333L11.3793 12.8851ZM15.3103 19.3908L10 14.3333L4.68966 19.3908C4.053 19.9971 3 19.5459 3 18.6667V3C3 1.89543 3.89543 1 5 1H15C16.1046 1 17 1.89543 17 3V18.6667C17 19.5459 15.947 19.9971 15.3103 19.3908ZM7 5H8H12H13V6V7H12H8H7V6V5Z" />
@@ -136,6 +139,7 @@
                 Height="48"
                 Header="注释"
                 IsVisibleChanged="TabItemThumbnail_IsVisibleChanged"
+                ToolTip="{Binding Tip_Annote}"
                 Visibility="{Binding ElementName=MenuAnnotation, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                 <customcontrol:IconAndTextTabItem.NormalPathIcon>
                     <PathGeometry Figures="M3.5 1.5C2.39543 1.5 1.5 2.39543 1.5 3.5V16.5C1.5 17.6046 2.39543 18.5 3.5 18.5H16.5C17.6046 18.5 18.5 17.6046 18.5 16.5V3.5C18.5 2.39543 17.6046 1.5 16.5 1.5H3.5ZM8.06104 14H6.3584L9.04932 6.24951H10.9561L13.6523 14H11.9443L11.3696 12.1201H8.63574L8.06104 14ZM10.0537 7.79639H9.95703L9.00635 10.9062H10.999L10.0537 7.79639Z" />
@@ -150,6 +154,7 @@
                 Height="48"
                 Header="搜索"
                 IsVisibleChanged="TabItemThumbnail_IsVisibleChanged"
+                ToolTip="{Binding Tip_Search}"
                 Visibility="{Binding ElementName=MenuSearch, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                 <customcontrol:IconAndTextTabItem.NormalPathIcon>
                     <PathGeometry Figures="M14 8.5C14 11.5376 11.5376 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3C11.5376 3 14 5.46243 14 8.5ZM13.0492 14.4633C11.7874 15.4274 10.2106 16 8.5 16C4.35786 16 1 12.6421 1 8.5C1 4.35786 4.35786 1 8.5 1C12.6421 1 16 4.35786 16 8.5C16 10.2105 15.4274 11.7873 14.4634 13.0491L18.4572 17.0429L17.043 18.4571L13.0492 14.4633Z" />

+ 104 - 55
PDF Office/Views/Dialog/ToolsDialogs/SaftyDialogs/CheckPasswordDialog.xaml

@@ -1,53 +1,68 @@
-<UserControl x:Class="PDF_Master.Views.Dialog.ToolsDialogs.SaftyDialogs.CheckPasswordDialog"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/" xmlns:cus="clr-namespace:PDF_Master.CustomControl"
-             prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
-             xmlns:help="clr-namespace:PDF_Master.Helper" xmlns:saftydialogs="clr-namespace:PDF_Master.ViewModels.Dialog.ToolsDialogs.SaftyDialogs" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             prism:ViewModelLocator.AutoWireViewModel="True">
+<UserControl
+    x:Class="PDF_Master.Views.Dialog.ToolsDialogs.SaftyDialogs.CheckPasswordDialog"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Master.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:help="clr-namespace:PDF_Master.Helper"
+    xmlns:prism="http://prismlibrary.com/"
+    xmlns:saftydialogs="clr-namespace:PDF_Master.ViewModels.Dialog.ToolsDialogs.SaftyDialogs"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
+    prism:ViewModelLocator.AutoWireViewModel="True">
     <UserControl.Resources>
-        <Style TargetType="PasswordBox" x:Key="CheckPasswordBoxStyle">
-            <Setter Property="Height" Value="32"/>
-            <Setter Property="FontSize" Value="14"/>
+        <Style x:Key="CheckPasswordBoxStyle" TargetType="PasswordBox">
+            <Setter Property="Height" Value="32" />
+            <Setter Property="FontSize" Value="14" />
             <Setter Property="Template">
                 <Setter.Value>
                     <ControlTemplate TargetType="PasswordBox">
-                        <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" 
-                                    BorderThickness="{TemplateBinding BorderThickness}" 
-                                    Background="{TemplateBinding Background}" 
-                                    SnapsToDevicePixels="True"
-                                    CornerRadius="5">
+                        <Border
+                            x:Name="border"
+                            Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
+                            BorderThickness="{TemplateBinding BorderThickness}"
+                            CornerRadius="5"
+                            SnapsToDevicePixels="True">
                             <Grid>
                                 <Grid.ColumnDefinitions>
-                                    <ColumnDefinition></ColumnDefinition>
-                                    <ColumnDefinition Width="24"></ColumnDefinition>
+                                    <ColumnDefinition />
+                                    <ColumnDefinition Width="24" />
                                 </Grid.ColumnDefinitions>
                                 <Grid Grid.Column="0" Margin="8,0,0,0">
-                                    <TextBlock Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
-                                           Name="markText" Visibility="Collapsed" FontSize="12" />
-                                    <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
-                                                  HorizontalScrollBarVisibility="Hidden" 
-                                                  VerticalScrollBarVisibility="Hidden"
-                                                  VerticalAlignment="Center" MinHeight="20"/>
+                                    <TextBlock
+                                        Name="markText"
+                                        Grid.Column="1"
+                                        VerticalAlignment="Center"
+                                        FontSize="12"
+                                        Foreground="#BBB"
+                                        Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}"
+                                        Visibility="Collapsed" />
+                                    <ScrollViewer
+                                        x:Name="PART_ContentHost"
+                                        MinHeight="20"
+                                        VerticalAlignment="Center"
+                                        Focusable="false"
+                                        HorizontalScrollBarVisibility="Hidden"
+                                        VerticalScrollBarVisibility="Hidden" />
                                 </Grid>
                             </Grid>
                         </Border>
 
                         <ControlTemplate.Triggers>
                             <Trigger Property="IsEnabled" Value="false">
-                                <Setter Property="Opacity" TargetName="border" Value="0.56"/>
+                                <Setter TargetName="border" Property="Opacity" Value="0.56" />
                             </Trigger>
                             <Trigger Property="IsMouseOver" Value="true">
-                                <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
+                                <Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
                             </Trigger>
                             <Trigger Property="IsKeyboardFocused" Value="true">
-                                <Setter Property="BorderBrush" TargetName="border" Value="#1770F4"/>
+                                <Setter TargetName="border" Property="BorderBrush" Value="#1770F4" />
                             </Trigger>
-                            <DataTrigger Binding="{Binding Path = Password}" Value="">
-                                <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
+                            <DataTrigger Binding="{Binding Path=Password}" Value="">
+                                <Setter TargetName="markText" Property="Visibility" Value="Visible" />
                             </DataTrigger>
                             <DataTrigger Binding="{Binding Path=IsRightValue}" Value="false">
-                                <Setter Property="BorderBrush" TargetName="border" Value="#F3465B"/>
+                                <Setter TargetName="border" Property="BorderBrush" Value="#F3465B" />
                             </DataTrigger>
                         </ControlTemplate.Triggers>
                     </ControlTemplate>
@@ -55,18 +70,18 @@
             </Setter>
         </Style>
 
-        <Style  TargetType="Button" x:Key="DeletePasswordButtonStyle">
-            <Setter Property="Height" Value="14"></Setter>
-            <Setter Property="Width" Value="14"></Setter>
-            <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
-            <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+        <Style x:Key="DeletePasswordButtonStyle" TargetType="Button">
+            <Setter Property="Height" Value="14" />
+            <Setter Property="Width" Value="14" />
+            <Setter Property="HorizontalContentAlignment" Value="Center" />
+            <Setter Property="VerticalContentAlignment" Value="Center" />
             <Setter Property="Template">
                 <Setter.Value>
                     <ControlTemplate TargetType="{x:Type ButtonBase}">
                         <Grid>
                             <Viewbox Stretch="Uniform">
                                 <Grid>
-                                    <Path Data="M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14ZM10.5303 4.53038L8.06069 7L10.5303 9.46962L9.46967 10.5303L7.00002 8.06066L4.53033 10.5303L3.46967 9.46967L5.93936 7L3.46967 4.53033L4.53033 3.46967L7.00002 5.93934L9.46967 3.46971L10.5303 4.53038Z" Fill="#CED0D4"></Path>
+                                    <Path Data="M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14ZM10.5303 4.53038L8.06069 7L10.5303 9.46962L9.46967 10.5303L7.00002 8.06066L4.53033 10.5303L3.46967 9.46967L5.93936 7L3.46967 4.53033L4.53033 3.46967L7.00002 5.93934L9.46967 3.46971L10.5303 4.53038Z" Fill="#CED0D4" />
                                 </Grid>
                             </Viewbox>
                         </Grid>
@@ -75,45 +90,79 @@
             </Setter>
         </Style>
     </UserControl.Resources>
-    <cus:DialogContent Header="Open Pasword" FontFamily="Segoe UI">
+    <cus:DialogContent FontFamily="Segoe UI" Header="Open Pasword">
         <cus:DialogContent.Content>
-            <Grid Margin="16,0,16,0" Width="400" MinHeight="106">
+            <Grid
+                Width="400"
+                MinHeight="106"
+                Margin="16,0,16,0">
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="80"></ColumnDefinition>
-                    <ColumnDefinition></ColumnDefinition>
+                    <ColumnDefinition Width="80" />
+                    <ColumnDefinition />
                 </Grid.ColumnDefinitions>
-                <Image Source="pack://application:,,,/Resources/Dialog/password.png"  Margin="0,-20,0,0"></Image>
+                <Image Margin="0,-20,0,0" Source="pack://application:,,,/Resources/Dialog/password.png" />
                 <Grid Grid.Column="1" Margin="8,0,0,0">
                     <Grid.RowDefinitions>
-                        <RowDefinition MinHeight="44"></RowDefinition>
-                        <RowDefinition Height="40"></RowDefinition>
-                        <RowDefinition></RowDefinition>
+                        <RowDefinition MinHeight="44" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition />
                     </Grid.RowDefinitions>
                     <Grid Grid.Row="0">
-                        <TextBlock TextWrapping="Wrap" Block.TextAlignment="Left" Text="{Binding InputPasswordMsg, Mode=TwoWay}" FontSize="14" FontFamily="Segoe UI"> </TextBlock>
+                        <TextBlock
+                            Block.TextAlignment="Left"
+                            FontFamily="Segoe UI"
+                            FontSize="14"
+                            Text="{Binding InputPasswordMsg, Mode=TwoWay}"
+                            TextWrapping="Wrap" />
                     </Grid>
-                    <Grid  Grid.Row="1"  Margin="0,8,0,0">
+                    <Grid Grid.Row="1" Margin="0,8,0,0">
                         <Grid.ColumnDefinitions>
-                            <ColumnDefinition></ColumnDefinition>
-                            <ColumnDefinition Width="23"></ColumnDefinition>
+                            <ColumnDefinition />
+                            <ColumnDefinition Width="23" />
                         </Grid.ColumnDefinitions>
-                        <PasswordBox PasswordChar="*" Style="{StaticResource CheckPasswordBoxStyle}"  help:PasswordBoxHelper.Password="{Binding Password, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}" help:PasswordBoxHelper.DisplayText="{Binding CheckPasswordMsg, Mode=TwoWay}" help:PasswordBoxHelper.IsRightValue="{Binding IsRightValue, Mode=TwoWay}" Grid.ColumnSpan="2"></PasswordBox>
-                        <Button Style="{StaticResource DeletePasswordButtonStyle}" Grid.Column="1" HorizontalAlignment="Left" Command="{Binding ClearPasswordCommand}" Visibility="{Binding ClearPasswordButtonVisibility, Mode=TwoWay}"></Button>
+                        <PasswordBox
+                            Grid.ColumnSpan="2"
+                            help:PasswordBoxHelper.DisplayText="{Binding CheckPasswordMsg, Mode=TwoWay}"
+                            help:PasswordBoxHelper.IsRightValue="{Binding IsRightValue, Mode=TwoWay}"
+                            help:PasswordBoxHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                            PasswordChar="*"
+                            Style="{StaticResource CheckPasswordBoxStyle}" />
+                        <Button
+                            Grid.Column="1"
+                            HorizontalAlignment="Left"
+                            Command="{Binding ClearPasswordCommand}"
+                            Style="{StaticResource DeletePasswordButtonStyle}"
+                            Visibility="{Binding ClearPasswordButtonVisibility, Mode=TwoWay}" />
                     </Grid>
                     <Grid Grid.Row="2" Margin="0,2,0,0">
-                        <TextBlock Text="{Binding ErrorPasswordMsg, Mode=TwoWay}" Foreground="#F3465B" Visibility="{Binding ErrorPasswordMsgVisibility, Mode=TwoWay}"></TextBlock>
+                        <TextBlock
+                            Foreground="#F3465B"
+                            Text="{Binding ErrorPasswordMsg, Mode=TwoWay}"
+                            Visibility="{Binding ErrorPasswordMsgVisibility, Mode=TwoWay}" />
                     </Grid>
                 </Grid>
             </Grid>
         </cus:DialogContent.Content>
         <cus:DialogContent.BottmBar>
             <Grid Margin="16">
-                <StackPanel VerticalAlignment="Center" Height="32" Orientation="Horizontal" HorizontalAlignment="Right">
-                    <Button Width="67" Margin="0,0,16,0" Style="{StaticResource Btn.cta}" Command="{Binding ConfirmCommand}">
-                        <TextBlock Text="Open"></TextBlock>
+                <StackPanel
+                    Height="32"
+                    HorizontalAlignment="Right"
+                    VerticalAlignment="Center"
+                    Orientation="Horizontal">
+                    <Button
+                        Width="67"
+                        Margin="0,0,16,0"
+                        Command="{Binding ConfirmCommand}"
+                        IsDefault="True"
+                        Style="{StaticResource Btn.cta}">
+                        <TextBlock Text="Open" />
                     </Button>
-                    <Button Width="67" Style="{StaticResource btn.ghost}" Command="{Binding CancelCommand}">
-                        <TextBlock Text="Cancel"></TextBlock>
+                    <Button
+                        Width="67"
+                        Command="{Binding CancelCommand}"
+                        Style="{StaticResource btn.sec}">
+                        <TextBlock Text="Cancel" />
                     </Button>
                 </StackPanel>
             </Grid>

+ 32 - 23
PDF Office/Views/MainWindow.xaml

@@ -15,7 +15,6 @@
     Height="800"
     MinWidth="540"
     MinHeight="460"
-    PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
     d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
     prism:ViewModelLocator.AutoWireViewModel="True"
     Activated="Window_Activated"
@@ -23,6 +22,7 @@
     BorderThickness="2"
     Closed="Window_Closed"
     Closing="Window_Closing"
+    PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
     SizeChanged="Window_SizeChanged"
     Style="{StaticResource WindowStyle}"
     UseLayoutRounding="True"
@@ -31,19 +31,19 @@
     <Window.Resources>
         <ResourceDictionary>
             <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
-                <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
+                <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="False" />
                 <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv2}" />
                 <Setter Property="Template">
                     <Setter.Value>
                         <ControlTemplate TargetType="dragablz:DragablzItem">
-                            <Grid x:Name="templateRoot">
+                            <Grid x:Name="templateRoot" Background="Transparent">
                                 <Grid.ColumnDefinitions>
                                     <ColumnDefinition Width="*" />
                                     <ColumnDefinition Width="auto" />
                                 </Grid.ColumnDefinitions>
                                 <Border
                                     x:Name="Title"
-                                    Width="184"
+                                    Width="200"
                                     Height="34"
                                     Margin="4,6,0,2"
                                     BorderBrush="{StaticResource color.sys.border.neutral.lv3}"
@@ -70,8 +70,8 @@
                                                 Visibility="Collapsed" />
                                             <TextBlock
                                                 x:Name="TextTitle"
-                                                MaxWidth="145"
-                                                Margin="8,7"
+                                                MaxWidth="164"
+                                                Margin="8,7,0,7"
                                                 VerticalAlignment="Center"
                                                 FontFamily="Segoe UI,Microsoft YaHei"
                                                 Foreground="{TemplateBinding Foreground}"
@@ -105,13 +105,14 @@
                                             Visibility="{Binding DataContext.FileChanged}" />
                                         <Button
                                             Grid.Column="2"
-                                            Width="16"
-                                            Height="16"
-                                            Margin="0,4,8,4"
+                                            Width="12"
+                                            Height="12"
+                                            Margin="0,0,8,0"
                                             Background="Transparent"
                                             BorderThickness="0"
                                             Command="{Binding DataContext.CloseTab}"
-                                            CommandParameter="{Binding}">
+                                            CommandParameter="{Binding}"
+                                            Style="{StaticResource btn.selector}">
                                             <Path Data="M6.50006 7.06072L9.96973 10.5304L11.0304 9.46973L7.56072 6.00006L11.0304 2.53039L9.96973 1.46973L6.50006 4.9394L3.03039 1.46973L1.96973 2.53039L5.4394 6.00006L1.96973 9.46973L3.03039 10.5304L6.50006 7.06072Z" Fill="{StaticResource color.icon.base.neutral.norm.lv2}" />
                                         </Button>
 
@@ -195,6 +196,7 @@
             FocusVisualStyle="{x:Null}"
             ItemContainerStyle="{StaticResource DragablzItemStyle}"
             SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
+            ScrollViewer.HorizontalScrollBarVisibility="Auto"
             WindowChrome.IsHitTestVisibleInChrome="True">
             <dragablz:TabablzControl.InterTabController>
                 <dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
@@ -207,9 +209,9 @@
                     Margin="8,13,200,7"
                     Padding="0"
                     HorizontalAlignment="Left"
-                    Background="Transparent"
                     BorderThickness="0"
                     Command="{Binding AddTab}"
+                    Style="{StaticResource btn.selector}"
                     WindowChrome.IsHitTestVisibleInChrome="True">
                     <Path
                         Width="20"
@@ -224,7 +226,8 @@
                     Width="16"
                     Height="38"
                     Margin="0,0,0,0"
-                    Background="Transparent" />
+                    Background="Transparent"
+                    WindowChrome.IsHitTestVisibleInChrome="False" />
             </dragablz:TabablzControl.HeaderPrefixContent>
         </dragablz:TabablzControl>
         <!--  标题栏右侧栏,关闭按钮,会员,试用等  -->
@@ -233,21 +236,28 @@
             HorizontalAlignment="Right"
             Orientation="Horizontal"
             WindowChrome.IsHitTestVisibleInChrome="True">
-            <Grid x:Name="Grid_Openhight" Visibility="{Binding OphVis,Mode=OneWay}">
-                
+            <Grid x:Name="Grid_Openhight" IsVisibleChanged="Grid_Openhight_IsVisibleChanged" Visibility="{Binding OphVis, Mode=OneWay}">
+
                 <WrapPanel VerticalAlignment="Center">
-                    <Border VerticalAlignment="Center" Width="35" Height="28" Background=" #FFCF52" Margin="0,0,-4,0" CornerRadius="4" HorizontalAlignment="Left" />
+                    <Border
+                        Width="35"
+                        Height="28"
+                        Margin="0,0,-4,0"
+                        HorizontalAlignment="Left"
+                        VerticalAlignment="Center"
+                        Background=" #FFCF52"
+                        CornerRadius="4" />
 
 
-                    <Border VerticalAlignment="Center" >
+                    <Border VerticalAlignment="Center">
                         <Path Data="M0 4C0 1.79086 1.79086 0 4 0H132C134.209 0 136 1.79086 136 4V10.323C136 10.7319 136.249 11.0996 136.629 11.2514L141.179 13.0715C142.017 13.4068 142.017 14.5932 141.179 14.9285L136.629 16.7486C136.249 16.9004 136 17.2681 136 17.677V24C136 26.2091 134.209 28 132 28H4C1.79086 28 0 26.2091 0 24V4Z" Fill="#FFCF52" />
                     </Border>
-                    
+
                 </WrapPanel>
                 <TextBlock
-                     FontFamily="PingFang SC"
                     HorizontalAlignment="Center"
                     VerticalAlignment="Center"
+                    FontFamily="PingFang SC"
                     FontSize="14"
                     LineHeight="19.6"
                     Text="{Binding Msgtologin}" />
@@ -415,7 +425,6 @@
             <Border
                 Width="226"
                 Height="58"
-                
                 Background="{StaticResource color.sys.layout.dark.bg}"
                 BorderThickness="0"
                 CornerRadius="{StaticResource border-radius.8}"
@@ -428,13 +437,13 @@
                     <Button
                         Width="12"
                         Height="12"
+                        Padding="0,0,1,1"
                         HorizontalAlignment="Right"
                         VerticalAlignment="Top"
+                        Background="{StaticResource color.sys.layout.dark.bg}"
                         BorderThickness="0"
-                    Background="{StaticResource color.sys.layout.dark.bg}"
-                        Command="{Binding CloseOCRCommand}" 
-                         Padding="0,0,1,1">
-                        <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4"></Path>
+                        Command="{Binding CloseOCRCommand}">
+                        <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4" />
                     </Button>
                     <ProgressBar
                         Height="4"

+ 15 - 3
PDF Office/Views/MainWindow.xaml.cs

@@ -212,9 +212,7 @@ namespace PDF_Master.Views
 
         private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-            var width = StkPnlRight.ActualWidth;
-            BtnAdd.Margin = new Thickness(8,13,width,7);
-
+            UpdateTitleMargin();
             if (this.WindowState == WindowState.Maximized)
             {
                 ico_max.Visibility = Visibility.Collapsed;
@@ -225,6 +223,15 @@ namespace PDF_Master.Views
             }
         }
 
+        /// <summary>
+        /// 更新添加按钮的间隔位置
+        /// </summary>
+        private void UpdateTitleMargin()
+        {
+            var width = StkPnlRight.ActualWidth;
+            BtnAdd.Margin = new Thickness(8, 13, width, 7);
+        }
+
         private void TxtRename_PreviewKeyDown(object sender, KeyEventArgs e)
         {
             if(e.Key == Key.Enter)
@@ -256,5 +263,10 @@ namespace PDF_Master.Views
                 //}
             }
         }
+
+        private void Grid_Openhight_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+        {
+            UpdateTitleMargin();
+        }
     }
 }

+ 1 - 0
PDF Office/Views/PageEdit/PageEditContent.xaml

@@ -22,6 +22,7 @@
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
     FocusVisualStyle="{x:Null}"
+    Unloaded="PageEdit_Unloaded"
     IsVisibleChanged="PageEdit_IsVisibleChanged"
     SizeChanged="PageEdit_SizeChanged"
     mc:Ignorable="d">

+ 9 - 0
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -116,6 +116,7 @@ namespace PDF_Master.Views.PageEdit
             eventor = eventAggregator;
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
 
+            timer = new DispatcherTimer();
             timer.Interval = TimeSpan.FromSeconds(0.3);
             timer.Tick += Timer_Tick;
 
@@ -1014,5 +1015,13 @@ namespace PDF_Master.Views.PageEdit
             }
             viewModel.print(lists);
         }
+
+        private void PageEdit_Unloaded(object sender, RoutedEventArgs e)
+        {
+            //释放定时器 避免内存泄露
+            timer.Stop();
+            timer.Tick -= Timer_Tick;
+            timer = null;
+        }
     }
 }

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

@@ -21,6 +21,7 @@
     DragOver="UserControl_DragOver"
     Drop="UserControl_Drop"
     KeyDown="UserControl_KeyDown"
+    Unloaded="UserControl_Unloaded"
     mc:Ignorable="d">
 
     <i:Interaction.Triggers>

+ 5 - 0
PDF Office/Views/ViewContent.xaml.cs

@@ -327,5 +327,10 @@ namespace PDF_Master.Views
         {
             viewModel.ClosePropertyCommand.Execute();
         }
+
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            viewModel.CloseAutoSave();
+        }
     }
 }