Browse Source

综合-补充RegionNames 类逻辑,补充属性面板展开逻辑、补充BOTA展开逻辑

ZhouJieSheng 2 years ago
parent
commit
3785c4e205

+ 0 - 28
PDF Office/Model/HomePageToolsDialogs/HomePageExtractDialogModel.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model.HomePageToolsDialogs
-{
-    public class HomePageExtractDialogModel
-    {
-        /// <summary>
-        /// 页码 存入页码范围;
-        /// </summary>
-        public List<int> PageParm=new List<int> { };
-        /// <summary>
-        /// 页码 存入页码范围;
-        /// </summary>
-        public string PageRange="1,3-4,10";
-        /// <summary>
-        /// 是否拆分为单文件
-        /// </summary>
-        public bool ExtractToSingleFile=true;
-        /// <summary>
-        /// 提取后删除页面
-        /// </summary>
-        public bool DeleteAfterExtract=false;
-    }
-}

+ 0 - 22
PDF Office/Model/HomePageToolsDialogs/HomePageInsertDialogModel.cs

@@ -1,22 +0,0 @@
-using ComPDFKit.PDFDocument;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model.HomePageToolsDialogs
-{
-    public class HomePageInsertDialogModel
-    {
-        public string FilePath = "";
-        public int InsertIndex = 1;
-        public string Password = "";
-        public string InserPageRange(CPDFDocument doc) {
-            if (doc.PageCount < 1) { return ""; }
-            if (doc.PageCount == 1) { return "1"; }
-            return "1"+"-"+ doc.PageCount.ToString();
-        }
-
-    }
-}

+ 0 - 58
PDF Office/Model/HomePageToolsDialogs/HomePageSplitDialogModel.cs

@@ -1,58 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model.HomePageToolsDialogs
-{
-    public class HomePageSplitDialogModel
-    {
-
-        /// <summary>
-        /// 拆分模式
-        /// </summary>
-        public SplitMode Mode = SplitMode.AveragePages;
-        /// <summary>
-        /// 拆分模式份数或者页数
-        /// </summary>
-        public int GetModeCount = 1;
-        /// <summary>
-        /// 页面信息
-        /// </summary>
-        public string PageRange = "1,3-4,10";
-        /// <summary>
-        /// 文件名标签
-        /// </summary>
-        public string FileNameLabel = "part";
-        /// <summary>
-        /// 文件名与标签分隔符
-        /// </summary>
-        public string FileNameDeimiter = "-";
-        /// <summary>
-        /// 文件名与标签分隔符
-        /// </summary>
-        public bool FrontFileName = true;
-        /// <summary>
-        /// 页码 存入页码范围;
-        /// </summary>
-        public List<int> PageParm = new List<int> { };
-
-
-        public enum SplitMode
-        {
-            /// <summary>
-            /// 按页平均拆分
-            /// </summary>
-            AveragePages,
-            /// <summary>
-            /// 按文件平均拆分
-            /// </summary>
-            AverageFiles,
-            /// <summary>
-            /// 自定义页码范围拆分
-            /// </summary>
-            CustomPageRange
-        }
-    }
-}

+ 0 - 28
PDF Office/Model/MainPageToolsDialogs/MainPageExtractDialogModel.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model.MainPageToolsDialogs
-{
-    internal class MainPageExtractDialogModel
-    {
-        /// <summary>
-        /// 页码 存入页码范围;
-        /// </summary>
-        public List<int> PageParm;
-        /// <summary>
-        /// 自定模式下 把文本内容传过去
-        /// </summary>
-        public string PageName = "";
-        /// <summary>
-        /// 是否拆分为单文件
-        /// </summary>
-        public bool ExtractToSingleFile;
-        /// <summary>
-        /// 提取后删除页面
-        /// </summary>
-        public bool DeleteAfterExtract;
-    }
-}

+ 0 - 26
PDF Office/Model/MainPageToolsDialogs/MainPageInsertDialogModel.cs

@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model.MainPageToolsDialogs
-{
-    internal class MainPageInsertDialogModel
-    {
-        public class InsertEventClass : EventArgs
-        {
-            public InsertType Type;
-            public string filePath;
-            public string pageRange;
-            public int InsertIndex;
-            public string Password;
-        }
-
-        public enum InsertType
-        {
-            BlankPages,
-            FromOtherPdf
-        }
-    }
-}

+ 0 - 44
PDF Office/Model/MainPageToolsDialogs/MainPageSplitDialogModel.cs

@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model.MainPageToolsDialogs
-{
-    internal class MainPageSplitDialogModel
-    {
-        public class SplitEventClass : EventArgs
-        {
-            /// <summary>
-            /// 拆分模式
-            /// </summary>
-            public SplitMode Mode;
-            /// <summary>
-            /// 文件名
-            /// </summary>
-            public string FileName;
-            /// <summary>
-            /// 页面信息
-            /// </summary>
-            public string PageRange;
-
-        }
-
-        public enum SplitMode
-        {
-            /// <summary>
-            /// 按页平均拆分
-            /// </summary>
-            AveragePages,
-            /// <summary>
-            /// 按文件平均拆分
-            /// </summary>
-            AverageFiles,
-            /// <summary>
-            /// 自定义页码范围拆分
-            /// </summary>
-            CustomPageRange
-        }
-    }
-}

