liuaoran 2 vuotta sitten
vanhempi
commit
a6109bf58e

+ 66 - 12
PDF Office/Model/EditTools/Background/BackgroundCreateModel.cs

@@ -19,12 +19,48 @@ namespace PDF_Office.Model.EditTools.Background
 
     public class BackgroundInfo
     {
-        public byte[] Color { get; set; }
-        public int Rotation { get; set; }
-        public byte Opacity { get; set; }
-        public bool IsRelativeRatio { get; set; }
-        public int RelativeRatio { get; set; }
-        public int Scale { get; set; }
+        /// <summary>
+        /// 背景类型
+        /// </summary>
+        public C_Background_Type BackgroundType = C_Background_Type.BG_TYPE_COLOR;
+
+
+
+        /// <summary>
+        /// 纯色背景颜色
+        /// </summary>
+        public byte[] Color;
+
+        /// <summary>
+        /// 图片背景数据
+        /// </summary>
+        public byte[] ImageArray;
+
+        /// <summary>
+        /// 背景旋转角度
+        /// </summary>
+        public float Rotation;
+        
+        /// <summary>
+        /// 背景透明度
+        /// </summary>
+        public byte Opacity;
+        
+        /// <summary>
+        /// 是否相对比例
+        /// </summary>
+        public bool IsRelativeRatio;
+        
+        /// <summary>
+        ///相对比例大小 
+        /// </summary>
+        public int RelativeRatio;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int Scale;
+
         /// <summary>
         /// 背景相对垂直距离;
         /// </summary>
@@ -35,13 +71,31 @@ namespace PDF_Office.Model.EditTools.Background
         /// </summary>
         public float HorizOffset = 0;
 
-        public int ImageWidth { get; set; }
-        public int ImageHeight { get; set; }
+        /// <summary>
+        /// 图片背景:宽度
+        /// </summary>
+        public int ImageWidth;
+            
+        /// <summary>
+        /// 图片背景:长度
+        /// </summary>
+        public int ImageHeight;
+
+        /// <summary>
+        ///垂直位置
+        /// </summary>
+        public C_Background_Vertalign Vertalign;
+
+        /// <summary>
+        /// 水平位置
+        /// </summary>
+        public C_Background_Horizalign Horizalign;
 
+
+        /// <summary>
+        /// 页码范围
+        /// </summary>
         public string PageRange = "0";
-        public C_Background_Vertalign Vertalign { get; set; }
-        public C_Background_Horizalign Horizalign { get; set; }
-        public C_Background_Type BackgroundType { get; set; }
-        public byte[] ImageArray { get; set; }
+
     }
 }

+ 25 - 11
PDF Office/ViewModels/EditTools/Background/BackgroundCreateColorContentViewModel.cs

@@ -110,13 +110,13 @@ namespace PDF_Office.ViewModels.EditTools.Background
         }
 
         private string _horizontalOffset = "0";
-        public string HorizontalOffset
+        public string HorizontalOffsetValue
         {
             get { return _horizontalOffset; }
             set
             {
                 SetProperty(ref _horizontalOffset, value);
-                BackgroundInfo.HorizOffset = float.Parse(HorizontalOffset);
+                BackgroundInfo.HorizOffset = float.Parse(HorizontalOffsetValue);
                 eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
             }
         }
@@ -169,7 +169,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
             {
                 SetProperty(ref _pageRangeSelectIndex, value);
                 EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref BackgroundInfo.PageRange, PageRangeText);
-                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo); 
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
             }
         }
 
@@ -265,20 +265,34 @@ namespace PDF_Office.ViewModels.EditTools.Background
             }
         }
 
