Browse Source

阅读页顶部提示的控件

OYXH\oyxh 2 years ago
parent
commit
30f90631f5

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

@@ -55,6 +55,7 @@ using ComDocumentAIKit;
 using PDF_Office.Views.PropertyPanel.Scan;
 using PDF_Office.Views.Dialog.Redaction;
 using PDF_Office.Views.Scan;
+using PDF_Office.Views.TipContent;
 
 namespace PDF_Office
 {
@@ -269,6 +270,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<ComboxProperty>();
             containerRegistry.RegisterForNavigation<RadioButtonProperty>();
             containerRegistry.RegisterForNavigation<SignProperty>();
+            containerRegistry.RegisterForNavigation<LinkAnnotTip>();
 
             #endregion 注册内容组件
 

+ 8 - 0
PDF Office/PDF Office.csproj

@@ -503,6 +503,7 @@
     <Compile Include="ViewModels\Dialog\DynamicPropertyDialogViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\PageContentViewModel.cs" />
     <Compile Include="ViewModels\Scan\ScanViwerViewModel.cs" />
+    <Compile Include="ViewModels\TipContent\LinkAnnotTipViewModel.cs" />
     <Compile Include="ViewModels\Tools\ConverterBarContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
@@ -1051,6 +1052,9 @@
     <Compile Include="Views\Scan\ScanViwer.xaml.cs">
       <DependentUpon>ScanViwer.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\TipContent\LinkAnnotTip.xaml.cs">
+      <DependentUpon>LinkAnnotTip.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Tools\AnnotToolContent.xaml.cs">
       <DependentUpon>AnnotToolContent.xaml</DependentUpon>
     </Compile>
@@ -1908,6 +1912,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\TipContent\LinkAnnotTip.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\Tools\AnnotToolContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 35 - 4
PDF Office/ViewModels/PropertyPanel/AnnotPanel/LinkAnnotPropertyViewModel.cs

@@ -30,6 +30,9 @@ using System.Net;
 using System.Diagnostics;
 using static Dropbox.Api.TeamLog.TrustedTeamsRequestState;
 using System.Windows.Input;
+using Prism.Events;
+using Prism.Services.Dialogs;
+using PDF_Office.Views.BOTA;
 
 namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 {
@@ -428,6 +431,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         private AnnotPropertyPanel propertyPanel;
         private ViewContentViewModel viewContentViewModel;
 
+        public IRegionManager region;
+
+        public IDialogService dialogs;
+
+        public IEventAggregator events;
+
         #region 命令
 
         public DelegateCommand<object> LoadedCommand { get; set; }
@@ -450,8 +459,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         #endregion 命令
 
-        public LinkAnnotPropertyViewModel()
+        public LinkAnnotPropertyViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
         {
+            region = regionManager;
+            dialogs = dialogService;
+            events = eventAggregator;
+
             LoadedCommand = new DelegateCommand<object>(Loaded);
             PageNumTextLostFocusCommand = new DelegateCommand<object>(PageNumTextLostFocus);
             PageNumTextKeyDownCommand = new DelegateCommand<object>(PageNumTextKeyDown);
@@ -665,7 +678,25 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             historyPageIndex = pdfViewer.CurrentIndex;
             PageNumTextIsEnabled = false;
             isSelected = false;
-            viewContentViewModel.LinkAnnotTipVisibility = Visibility.Visible;
+
+            bool isExist = false;
+            if (region.Regions.ContainsRegionWithName(viewContentViewModel.TipContentRegionName))
+            {
+                var views = region.Regions[viewContentViewModel.TipContentRegionName].Views;
+                foreach (var item in views)
+                {
+                    if (item is Views.TipContent.LinkAnnotTip linkAnnotTip)
+                    {
+                        isExist = true;
+                        break;
+                    }
+                }
+            }
+            if (isExist == false)
+            {
+                region.RequestNavigate(viewContentViewModel.TipContentRegionName, "LinkAnnotTip");
+            }
+            viewContentViewModel.ShowTip(true);
         }
 
         /// <summary>
@@ -995,7 +1026,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 document = pdfViewer.Document;
                 totalPage = pdfViewer.Document.PageCount;
 
-
                 if (viewContentViewModel.IsCreateLink)
                 {
                     SetTextBoxEnableOrNot(true, totalPage);
@@ -1074,7 +1104,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         SelectAnnotation();
 
                         pdfViewer.GoToPage(historyPageIndex);
-                        viewContentViewModel.LinkAnnotTipVisibility = Visibility.Collapsed;
+                        //viewContentViewModel.LinkAnnotTipVisibility = Visibility.Collapsed;
+                        viewContentViewModel.TipVisible = Visibility.Collapsed;
                     }
                 }
             }

+ 26 - 0
PDF Office/ViewModels/TipContent/LinkAnnotTipViewModel.cs