+ 107 - 0
PDF Office/Model/RegionNames.cs

@@ -1,16 +1,123 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.CompilerServices;
 using System.Text;
 using System.Threading.Tasks;
 
 namespace PDF_Office.Model
 {
+    /// <summary>
+    /// 存放公用模块的RegionName
+    /// </summary>
     public static class RegionNames
     {
         /// <summary>
         /// 最外层的Region名称
         /// </summary>
         public static string MainRegion = "MainRegion";
+
+        /// <summary>
+        /// 首页右侧快捷工具Content RegionName
+        /// </summary>
+        public static string ToolRegionName
+        {
+            get
+            {
+                return GetRegionName("ToolRegionName");
+            }
+        }
+
+        /// <summary>
+        /// 阅读页PDFViewer 对应的Content RegionName
+        /// </summary>
+        public static string ViwerRegionName
+        {
+            get
+            {
+                return GetRegionName("ViwerRegionName");
+            }
+        }
+
+        /// <summary>
+        /// BOTA内容项 对应的Content RegionName
+        /// </summary>
+        public static string BOTARegionName
+        {
+            get
+            {
+                return GetRegionName("BOTARegionName");
+            }
+        }
+
+        /// <summary>
+        /// 属性面板 对应的Content RegionName
+        /// </summary>
+        public static string PropertyRegionName
+        {
+            get
+            {
+                return GetRegionName("PropertyRegionName");
+            }
+        }
+
+        /// <summary>
+        /// 工具功能(页面编辑、水印、密文等)对应的Content RegionName
+        /// </summary>
+        public static string ToolContentRegionName
+        {
+            get
+            {
+                return GetRegionName("ToolContentRegionName");
+            }
+        }
+
+        /// <summary>
+        /// 工具菜单栏对应的Content RegionName
+        /// </summary>
+        public static string ToolsBarContentRegionName
+        {
+            get
+            {
+                return GetRegionName("ToolsBarContentRegionName");
+            }
+        }
+
+        /// <summary>
+        /// 获取MainWindowsViewModel RegionNames字典里的RegionName,
+        /// 如果字典里没有键值就新建一个GUID,并插入到
+        /// </summary>
+        /// <returns></returns>
+        public static string GetRegionName(string key)
+        {
+            if (App.mainWindowViewModel.SelectedItem.RegionContentNames.ContainsKey(key))
+            {
+                return App.mainWindowViewModel.SelectedItem.RegionContentNames[key];
+            }
+            else
+            {
+                string name = Guid.NewGuid().ToString();
+                App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = name;
+                return name;
+            }
+        }
+
+        /// <summary>
+        /// 如果不存在key,则插入key,并设置Value
+        /// 如果存在key,则更改Value
+        /// </summary>
+        public static void SetRegionName(string key, string Value)
+        {
+            if (App.mainWindowViewModel.SelectedItem.RegionContentNames.ContainsKey(key))
+            {
+                App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = Value;
+            }
+            else
+            {
+                App.mainWindowViewModel.SelectedItem.RegionContentNames[key] = Value;
+            }
+        }
+
+
     }
 }

+ 0 - 28
PDF Office/Styles/ToolsBtnStyle.xaml

@@ -1,28 +0,0 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-    <Style x:Key="ToolsBtnStyle" TargetType="{x:Type Button}">
-        <Setter Property="Background" Value="Transparent"/>
-        <Setter Property="BorderBrush" Value="Transparent"/>
-        <Setter Property="Width" Value="auto"/>
-        <Setter Property="Height" Value="40"/>
-        <Setter Property="Template">
-            <Setter.Value>
-                <ControlTemplate TargetType="{x:Type Button}">
-                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"   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">
-                            <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>
-                    </ControlTemplate.Triggers>
-                </ControlTemplate>
-            </Setter.Value>
-        </Setter>
-    </Style>
-</ResourceDictionary>

+ 0 - 22
PDF Office/Styles/ToolsMenuStyle.xaml

@@ -1,22 +0,0 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-    <Style x:Key="ToolsMenuStyle" TargetType="{x:Type MenuItem}">
-        <Setter Property="Background" Value="White"></Setter>
-        <Setter Property="Margin" Value="0,0,0,0"></Setter>
-        <Setter Property="Padding" Value="0,10,10,20"></Setter>
-            <Setter Property="Template">
-            <Setter.Value>
-                <ControlTemplate TargetType="{x:Type MenuItem}">
-                    <Border Padding="17,0,17,0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
-                        <ContentPresenter x:Name="ContentPresenter"  Content="{TemplateBinding Header}" Grid.Column="1" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
-                    </Border>
-                    <ControlTemplate.Triggers>
-                        <Trigger Property="IsMouseOver" Value="True">
-                            <Setter Property="Background" Value="whitesmoke"/>
-                        </Trigger>
-                    </ControlTemplate.Triggers>
-                </ControlTemplate>
-            </Setter.Value>
-        </Setter>
-    </Style>
-</ResourceDictionary>