+        public void ConvertInfoToItem(ref BackgroundItem backgroundItem, BackgroundInfo backgroundInfo)
+        {
+            backgroundItem.type = backgroundInfo.BackgroundType;
+            backgroundItem.bgColor = backgroundInfo.Color;
+            backgroundItem.pageRange = backgroundInfo.PageRange;
+            backgroundItem.horizalign = backgroundInfo.Horizalign;
+            backgroundItem.vertalign = backgroundInfo.Vertalign;
+            backgroundItem.vertOffset = backgroundInfo.VertOffset;
+            backgroundItem.horizalign = backgroundInfo.Horizalign;
+            backgroundItem.opacity = backgroundInfo.Opacity;
+            backgroundItem.rotation = backgroundInfo.Rotation;
+            backgroundItem.scale = backgroundInfo.Scale;
+          //  backgroundItem.pagRangeMode = backgroundInfo.PageRange;
+        }
+
         public void SaveCurrentTemplate()
         {
-                var backgroundItem = new BackgroundItem();
-                backgroundItem.pageRange = "0";
-                backgroundItem.type = ComPDFKit.PDFDocument.C_Background_Type.BG_TYPE_COLOR;
-                backgroundItem.templateName += Settings.Default.BackgroundIndex.ToString();
-                Settings.Default.BackgroundTemplateList.Add(backgroundItem);
-                Settings.Default.Save();
-                this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(EnumTemplateListOrCreate.StatusTemplate);
+            var backgroundItem = new BackgroundItem();
+            ConvertInfoToItem(ref backgroundItem, BackgroundInfo);
+            backgroundItem.templateName += Settings.Default.WatermarkIndex.ToString();
+            Settings.Default.BackgroundTemplateList.Add(backgroundItem);
+            Settings.Default.Save();
+            this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(EnumTemplateListOrCreate.StatusTemplate);
         }
 
         public void SaveBackgroundTemplate(EnumColorOrFile enumColorOrFile)
         {
-            if(enumColorOrFile == EnumColorOrFile.StatusColor)
+            if (enumColorOrFile == EnumColorOrFile.StatusColor)
             {
                 SaveCurrentTemplate();
             }

+ 67 - 18
PDF Office/ViewModels/EditTools/Background/BackgroundCreateFileContentViewModel.cs

@@ -56,30 +56,64 @@ namespace PDF_Office.ViewModels.EditTools.Background
             }
         }
 
-        private int _rotationNumber = 0;
-        public int RotationNumber
+        private int _rotationValue = 0;
+        public int RotationValue
         {
-            get { return _rotationNumber; }
+            get { return _rotationValue; }
             set
             {
-                SetProperty(ref _rotationNumber, value);
+                SetProperty(ref _rotationValue, value);
+                BackgroundInfo.Rotation = ((float)RotationValue / 180) * 3.1415926f;
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
             }
         }
 
-        private int _opacityNumber = 100;
-        public int OpacityNumber
+
+        private int _opacityValue = 100;
+        public int OpacityValue
+        {
+            get { return _opacityValue; }
+            set
+            {
+                SetProperty(ref _opacityValue, value);
+                BackgroundInfo.Opacity = (byte)(((float)OpacityValue / 100) * 225);
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
+            }
+        }
+
+        private int _relativeRatioValue = 0;
+        public int RelativeRatioValue
         {
-            get { return _opacityNumber; }
-            set { SetProperty(ref _opacityNumber, value); }
+            get { return _relativeRatioValue; }
+            set { SetProperty(ref _relativeRatioValue, value); }
         }
 
-        private int _relativeRatioNumber = 0;
-        public int RelativeRatioNumber
+        private string _verticalOffsetValue = "0";
+        public string VerticalOffsetValue
         {
-            get { return _relativeRatioNumber; }
-            set { SetProperty(ref _rotationNumber, value); }
+            get { return _verticalOffsetValue; }
+            set
+            {
+                SetProperty(ref _verticalOffsetValue, value);
+                BackgroundInfo.VertOffset = float.Parse(VerticalOffsetValue);
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
+            }
         }
 
+        private string _horizOffsetValue = "0";
+        public string HorizontalOffsetValue
+        {
+            get { return _horizOffsetValue; }
+            set
+            {
+                SetProperty(ref _horizOffsetValue, value);
+                BackgroundInfo.HorizOffset = float.Parse(HorizontalOffsetValue);
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
+            }
+        }
+
+
+
         private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
         public ObservableDictionary<string, bool> GetLocationFromNumber
         {
@@ -118,7 +152,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
         public BackgroundCreateFileContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
-
+            BackgroundInfo.BackgroundType = C_Background_Type.BG_TYPE_IMAGE;
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             InitComponent();
             BackgroundInfo.Horizalign = C_Background_Horizalign.BG_HORIZALIGN_CENTER;
@@ -200,6 +234,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
             {
                 BackgroundInfo.Vertalign = (C_Background_Vertalign)(int.Parse(args) / 10);
                 BackgroundInfo.Horizalign = (C_Background_Horizalign)(int.Parse(args) % 10);
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
                 InitLocationButtonMatrix();
             }
         }
@@ -222,6 +257,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
                     EditToolsHelper.ChooseFile(dlg.FileName, ref BackgroundInfo);
                 }
                 CreateModFileVisible = Visibility.Visible;
+                eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
             }
         }
 
@@ -241,12 +277,26 @@ namespace PDF_Office.ViewModels.EditTools.Background
             document.Release();
         }
 