@@ -0,0 +1,26 @@
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.TipContent
+{
+    internal class LinkAnnotTipViewModel : BindableBase, INavigationAware
+    {
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

File diff suppressed because it is too large
+ 682 - 682
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs


+ 2 - 4
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -79,6 +79,7 @@ namespace PDF_Office.ViewModels
         public string BackgroundContentRegionName { get; set; }
 
         private Visibility tipVisible = Visibility.Collapsed;
+
         /// <summary>
         /// 顶部提示栏的显示状态
         /// </summary>
@@ -91,7 +92,6 @@ namespace PDF_Office.ViewModels
             }
         }
 
-
         private Visibility readModelTip = Visibility.Collapsed;
 
         public Visibility ReadModelTip
@@ -549,7 +549,6 @@ namespace PDF_Office.ViewModels
             EnterSelectedBar("TabItemAnnotation");
         }
 
-
         /// <summary>
         /// 设置Tip状态栏的显示状态
         /// </summary>
@@ -586,7 +585,6 @@ namespace PDF_Office.ViewModels
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annotArgs);
                     this.IsPropertyOpen = true;
-
                 }
             }
         }
@@ -997,7 +995,7 @@ namespace PDF_Office.ViewModels
                       region.RequestNavigate(BottomToolRegionName, "BottomToolContent", parameters);
                       region.RequestNavigate(ReadModeRegionName, "ReadModeContent", parameters);
                       region.RequestNavigate(SplitViewerRegionName, "SplitScreenContent", parameters);
-
+                      //region.RequestNavigate(TipContentRegionName, "LinkAnnotTip", parameters);
                       //TODO 根据上一次关闭记录的菜单,选中TabItem
                       EnterSelectedBar("TabItemAnnotation");
                   }

+ 44 - 0
PDF Office/Views/TipContent/LinkAnnotTip.xaml

@@ -0,0 +1,44 @@
+<UserControl
+    x:Class="PDF_Office.Views.TipContent.LinkAnnotTip"
+    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.TipContent"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    xmlns:TipContent="clr-namespace:PDF_Office.ViewModels.TipContent"
+    d:DataContext="{d:DesignInstance Type=TipContent:LinkAnnotTipViewModel}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
+    <Border
+        Name="LinkAnnotTip1"
+        Width="{Binding ElementName=PDFViewerContent, Path=Width}"
+        Margin="0,0,17,0"
+        HorizontalAlignment="Stretch"
+        VerticalAlignment="Top"
+        Background=" #BDDFFD"
+        Visibility="{Binding LinkAnnotTipVisibility}">
+        <WrapPanel Orientation="Horizontal">
+            <Grid
+                Width="16"
+                Height="16"
+                Margin="9,4">
+                <Ellipse
+                    Width="16"
+                    Height="16"
+                    Fill="{StaticResource color.icon.base.state.info}" />
+                <Path Data="M7.25 4V5.5H8.75L8.75 4H7.25ZM7.25 7V12H8.75V7H7.25Z" Fill="White" />
+            </Grid>
+
+            <TextBlock
+                x:Name="DrawTipsText"
+                Margin="0,4,12,4"
+                Padding="4,2,4,2"
+                FontSize="14"
+                Foreground="#252629"
+                Text="Please use the scroll bar, thumbnail tool to locate the target page, click or box the area to select the target range" />
+        </WrapPanel>
+    </Border>
+</UserControl>

+ 28 - 0
PDF Office/Views/TipContent/LinkAnnotTip.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.TipContent
+{
+    /// <summary>
+    /// LinkAnnotTip.xaml 的交互逻辑
+    /// </summary>
+    public partial class LinkAnnotTip : UserControl
+    {
+        public LinkAnnotTip()
+        {
+            InitializeComponent();
+        }
+    }
+}

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

@@ -373,36 +373,7 @@
                 VerticalAlignment="Top"
                 prism:RegionManager.RegionName="{Binding TipContentRegionName}"
                 Visibility="{Binding TipVisible}" />
-            <Border
-                Name="LinkAnnotTip"
-                Grid.Column="2"
-                Width="{Binding ElementName=PDFViewerContent, Path=Width}"
-                Margin="0,0,17,0"
-                HorizontalAlignment="Stretch"
-                VerticalAlignment="Top"
-                Background=" #BDDFFD"
-                Visibility="{Binding LinkAnnotTipVisibility}">
-                <WrapPanel Orientation="Horizontal">
-                    <Grid
-                        Width="16"
-                        Height="16"
-                        Margin="9,4">
-                        <Ellipse
-                            Width="16"
-                            Height="16"
-                            Fill="{StaticResource color.icon.base.state.info}" />
-                        <Path Data="M7.25 4V5.5H8.75L8.75 4H7.25ZM7.25 7V12H8.75V7H7.25Z" Fill="White" />
-                    </Grid>
 
-                    <TextBlock
-                        x:Name="DrawTipsText"
-                        Margin="0,4,12,4"
-                        Padding="4,2,4,2"
-                        FontSize="14"
-                        Foreground="#252629"
-                        Text="Please use the scroll bar, thumbnail tool to locate the target page, click or box the area to select the target range" />
-                </WrapPanel>
-            </Border>
             <Border
                 Grid.Column="2"
                 Width="145"