File diff suppressed because it is too large
+ 0 - 268
PDF Office/UpgradeLog.htm


File diff suppressed because it is too large
+ 0 - 268
PDF Office/UpgradeLog2.htm


File diff suppressed because it is too large
+ 0 - 268
PDF Office/UpgradeLog3.htm


+ 7 - 4
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -25,7 +25,7 @@ namespace PDF_Office.ViewModels.BOTA
 
         private string botaContentRegionName;
 
-        public string BOTAContentRegionNmae
+        public string BOTAContentRegionName
         {
             get { return botaContentRegionName; }
             set
@@ -39,8 +39,10 @@ namespace PDF_Office.ViewModels.BOTA
         public BOTAContentViewModel(IRegionManager regionManager)
         {
             regions = regionManager;
-            
-            BOTAContentRegionNmae = Guid.NewGuid().ToString();
+
+            BOTAContentRegionName = Guid.NewGuid().ToString();
+
+            TabControlSelectionChangedCommand = new DelegateCommand<object>(TabControlSelectionChangedEvent);
 
             InitDictionartViewNameByTabItem();
         }
@@ -52,6 +54,7 @@ namespace PDF_Office.ViewModels.BOTA
             if (args != null)
             {
                 EnterSelectedBar((args.AddedItems[0] as TabItem).Name);
+                viewContentViewModel.OpenBOTA = true;
             }
         }
 
@@ -79,7 +82,7 @@ namespace PDF_Office.ViewModels.BOTA
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, pdfViewer);
-            regions.RequestNavigate(BOTAContentRegionNmae, viewNameByTabItem[currentBar], param);
+            regions.RequestNavigate(BOTAContentRegionName, viewNameByTabItem[currentBar], param);
         }
 
         #region Navigate

+ 1 - 1
PDF Office/ViewModels/HomeContentViewModel.cs

@@ -63,7 +63,7 @@ namespace PDF_Office.ViewModels
             toolregion = regionManager;
             eventer = eventAggregator;
 
-            ToolRegionName = Guid.NewGuid().ToString();
+            ToolRegionName = RegionNames.ToolRegionName;
             OpenFileCommand = new DelegateCommand(OpenFile);
             ShowToolCommand = new DelegateCommand<string>(ShowToolContent);
             CreateBlackPDFCommand = new DelegateCommand(CreatBlankPDF);

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

@@ -23,11 +23,6 @@ namespace PDF_Office.ViewModels
 {
     public class MainWindowViewModel : BindableBase
     {
-        /// <summary>
-        /// 当前选中项
-        /// </summary>
-        //public MainContent SelectedItem { get; set; }
-
         private MainContent selectedItem;
 
         public MainContent SelectedItem
@@ -57,7 +52,6 @@ namespace PDF_Office.ViewModels
             set { pdfViewer = value; }
         }
 
-
         public DelegateCommand AddTab { get; set; }
 
 
@@ -71,7 +65,12 @@ namespace PDF_Office.ViewModels
 
         public MainWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IContainerProvider container)
         {
-            App.mainWindowViewModel = this;
+            if (App.mainWindowViewModel == null)
+            {
+                //加载第一个窗体时 先赋值静态对象
+                App.mainWindowViewModel = this;
+            }
+
             region = regionManager;
 
             eventer = eventAggregator;

+ 42 - 5
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -153,6 +153,39 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private GridLength botaWidth = new GridLength(48);
+        /// <summary>
+        /// BOTA栏的宽度
+        /// </summary>
+        public GridLength BOTAWidth
+        {
+            get { return botaWidth; }
+            set
+            {
+                SetProperty(ref botaWidth, value);
+                if(botaWidth.Value<=48)
+                {
+                    OpenBOTA = false;
+                }
+            }
+        }
+
+        private bool openBOTA = false;
+        /// <summary>
+        /// 是否展开BOTA
+        /// </summary>
+        public bool OpenBOTA
+        {
+            get { return openBOTA; }
+            set { 
+                openBOTA = value; 
+                if(openBOTA)
+                {
+                    BOTAWidth = new GridLength(256);
+                }
+            }
+        }
+
 
         private Dictionary<string, string> regionNameByTabItem;
 
@@ -203,14 +236,14 @@ namespace PDF_Office.ViewModels
             RedoCommand = new DelegateCommand(Redo);
             TabControlSelectionChangedCommand = new DelegateCommand<object>(TabControlSelectonChangedEvent);
 
-            ViwerRegionName = Guid.NewGuid().ToString();
-            BOTARegionName = Guid.NewGuid().ToString();
-            PropertyRegionName = Guid.NewGuid().ToString();
+            ViwerRegionName = RegionNames.ViwerRegionName;
+            BOTARegionName = RegionNames.BOTARegionName;
+            PropertyRegionName = RegionNames.PropertyRegionName;
 
             //未显示时无法注册上Region名称
             ToolContentVisible = Visibility.Visible;
-            ToolContentRegionName = Guid.NewGuid().ToString();
-            ToolsBarContentRegionName = Guid.NewGuid().ToString();
+            ToolContentRegionName = RegionNames.ToolContentRegionName;
+            ToolsBarContentRegionName = RegionNames.ToolsBarContentRegionName;
 
             ToolContentVisible = Visibility.Collapsed;
             ToolsBarContentVisible = Visibility.Collapsed;
@@ -395,6 +428,10 @@ namespace PDF_Office.ViewModels
                 parameters.Add(ParameterNames.PDFViewer, PDFViewer);
                 parameters.Add(ParameterNames.ViewContentViewModel, this);
                 region.RequestNavigate(BOTARegionName, "BOTAContent",parameters);
+
+
+                //TODO 根据上一次关闭记录的菜单,选中TabItem
+                EnterSelectedBar("TabItemAnnotation");
             }
             ));
         }