+        public void ConvertInfoToItem(ref BackgroundItem backgroundItem, BackgroundInfo backgroundInfo)
+        {
+            backgroundItem.type = backgroundInfo.BackgroundType;
+            backgroundItem.bgColor = backgroundInfo.Color;
+            backgroundItem.pageRange = backgroundInfo.PageRange;
+            backgroundItem.horizalign = backgroundInfo.Horizalign;
+            backgroundItem.vertalign = backgroundInfo.Vertalign;
+            backgroundItem.vertOffset = backgroundInfo.VertOffset;
+            backgroundItem.horizalign = backgroundInfo.Horizalign;
+            backgroundItem.opacity = backgroundInfo.Opacity;
+            backgroundItem.rotation = backgroundInfo.Rotation;
+            backgroundItem.scale = backgroundInfo.Scale;
+            //  backgroundItem.pagRangeMode = backgroundInfo.PageRange;
+        }
+
         public void SaveCurrentTemplate()
         {
             var backgroundItem = new BackgroundItem();
-            backgroundItem.pageRange = "0";
-            backgroundItem.type = ComPDFKit.PDFDocument.C_Background_Type.BG_TYPE_IMAGE;
-            backgroundItem.templateName += Settings.Default.BackgroundIndex.ToString();
+            ConvertInfoToItem(ref backgroundItem, BackgroundInfo);
+            backgroundItem.templateName += Settings.Default.WatermarkIndex.ToString();
             Settings.Default.BackgroundTemplateList.Add(backgroundItem);
             Settings.Default.Save();
             this.eventAggregator.GetEvent<EnterTemplateListOrCreateEvent>().Publish(EnumTemplateListOrCreate.StatusTemplate);
@@ -254,12 +304,11 @@ namespace PDF_Office.ViewModels.EditTools.Background
 
         public void SaveBackgroundTemplate(EnumColorOrFile enumColorOrFile)
         {
-            if (enumColorOrFile == EnumColorOrFile.StatusFile)
+            if (enumColorOrFile == EnumColorOrFile.StatusColor)
             {
                 SaveCurrentTemplate();
             }
         }
-
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;

+ 3 - 2
PDF Office/ViewModels/EditTools/Background/BackgroundDocumentContentViewModel.cs

@@ -65,6 +65,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
         public void SetBackground(BackgroundInfo backgroundInfo)
         {
             this.backgroundInfo = backgroundInfo;
+            CreateBackground(PDFViewer.Document);
             PDFViewer.InvalidChildVisual(false);
         }
 
@@ -76,7 +77,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
                 if (backgroundInfo.BackgroundType == C_Background_Type.BG_TYPE_COLOR)
                 {
                     background.SetBackgroundType(C_Background_Type.BG_TYPE_COLOR);
-                    background.SetColor(backgroundInfo.Color);
+                     background.SetColor(backgroundInfo.Color);
                 }
                 else
                 {
@@ -85,7 +86,6 @@ namespace PDF_Office.ViewModels.EditTools.Background
                 }
 
                 background.SetScale(1);
-                background.SetColor(backgroundInfo.Color);
                 background.SetRotation(backgroundInfo.Rotation);
                 background.SetOpacity(backgroundInfo.Opacity);
                 background.SetVertalign(backgroundInfo.Vertalign);
@@ -127,6 +127,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
                 }
             }
         }
+
         private WriteableBitmap GetWaterMark(CPDFDocument oldDoc, double zoom, int pageIndex)
         {
             Size pageSize = oldDoc.GetPageSize(pageIndex);

+ 45 - 1
PDF Office/ViewModels/EditTools/Background/BackgroundTemplateListColorContentViewModel.cs

@@ -1,4 +1,5 @@
 using PDF_Office.EventAggregators;
+using PDF_Office.Model.EditTools.Background;
 using PDF_Office.Properties;
 using PDFSettings;
 using Prism.Commands;
@@ -21,6 +22,7 @@ namespace PDF_Office.ViewModels.EditTools.Background
     public class BackgroundTemplateListColorContentViewModel : BindableBase, INavigationAware
     {
         private readonly IEventAggregator eventAggregator;
+        public BackgroundInfo BackgroundInfo = new BackgroundInfo();
 
         private ObservableCollection<BackgroundItem> backgroundModcolorCollection = new ObservableCollection<BackgroundItem>();
         public ObservableCollection<BackgroundItem> BackgroundModColorCollection
@@ -40,14 +42,19 @@ namespace PDF_Office.ViewModels.EditTools.Background
             set { SetProperty(ref _createTemplateVisible, value); }
         }
 
+
+
         public DelegateCommand AddTemplateCommand { get; set; }
         public DelegateCommand<object> DeleteTemplateItemCommand { get; set; }
-
+        public DelegateCommand DeleteAllTemplateItemCommand { get; set; }
+        public DelegateCommand<object> SelectTemplateItemCommand { get; set; }
         BackgroundTemplateListColorContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
             AddTemplateCommand = new DelegateCommand(AddTemplate);
             DeleteTemplateItemCommand = new DelegateCommand<object>(DeleteTemplateItem);
+            DeleteAllTemplateItemCommand = new DelegateCommand(DeleteAllTemplateItem);
+            SelectTemplateItemCommand = new DelegateCommand<object>(SelectTemplateItem);
         }
 
         private void CheckTemplateListIsEmpty(List<BackgroundItem> backgroundTemplateList)
@@ -113,6 +120,43 @@ namespace PDF_Office.ViewModels.EditTools.Background
 
         }
 
+        public void DeleteAllTemplateItem()
+        {
+            while (Settings.Default.BackgroundTemplateList.Count != 0)
+            {
+                int temp = 0;
+                var template = Settings.Default.BackgroundTemplateList[temp];
+                Settings.Default.AppProperties.NeedToDeletePath.Add(template.previeImagePath);
+                Settings.Default.AppProperties.NeedToDeletePath.Add(template.imagepath);
+
+                Settings.Default.BackgroundTemplateList.Remove(template);
+                Settings.Default.Save();
+
+                BackgroundModColorCollection.Remove(template);
+            }
+            GetBackgroundSource();
+        }
+
+        public void ConvertItemToInfo(BackgroundItem backgroundItem, ref BackgroundInfo backgroundInfo)
+        {
+
+        }
+
+        public void SendTemplateItemToDocument(BackgroundItem BackgroundItem)
+        {
+            ConvertItemToInfo(BackgroundItem, ref BackgroundInfo);
+            eventAggregator.GetEvent<SetBackgroundEvent>().Publish(BackgroundInfo);
+        }
+
+
+        public void SelectTemplateItem(object e)
+        {
+            var listBox = e as ListBox;
+            BackgroundItem BackgroundItem = listBox.SelectedItem as BackgroundItem;
+            SendTemplateItemToDocument(BackgroundItem);
+        }
+
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;

+ 2 - 2
PDF Office/Views/EditTools/Background/BackgroundCreateColorContent.xaml

@@ -100,12 +100,12 @@
                     <StackPanel Orientation="Vertical" Margin="70,0,0,0">
                         <StackPanel Orientation="Horizontal">
                             <TextBlock Text="X"  Width="9" Height="20" VerticalAlignment="Center"/>
-                            <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding HorizontalOffset, Mode=TwoWay}" ></cus:NumericUpDown>
+                            <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding HorizontalOffsetValue, Mode=TwoWay}" ></cus:NumericUpDown>
 
                         </StackPanel>
                         <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                             <TextBlock Text="Y" Width="9" Height="20" VerticalAlignment="Center"/>
-                            <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding VerticalOffset, Mode=TwoWay}"></cus:NumericUpDown>
+                            <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding VerticalOffsetValue, Mode=TwoWay}"></cus:NumericUpDown>
                         </StackPanel>
                     </StackPanel>
 

+ 4 - 4
PDF Office/Views/EditTools/Background/BackgroundCreateFileContent.xaml

@@ -39,9 +39,9 @@
                 <TextBlock Text="外观" Margin="0,16,0,8" Foreground="#666666"></TextBlock>
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Height="24" Width="24" Background= "Bisque" Margin="0,0,8,0"></TextBlock>
-                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}" Text="0"></cus:CommonWritableComboBox>
+                        <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}" Text="0" Value="{Binding RotationValue,Mode=TwoWay}"></cus:CommonWritableComboBox>
                     <TextBlock Height="24" Width="24" Background="CadetBlue" Margin="0,0,8,0"></TextBlock>
-                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}" Text="100 %"></cus:CommonWritableComboBox>
+                        <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding OpacityList, Mode=TwoWay}" Text="100 %"  Value="{Binding OpacityValue,Mode=TwoWay}"></cus:CommonWritableComboBox>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal"></StackPanel>
                 <Grid Margin="0,19,0,0">
@@ -82,11 +82,11 @@
                     <StackPanel Orientation="Vertical" Margin="70,0,0,0">
                         <StackPanel Orientation="Horizontal">
                             <TextBlock Text="X"  Width="9" Height="20" VerticalAlignment="Center"/>