+ 0 - 134
PDF Office/Views/HomePanel/QuickToolsContent.cs

@@ -1,134 +0,0 @@
-using PDF_Office.CustomControl;
-using PDF_Office.Helper;
-using PDF_Office.ViewModels.HomePanel;
-using PDF_Office.Views.HomePanel.PDFTools;
-using System.Collections.Generic;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Media;
-
-namespace PDF_Office.Views.HomePanel.PDFTools
-{
-    /// <summary>
-    /// HomeToolIControl.xaml 的交互逻辑0
-    /// 
-    /// </summary>
-    public partial class QuickToolsContent : UserControl
-    {
-
-        private List<QuickToolItem> allToolbars = null;
-        public QuickToolsContent()
-        {
-            InitializeComponent(); 
-             allToolbars = new List<QuickToolItem>();
-            string path = @"pack://application:,,,/Resources/PromotionIcon/Windows.png";
-            List<string> all = new List<string>() { "PDF转Word", "PDF转Excel", "PDF转PPT", "转档PDF", "OCR", "拆分",
-            "提取","合并","压缩","图片转PDF","安全", "水印", "页眉页脚","贝茨Bates码","批量处理","打印", "背景","插入","文件对比"};
-            for (int i = 0; i < 8; i++)
-            {
-                QuickToolItem aToolModule = new QuickToolItem();
-                aToolModule.Id = i + 1;
-                aToolModule.Name = all[i];
-                aToolModule.Image = path;
-                aToolModule.NameInfo = "Batch convert, compress, secure, watermark PDFs.";
-                allToolbars.Add(aToolModule);
-            }
-
-            ListBoxToolBars.ItemsSource = allToolbars;
-        }
-   
-
-        private void BtnMore_Click(object sender, RoutedEventArgs e)
-        {
-            if (GridAllTools.Height != 270)
-            {
-                GridAllTools.Height = 270;
-                ShowToolsUI(false);
-            }
-            else
-            {
-                GridAllTools.Height = 184;
-                ShowToolsUI(true);
-            }
-               
-        }
-
-        /// <summary>
-        /// 扩展收缩UI
-        /// </summary>
-        /// <param name="IsShowConciseContent">是否收缩</param>
-        private void ShowToolsUI(bool IsShowConciseContent)
-        {
-            foreach (var item in ListBoxToolBars.Items)
-            {
-               
-                var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
-                if (listBoxItem != null)
-                {
-                   
-                    var viewItem = listBoxItem.ContentTemplate;
-                    var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
-                    var obj = viewItem.FindName("data", myContentPresenter);
-
-                    var checkNum = obj as HomeToolItem;
-
-                    if (checkNum != null)
-                    {
-                        checkNum.IsShowConciseContent = IsShowConciseContent;
-                    }
-
-                }
-            }
-            
-        }
-
-      
-
-        /// <summary>
-        /// 编辑工具
-        /// </summary>
-        private void BtnTools_Click(object sender, RoutedEventArgs e)
-        {
-           
-        }
-
-        private void GridAllTools_SizeChanged(object sender, SizeChangedEventArgs e)
-        {
-            ListBoxToolBarsWidthChanged();
-        }
-
-
-        private void ListBoxToolBarsWidthChanged()
-        {
-            double containerWidth = ListBoxToolBars.ActualWidth - 20;
-            int widthItem = (int)containerWidth / 5;
-            double margin = widthItem / 3;
-
-            int i = 0;
-            foreach (var item in ListBoxToolBars.Items)
-            {
-                i++;
-                var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
-                if (listBoxItem != null)
-                {
-                    if (i % 4 != 0)
-                    {
-                        listBoxItem.Margin = new Thickness(0, 0, margin, 20);
-
-                    }
-                    else
-                    {
-                        listBoxItem.Margin = new Thickness(0, 0, 0, 20);
-                    }
-                    listBoxItem.Width = widthItem;
-                }
-            }
-        }
-
-        private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
-        {
-           
-        }
-    }
-
-}