-                            <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding HorizOffsetValue, Mode=TwoWay}"></cus:NumericUpDown>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding HorizontalOffsetValue, Mode=TwoWay}"></cus:NumericUpDown>
                         </StackPanel>
                         <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                             <TextBlock Text="Y" Width="9" Height="20" VerticalAlignment="Center"/>
-                            <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding HorizOffsetValue, Mode=TwoWay}"></cus:NumericUpDown>
+                                <cus:NumericUpDown Width="66" Height="32" Margin="9,0,0,0"  Text="{Binding VerticalOffsetValue, Mode=TwoWay}"></cus:NumericUpDown>
                         </StackPanel>
                     </StackPanel>
                 </StackPanel> 

+ 17 - 1
PDF Office/Views/EditTools/Background/BackgroundTemplateListColorContent.xaml

@@ -9,6 +9,22 @@
              mc:Ignorable="d"
              d:DesignHeight="632"
              d:DesignWidth="260">
+    <UserControl.Resources>
+        <ContextMenu x:Key="FlyoutMenu" FontSize="14" >
+            <ContextMenu.ItemContainerStyle>
+                <Style TargetType="{x:Type MenuItem}">
+                    <Setter Property="Padding" Value="0,8,0,8"/>
+                    <Setter Property="VerticalContentAlignment" Value="Center"/>
+                </Style>
+            </ContextMenu.ItemContainerStyle>
+            <MenuItem Name="MenuEdit" Header="编辑模板" Click="MenuEdit_Click" >
+            </MenuItem>
+            <MenuItem Name="MenuDeleteCurrent" Header="删除模板"  Click="MenuDeleteCurrent_Click">
+            </MenuItem>
+            <MenuItem Name="MenuDeleteAll" Header="删除全部" Click="MenuDeleteAll_Click"></MenuItem>
+        </ContextMenu>
+    </UserControl.Resources>
+
     <Grid Background="#F3F3F3">
         <ListBox           Width="240" 
                                 BorderThickness="0"
@@ -26,7 +42,7 @@
                 <Style TargetType="ListBoxItem">
                     <Setter Property="Margin" Value="0"/>
                     <Setter Property="Padding" Value="8 0 8 0"/>
-                    <!--<Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>-->
+                    <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
                     <Setter Property="Template" Value="{DynamicResource EditToolsItemControlTemplate}"/>
                 </Style>
             </ListBox.ItemContainerStyle>

+ 22 - 0
PDF Office/Views/EditTools/Background/BackgroundTemplateListColorContent.xaml.cs

@@ -1,6 +1,7 @@
 using ComPDFKitViewer;
 using PDF_Office.ViewModels.EditTools.Background;
 using PDF_Office.ViewModels.PageEdit;
+using System.Windows;
 using System.Windows.Controls;
 
 namespace PDF_Office.Views.EditTools.Background
@@ -22,5 +23,26 @@ namespace PDF_Office.Views.EditTools.Background
         {
             viewModel.DeleteTemplateItemCommand?.Execute(sender);
         }
+
+        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            viewModel.SelectTemplateItemCommand?.Execute(sender);
+        }
+
+        private void MenuEdit_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void MenuDeleteCurrent_Click(object sender, RoutedEventArgs e)
+        {
+            viewModel.DeleteTemplateItemCommand?.Execute(sender);
+
+        }
+
+        private void MenuDeleteAll_Click(object sender, RoutedEventArgs e)
+        {
+            viewModel.DeleteAllTemplateItemCommand?.Execute();
+        }
     }
 }

+ 1 - 1
PDF Office/Views/EditTools/Watermark/WatermarkCreateFileContent.xaml

@@ -5,7 +5,7 @@
              prism:ViewModelLocator.AutoWireViewModel="True"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:cus="clr-namespace:PDF_Office.CustomControl"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:watermark="clr-namespace:PDF_Office.ViewModels.EditTools.Watermark" d:DataContext="{d:DesignInstance Type=watermark:WatermarkCreateFileContentViewModel}"
              mc:Ignorable="d"
              d:DesignHeight="632"
              d:DesignWidth="260" >

+ 1 - 1
PDFSettings/BackgroundTemplateList.cs

@@ -107,6 +107,6 @@ namespace PDFSettings
         /// <summary>
         /// 页面选择的范围 ALL ODD EVEN 1-5(传入用户输入的字符串)
         /// </summary>
-        public string pageangeMode = "ALL";
+        public string pagRangeMode = "ALL";
     }
 }