+ 0 - 365
PDF Office/Views/HomePanel/QuickToolsContent.xaml

@@ -1,365 +0,0 @@
-<UserControl
-    x:Class="PDF_Office.Views.HomePanel.PDFTools.QuickToolsContent"
-    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:local="clr-namespace:PDF_Office.Views.HomePanel"
-    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
-    xmlns:Converter="clr-namespace:PDF_Office.DataConvert"
-    xmlns:homePanel="clr-namespace:PDF_Office.Views.HomePanel"
-    d:DesignHeight="450"
-    d:DesignWidth="800"
-    mc:Ignorable="d">
-    <UserControl.Resources>
-
-        <Style x:Key="LabelSty"
-               TargetType="{x:Type Label}">
-            <Setter Property="Padding"
-                    Value="10,5" />
-            <Setter Property="Background"
-                    Value="CadetBlue" />
-            <Setter Property="Foreground"
-                    Value="White" />
-        </Style>
-        <Style x:Key="FocusVisual">
-            <Setter Property="Control.Template">
-                <Setter.Value>
-                    <ControlTemplate>
-                        <Rectangle Margin="0"
-                                   SnapsToDevicePixels="true"
-                                   Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
-                                   StrokeDashArray="1 2"
-                                   StrokeThickness="0" />
-                    </ControlTemplate>
-                </Setter.Value>
-            </Setter>
-        </Style>
-        <!--  set SelectedBackgroundColor to Transparent when you do not need the background in selected items  -->
-        <Color x:Key="SelectedBackgroundColor">LightBlue</Color>
-        <Color x:Key="SelectedUnfocusedColor">AliceBlue</Color>
-
-        <!--  set the MouseOverColor to Transparent when you do not need the effect in the unselected items  -->
-        <Color x:Key="MouseOverColor">LightBlue</Color>
-        <SolidColorBrush x:Key="Item.MouseOver.Background"
-                         Color="LightBlue" />
-        <SolidColorBrush x:Key="Item.MouseOver.Border"
-                         Color="LightBlue" />
-        <SolidColorBrush x:Key="Item.SelectedInactive.Background"
-                         Color="AliceBlue" />
-        <SolidColorBrush x:Key="Item.SelectedInactive.Border"
-                         Color="AliceBlue" />
-        <SolidColorBrush x:Key="Item.SelectedActive.Background"
-                         Color="Beige" />
-        <SolidColorBrush x:Key="Item.SelectedActive.Border"
-                         Color="Beige" />
-        <Style x:Key="ListBoxItemStyle"
-               TargetType="{x:Type customControl:ListItemQuickTool}">
-            <Setter Property="SnapsToDevicePixels"
-                    Value="True" />
-            <Setter Property="FocusVisualStyle"
-                    Value="{x:Null}" />
-            <!-- 导致模块闪烁,并且时有时无
-            <EventSetter Event="DragLeave"
-                         Handler="MyListBoxItem_DragLeave">
-            </EventSetter>-->
-            <Setter Property="Template">
-                <Setter.Value>
-                    <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
-                        <!--Width="230"  Margin="50,20,0,10"-->
-                        <Border x:Name="Border"
-                                Margin="0,0,0,30"
-                               
-                                Background="AliceBlue"
-                                SnapsToDevicePixels="true">
-                            <ContentPresenter />
-                        </Border>
-                        <ControlTemplate.Triggers>
-
-                            <MultiTrigger>
-                                <MultiTrigger.Conditions>
-                                    <Condition Property="IsOverModular"
-                                               Value="True" />
-                                </MultiTrigger.Conditions>
-                                <Setter TargetName="Border"
-                                        Property="Background"
-                                        Value="{StaticResource Item.MouseOver.Background}" />
-                                <Setter TargetName="Border"
-                                        Property="BorderBrush"
-                                        Value="{StaticResource Item.MouseOver.Border}" />
-                            </MultiTrigger>
-                            <!--<MultiTrigger>
-                                <MultiTrigger.Conditions>
-                            -->
-                            <!--<Condition Property="DragLeave"
-                                               Value="True" />-->
-                            <!--
-                                    <Condition Property="IsFilePicked"
-                                               Value="False" />
-                                </MultiTrigger.Conditions>
-                                <Setter TargetName="Border"
-                                        Property="Background"
-                                        Value="AliceBlue" />
-                                <Setter TargetName="Border"
-                                        Property="BorderBrush"
-                                        Value="AliceBlue" />
-                            </MultiTrigger>-->
-
-                            <!--<MultiTrigger>
-                                <MultiTrigger.Conditions>
-                                    <Condition Property="IsMouseOver"
-                                               Value="True" />
-                                </MultiTrigger.Conditions>
-                                <Setter TargetName="Border"
-                                        Property="Background"
-                                        Value="{StaticResource Item.MouseOver.Background}" />
-                                <Setter TargetName="Border"
-                                        Property="BorderBrush"
-                                        Value="{StaticResource Item.MouseOver.Border}" />
-                            </MultiTrigger>-->
-                            <!--<MultiTrigger>
-                                <MultiTrigger.Conditions>
-                                    <Condition Property="Selector.IsSelectionActive"
-                                               Value="False" />
-                                    <Condition Property="IsSelected"
-                                               Value="True" />
-                                </MultiTrigger.Conditions>
-                                <Setter TargetName="Border"
-                                        Property="Background"
-                                        Value="{StaticResource Item.SelectedInactive.Background}" />
-                                <Setter TargetName="Border"
-                                        Property="BorderBrush"
-                                        Value="{StaticResource Item.SelectedInactive.Border}" />
-                            </MultiTrigger>
-                            <MultiTrigger>
-                                <MultiTrigger.Conditions>
-                                    <Condition Property="Selector.IsSelectionActive"
-                                               Value="True" />
-                                    <Condition Property="IsSelected"
-                                               Value="True" />
-                                </MultiTrigger.Conditions>
-                                <Setter TargetName="Border"
-                                        Property="Background"
-                                        Value="{StaticResource Item.SelectedActive.Background}" />
-                                <Setter TargetName="Border"
-                                        Property="BorderBrush"
-                                        Value="{StaticResource Item.SelectedActive.Border}" />
-                            </MultiTrigger>
-                            <Trigger Property="IsEnabled"
-                                     Value="False">
-                                <Setter TargetName="Border"
-                                        Property="TextElement.Foreground"
-                                        Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
-                            </Trigger>-->
-                        </ControlTemplate.Triggers>
-                    </ControlTemplate>
-                </Setter.Value>
-            </Setter>
-            <Style.Triggers />
-        </Style>
-
-        <Style x:Key="MoreListBoxItemStyle"
-               TargetType="{x:Type customControl:ListItemQuickTool}">
-            <Setter Property="SnapsToDevicePixels"
-                    Value="True" />
-            <Setter Property="Template">
-                <Setter.Value>
-                    <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
-                        <Border x:Name="Border"  Margin="0,0,0,0"
-                                Background="LightGray"
-                                SnapsToDevicePixels="False">
-                            <ContentPresenter />
-                        </Border>
-                        <ControlTemplate.Triggers>
-                            <MultiTrigger>
-                                <MultiTrigger.Conditions>
-                                    <Condition Property="IsSelected"
-                                               Value="true" />
-                                </MultiTrigger.Conditions>
-                                <MultiTrigger.Setters>
-                                    <Setter TargetName="Border"
-                                            Property="Background"
-                                            Value="LightGoldenrodYellow" />
-                                </MultiTrigger.Setters>
-                            </MultiTrigger>
-                        </ControlTemplate.Triggers>
-                    </ControlTemplate>
-                </Setter.Value>
-            </Setter>
-        </Style>
-
-        <Converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
-        <DataTemplate x:Key="DataTemplate">
-            <homePanel:HomeToolItem x:Name="data"/>
-        </DataTemplate>
-        <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
-            <WrapPanel AllowDrop="True"
-                       Orientation="Horizontal" />
-        </ItemsPanelTemplate>
-    </UserControl.Resources>
-    <Grid Grid.ColumnSpan="2" Margin="0,0,20,0">
-        <Grid.RowDefinitions>
-            <RowDefinition Height="Auto"/>
-            <RowDefinition Height="*"/>
-        </Grid.RowDefinitions>
-        <TextBlock
-                x:Name="TxbQuickToolsTitle"
-                Margin="0,0,0,16"
-                FontSize="24"
-                FontWeight="SemiBold"
-                Text="Quick Tools" />
-
-
-        <StackPanel
-            x:Name="PnlToolsUIBtns" Grid.ColumnSpan="2"
-            Grid.Column="0" 
-            Margin="0,0,12,0"
-            HorizontalAlignment="Right"
-            VerticalAlignment="Top"
-            Orientation="Horizontal"
-            Visibility="Visible">
-
-            <Button
-                x:Name="BtnTools"
-                Width="68"
-                Height="28"
-                Margin="0,0,0,0"
-                Background="#FFFFFF"
-                Content="Tools"
-                Click="BtnTools_Click"
-               >
-
-            </Button>
-
-
-            <Button
-                x:Name="BtnMore"
-                Width="28"
-                Height="28"
-                Margin="12,0,0,0"
-                 Background="#FFFFFF" BorderThickness="0" Content="..."
-                Click="BtnMore_Click"
-               >
-            </Button>
-
-        </StackPanel>
-
-        <Grid
-                x:Name="GridAllTools"
-                Grid.Row="1" Height="270"
-                SizeChanged="GridAllTools_SizeChanged">
-
-            <customControl:ListBoxEx x:Name="ListBoxToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
-                        Grid.Row="3"
-                        AllowDrop="True"
-                        BorderThickness="0"
-                        SizeChanged="ListBoxShortCuts_SizeChanged"
-                        ItemContainerStyle="{StaticResource MoreListBoxItemStyle}"
-                        ItemTemplate="{StaticResource DataTemplate}"
-                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
-                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Single" />
-
-
-            <!--<WrapPanel Visibility="Collapsed"
-                    x:Name="Pnlwrap"
-                    MinWidth="230"
-                    HorizontalAlignment="Left"
-                    IsEnabled="True">
-
-                <local:HomeToolItem x:Name="ToolItemBatch"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Batch convert, compress, secure, watermark PDFs."
-                        ToolTitile="Batch" />
-
-                <local:HomeToolItem x:Name="ToolItemOCR"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Convert PDFs to Word/ HTML/ TXT/ JPEG/ PNG files."
-                        ToolTitile="OCR" />
-
-                <local:HomeToolItem x:Name="ToolItemConvertPDF"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
-                        ToolTitile="Convert PDF" />
-
-                <local:HomeToolItem x:Name="ToolItemImageToPDF"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
-                        ToolTitile="Image To PDF" />
-
-                <local:HomeToolItem x:Name="ToolItemMergePDF"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
-                        ToolTitile="Merge PDF"
-                        />
-
-                <local:HomeToolItem x:Name="ToolItemCompressPDF"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Convert JPEG/ JPG/ PNG/ TIFF/ BMP/ PSD files to PDFs."
-                        ToolTitile="Compress PDF" />
-
-                <local:HomeToolItem x:Name="ToolItemSecurity"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Convert PDFs to Word, Fonts  formatting get converted."
-                        ToolTitile="Security" />
-
-                <local:HomeToolItem x:Name="ToolItem1"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="QuickTools_ToolMergeInfo"
-                        ToolTitile="QuickTools_ToolMerge" />
-
-                <local:HomeToolItem x:Name="ToolItem2"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
-                        ToolTitile="Compare PDF" />
-
-                <local:HomeToolItem x:Name="ToolItem3"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
-                        ToolTitile="QuickTools_ToolImageToPDF"
-                        Visibility="Collapsed" />
-
-                <local:HomeToolItem x:Name="ToolItem4"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="QuickTools_ToolSecurityInfo"
-                        ToolTitile="QuickTools_ToolSecurity"
-                        Visibility="Collapsed" />
-
-                <local:HomeToolItem x:Name="ToolItem5"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="QuickTools_ToolWatermarkInfo"
-                        ToolTitile="QuickTools_ToolWatermark"
-                        Visibility="Visible" />
-
-                <local:HomeToolItem x:Name="ToolItem6"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="QuickTools_ToolHeaderFooterInfo"
-                        ToolTitile="QuickTools_ToolHeaderFooter"
-                        Visibility="Visible" />
-
-                <local:HomeToolItem x:Name="ToolItem7"
-                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
-                        ToolInfo="QuickTools_ToolBatesInfo"
-                        ToolTitile="QuickTools_ToolBates"
-                        Visibility="Visible" />
-
-            </WrapPanel>-->
-
-        </Grid>
-
-    </Grid>
-</UserControl>

+ 7 - 0
PDF Office/Views/MainContent.xaml.cs

@@ -29,9 +29,16 @@ namespace PDF_Office.Views
         /// </summary>
         public string Unicode { get; set; }
 
+        /// <summary>
+        /// 保存单个页签内各ContentRegionName的Value
+        /// 方便不同跨模块控制Region导肮
+        /// </summary>
+        public Dictionary<string, string> RegionContentNames { get; set; }
+
         public MainContent()
         {
             InitializeComponent();
+            RegionContentNames = new Dictionary<string, string>();
             Unicode = Guid.NewGuid().ToString();
         }
     }

+ 1 - 0
PDF Office/Views/MainWindow.xaml.cs

@@ -72,6 +72,7 @@ namespace PDF_Office.Views
         private void Window_Activated(object sender, EventArgs e)
         {
             App.Current.MainWindow = this;
+            App.mainWindowViewModel = this.DataContext as MainWindowViewModel;
             aggregator?.GetEvent<DragablzWindowEvent>().Publish(new DragablzWindowEventArgs() { TabControl = TabablzControl, Type = DragablzWindowEventType.Activated });
         }
 

+ 0 - 64
PDF Office/Views/Tool/ToolsContent.xaml

@@ -1,64 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.Tools.ToolsContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/"   
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels" xmlns:tools="clr-namespace:PDF_Office.ViewModels.Tools" d:DataContext="{d:DesignInstance Type=tools:ToolsContentViewModel}"
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             d:DesignHeight="40"
-             d:DesignWidth="800"
-             mc:Ignorable="d">
-    <UserControl.Resources>
-        <ResourceDictionary>
-            <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../Styles/ToolsBtnStyle.xaml"/>
-                <ResourceDictionary Source="../../Styles/ToolsMenuStyle.xaml"/>
-            </ResourceDictionary.MergedDictionaries>
-        </ResourceDictionary>
-    </UserControl.Resources>
-    <Grid>
-        <Border x:Name="ToolsBorder" BorderBrush="#1A000000" BorderThickness="0,1,0,1" Height="40">
-            <Grid>
-                <WrapPanel Height="40" HorizontalAlignment="Center">
-                    <Button x:Name="btnCompress" Style="{StaticResource ToolsBtnStyle}"  Command="{Binding CompressCommand}">
-                        <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
-                            <StackPanel Margin="0,0,8,0">
-                                <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                            </StackPanel >
-                            <TextBlock Text="压缩"  VerticalAlignment="Center"></TextBlock>
-                        </StackPanel>
-                    </Button>
-                    
-                    <Menu Background="White">
-                        <MenuItem x:Name="btnPassword" Height="40" Padding="0" Width="auto" BorderThickness="0" >
-                            <MenuItem.Header>
-                                <StackPanel Orientation="Horizontal" Margin="12 0 12 0" VerticalAlignment="Center">
-                                    <StackPanel Margin="0,0,8,0" VerticalAlignment="Center">
-                                        <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                                    </StackPanel >
-                                    <TextBlock x:Name="txtPassword" Padding="0,12,0,0" Text="安全" Height="40" FontSize="12"/>
-                                    <Path Fill="Black" VerticalAlignment="Center" HorizontalAlignment="Right" Data="M0 0L4 4L8 0H0Z">
-                                        <Path.RenderTransform>
-                                            <TranslateTransform X="8"/>
-                                        </Path.RenderTransform>
-                                    </Path>
-                                </StackPanel>
-                            </MenuItem.Header>
-                            <MenuItem Name="MenuEncrypt" Style="{StaticResource ToolsMenuStyle}">
-                                <MenuItem.Header>
-                                    <TextBlock Text="设置密码" ></TextBlock>
-                                </MenuItem.Header>
-                            </MenuItem>
-                            <MenuItem Name="MenuDecrypt"  Style="{StaticResource ToolsMenuStyle}">
-                                <MenuItem.Header>
-                                <TextBlock Text="解除安全性设置"></TextBlock>
-                                </MenuItem.Header>
-                            </MenuItem>
-                        </MenuItem>
-                    </Menu>
-                </WrapPanel>
-            </Grid>
-        </Border>
-    </Grid>
-</UserControl>

+ 0 - 15
PDF Office/Views/Tool/ToolsContent.xaml.cs

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

+ 18 - 3
PDF Office/Views/ViewContent.xaml

@@ -153,7 +153,7 @@
             <Grid.ColumnDefinitions>
                 <ColumnDefinition
                     x:Name="BOTACloumn"
-                    Width="48"
+                    Width="{Binding BOTAWidth, Mode=TwoWay}"
                     MinWidth="48"
                     MaxWidth="400" />
                 <ColumnDefinition Width="12" />
@@ -162,8 +162,22 @@
                     Width="*"
                     MinWidth="200" />
                 <ColumnDefinition Width="12" />
-                <ColumnDefinition Name="PropertyColumn" Width="0" />
+                <ColumnDefinition Name="PropertyColumn" MinWidth="0">
+                    <ColumnDefinition.Style>
+                        <Style TargetType="{x:Type ColumnDefinition}">
+                            <Style.Triggers>
+                                <DataTrigger Binding="{Binding ElementName=TbtnProperty, Path=IsChecked}" Value="True">
+                                    <Setter Property="Width" Value="256" />
+                                </DataTrigger>
+                                <DataTrigger Binding="{Binding ElementName=TbtnProperty, Path=IsChecked}" Value="False">
+                                    <Setter Property="Width" Value="0" />
+                                </DataTrigger>
+                            </Style.Triggers>
+                        </Style>
+                    </ColumnDefinition.Style>
+                </ColumnDefinition>
             </Grid.ColumnDefinitions>
+
             <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
             <GridSplitter
                 Grid.Column="1"
@@ -176,7 +190,7 @@
                 Grid.Column="2"
                 HorizontalAlignment="Stretch"
                 prism:RegionManager.RegionName="{Binding ViwerRegionName}" />
-            <Button Grid.Column="3" />
+            <ToggleButton Name="TbtnProperty" Grid.Column="3" />
             <ContentControl Grid.Column="4" prism:RegionManager.RegionName="{Binding PropertyRegionName}" />
         </Grid>
         <local:BottomToolContent Grid.Row="3" />
@@ -191,6 +205,7 @@
 
         <cus:LoadingControl Grid.RowSpan="3" Visibility="{Binding IsLoading}" />
 
+        <!--  专门用来显示菜单二级工具栏  -->
         <ContentControl
             Name="ContentToolsBar"
             Grid.Row="{Binding GridToolRow}"