Jelajahi Sumber

弹窗-补充全屏模式弹窗、新增参数名称管理文件

ZhouJieSheng 2 tahun lalu
induk
melakukan
0bd4903c61

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

@@ -18,6 +18,7 @@ using PDF_Office.Views.HomePanel;
 using Prism.DryIoc;
 using Prism.Ioc;
 using Prism.Regions;
+using PDF_Office.Model;
 
 namespace PDF_Office
 {
@@ -71,6 +72,7 @@ namespace PDF_Office
 
             //注册弹窗
             containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
+            containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
         }
 
         protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)

+ 0 - 13
PDF Office/CustomControl/DialogNames.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.CustomControl
-{
-    public static class DialogNames
-    {
-        public static string VerifyPassWordDialog = "PassWordDialog";
-    }
-}

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

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model
+{
+    /// <summary>
+    /// 记录窗体的名称
+    /// </summary>
+    public static class DialogNames
+    {
+        /// <summary>
+        /// 文档解密弹窗 需要传参PDFDocument对象
+        /// </summary>
+        public static string VerifyPassWordDialog = "PassWordDialog";
+
+        /// <summary>
+        /// 全屏模式弹窗
+        /// </summary>
+        public static string FullScreenDialog = "FullScreenDialog";
+    }
+}

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

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model
+{
+    /// <summary>
+    /// 记录常用的参数的Key名称,防止String写错
+    /// </summary>
+    public static class ParameterNames
+    {
+        public static string PDFViewer = "PDFViewer";
+
+        public static string FilePath = "FilePath";
+
+        public static string PassWord = "PassWord";
+
+        public static string PDFDocument = "PDFDocument";
+
+        public static string AddTab = "AddTab";
+
+        public static string MainViewModel = "MainViewModel";
+    }
+}

+ 1 - 1
PDF Office/CustomControl/RegionNames.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace PDF_Office.CustomControl
+namespace PDF_Office.Model
 {
     public static class RegionNames
     {

+ 5 - 5
PDF Office/PDF Office.csproj

@@ -102,20 +102,22 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
-    <Compile Include="CustomControl\DialogNames.cs" />
+    <Compile Include="Model\DialogNames.cs" />
     <Compile Include="CustomControl\InterTabClient.cs" />
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
       <DependentUpon>LoadingControl.xaml</DependentUpon>
     </Compile>
-    <Compile Include="CustomControl\RegionNames.cs" />
+    <Compile Include="Model\ParameterNames.cs" />
+    <Compile Include="Model\RegionNames.cs" />
     <Compile Include="CustomControl\TabablzRegionBehavior.cs" />
     <Compile Include="DataConvert\BoolToVisible.cs" />
     <Compile Include="DataConvert\VisibleToBoolConvert.cs" />
     <Compile Include="EventAggregators\DragablzWindowEvent.cs" />
     <Compile Include="EventAggregators\OpenFileEvent.cs" />
+    <Compile Include="Tools\CommomEvent.cs" />
     <Compile Include="ViewModels\BOTA\BOTAContentViewModel.cs" />
     <Compile Include="ViewModels\BottomToolContentViewModel.cs" />
-    <Compile Include="ViewModels\Dialog\FullSreenWindowViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
     <Compile Include="ViewModels\Dialog\VerifyPassWordDialogViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeCloudContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeGuidContentViewModel.cs" />
@@ -243,9 +245,7 @@
     <None Include="App.config" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Model\" />
     <Folder Include="Resources\" />
-    <Folder Include="Tools\" />
   </ItemGroup>
   <ItemGroup>
     <Content Include="ComOCRKit.Desk.dll">

+ 16 - 0
PDF Office/Tools/CommomEvent.cs

@@ -0,0 +1,16 @@
+using ComPDFKitViewer.PdfViewer;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Tools
+{
+    /// <summary>
+    /// 可以复用的事件,避免重复写相同的逻辑
+    /// </summary>
+    public static class CommomEvent
+    {
+    }
+}

+ 28 - 5
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -12,6 +12,9 @@ using PDF_Office.Views;
 using ComPDFKitViewer;
 using System.Windows.Input;
 using System.Windows.Controls;
+using Prism.Services.Dialogs;
+using PDF_Office.CustomControl;
+using PDF_Office.Model;
 
 namespace PDF_Office.ViewModels
 {
@@ -42,6 +45,8 @@ namespace PDF_Office.ViewModels
 
         public DelegateCommand SetViewModeCommand { get; set; }
 
+        public DelegateCommand OpenFullCommand { get; set; }
+
         public DelegateCommand<object> PageTextKeyDownCommand { get; set; }
 
         public DelegateCommand<object> PageTextPreviewKeyDownCommand { get; set; }
@@ -125,18 +130,17 @@ namespace PDF_Office.ViewModels
             }
         }
 
-
-
         public CPDFViewer PDFViewer { get; set; }
 
 
         private IRegionManager region;
 
-        public BottomToolContentViewModel(IRegionManager regionManager)
+        private IDialogService dialogs;
+
+        public BottomToolContentViewModel(IRegionManager regionManager,IDialogService dialogService)
         {
             region = regionManager;
-
-
+            dialogs = dialogService;
 
             Load = new DelegateCommand(LoadControl);
 
@@ -147,6 +151,25 @@ namespace PDF_Office.ViewModels
             SetViewModeCommand = new DelegateCommand(SetModeView);
             PageTextKeyDownCommand = new DelegateCommand<object>(PageNumText_KeyDown);
             PageTextPreviewKeyDownCommand = new DelegateCommand<object>(PageNumText_PreviewKeyDown);
+            OpenFullCommand = new DelegateCommand(OpenFullWindow);
+        }
+
+        /// <summary>
+        /// 进入全屏模式
+        /// </summary>
+        private void OpenFullWindow()
+        {
+            DialogParameters parameters = new DialogParameters();
+            //因为全屏模式可能需要设置特定的页面模式,所以只传文件路径,新建一个PDFview对象
+            parameters.Add(ParameterNames.FilePath,PDFViewer.Document.FilePath);
+            parameters.Add(ParameterNames.PassWord,PDFViewer.Tag==null?"":PDFViewer.Tag.ToString());
+            dialogs.ShowDialog(DialogNames.FullScreenDialog,parameters,e=> { 
+                if(e.Result==ButtonResult.Cancel)
+                {
+                    //TODO:弹窗提示打开全屏模式失败
+                    MessageBox.Show("Error");
+                }
+            });
         }
 
         private void PageNumText_PreviewKeyDown(object e)

+ 144 - 0
PDF Office/ViewModels/Dialog/FullScreenWindowViewModel.cs

@@ -0,0 +1,144 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.Dialog
+{
+    public class FullScreenWindowViewModel : BindableBase, IDialogAware
+    {
+        public string Title => "";
+
+        private CPDFViewer PDFViewer;
+        public DelegateCommand ExitCommand { get; set; }
+
+        public DelegateCommand<object> LoadCommand { get; set; }
+
+        public event Action<IDialogResult> RequestClose;
+
+        public string RegionName { get; set; }
+
+        /// <summary>
+        /// 鼠标滚轮缩放的缩放值
+        /// </summary>
+        private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+
+        public FullScreenWindowViewModel()
+        {
+            ExitCommand = new DelegateCommand(Exit);
+            LoadCommand = new DelegateCommand<object>(Load);
+            RegionName = Guid.NewGuid().ToString();
+        }
+
+        private void Exit()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        private void Load(object grid)
+        {
+            var Grid = grid as Grid;
+            if(Grid!=null&&PDFViewer!=null)
+            {
+                Grid.Children.Insert(0,PDFViewer);
+            }
+        }
+
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+            if(PDFViewer!=null&&PDFViewer.Document!=null)
+            {
+                PDFViewer.Document.Release();
+            }
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            string filepath;
+            string password;
+            parameters.TryGetValue<string>(ParameterNames.FilePath,out filepath);
+            parameters.TryGetValue<string>(ParameterNames.PassWord,out password);
+
+            if (!string.IsNullOrEmpty(filepath))
+            {
+                PDFViewer = new CPDFViewer();
+                PDFViewer.MouseWheelZoomHandler += PdfViewer_MouseWheelZoomHandler;
+                PDFViewer.InitDocument(filepath);
+                if (PDFViewer.Document == null)
+                {
+                    RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
+                }
+                if (PDFViewer.Document.IsLocked && !string.IsNullOrEmpty(password))
+                {
+                    PDFViewer.Document.UnlockWithPassword(password);
+                    if (PDFViewer.Document.IsLocked)
+                    {
+                        var dialogservice =  Prism.Ioc.ContainerLocator.Container.Resolve(typeof(IDialogService)) as IDialogService;
+                        DialogParameters pairs = new DialogParameters();
+                        pairs.Add(ParameterNames.PDFDocument,PDFViewer.Document);
+                        dialogservice.ShowDialog(DialogNames.VerifyPassWordDialog,pairs,e=> { 
+                            if(e.Result!=ButtonResult.OK)
+                            {
+                                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
+                            }
+                        });
+                    }
+                }
+                PDFViewer.Load();
+                PDFViewer.SetMouseMode(MouseModes.Default);
+            }
+        }
+
+
+        #region PDFViewer缩放事件
+        public void PdfViewer_MouseWheelZoomHandler(object sender, bool e)
+        {
+            double newZoom = CheckZoomLevel(PDFViewer.ZoomFactor + (e ? 0.01 : -0.01), e);
+            PDFViewer.Zoom(newZoom);
+        }
+
+        private double CheckZoomLevel(double zoom, bool IsGrowth)
+        {
+            double standardZoom = 100;
+            if (zoom <= 0.01)
+            {
+                return 0.01;
+            }
+            if (zoom >= 10)
+            {
+                return 10;
+            }
+
+            zoom *= 100;
+            for (int i = 0; i < zoomLevel.Length - 1; i++)
+            {
+                if (zoom > zoomLevel[i] && zoom <= zoomLevel[i + 1] && IsGrowth)
+                {
+                    standardZoom = zoomLevel[i + 1];
+                    break;
+                }
+                if (zoom >= zoomLevel[i] && zoom < zoomLevel[i + 1] && !IsGrowth)
+                {
+                    standardZoom = zoomLevel[i];
+                    break;
+                }
+            }
+            return standardZoom / 100;
+        }
+        #endregion
+    }
+}

+ 0 - 13
PDF Office/ViewModels/Dialog/FullSreenWindowViewModel.cs

@@ -1,13 +0,0 @@
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.ViewModels.Dialog
-{
-    public class FullSreenWindowViewModel:BindableBase
-    {
-    }
-}

+ 7 - 3
PDF Office/ViewModels/Dialog/VerifyPassWordDialogViewModel.cs

@@ -1,4 +1,5 @@
 using ComPDFKit.PDFDocument;
+using PDF_Office.Model;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
@@ -67,7 +68,7 @@ namespace PDF_Office.ViewModels.Dialog
                 return;
             }
             var dialogresult = new DialogResult(ButtonResult.OK);
-            dialogresult.Parameters.Add("PassWord", input.Trim());
+            dialogresult.Parameters.Add(ParameterNames.PassWord, input.Trim());
             RequestClose.Invoke(dialogresult);
         }
 
@@ -84,13 +85,16 @@ namespace PDF_Office.ViewModels.Dialog
 
         public void OnDialogClosed()
         {
-
+            if(document!=null)
+            {
+                document.Release();
+            }
         }
 
         public void OnDialogOpened(IDialogParameters parameters)
         {
             CPDFDocument doc = null;
-            parameters.TryGetValue<CPDFDocument>("PDFDocument", out doc);
+            parameters.TryGetValue<CPDFDocument>(ParameterNames.PDFDocument, out doc);
             if (doc != null)
             {
                 document = doc;

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

@@ -1,5 +1,6 @@
 using Microsoft.Win32;
 using PDF_Office.EventAggregators;
+using PDF_Office.Model;
 using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
@@ -123,7 +124,7 @@ namespace PDF_Office.ViewModels
         #region Navigate
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            var mainVM = navigationContext.Parameters["MainViewModel"] as MainContentViewModel;
+            var mainVM = navigationContext.Parameters[ParameterNames.MainViewModel] as MainContentViewModel;
             if (mainVM != null)
             {
                 mainContentViewModel = mainVM;

+ 67 - 4
PDF Office/ViewModels/MainContentViewModel.cs

@@ -1,5 +1,6 @@
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
+using PDF_Office.CustomControl;
 using PDF_Office.EventAggregators;
 using PDF_Office.Views;
 using Prism.Commands;
@@ -7,6 +8,7 @@ using Prism.Events;
 using Prism.Ioc;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
@@ -15,6 +17,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
+using PDF_Office.Model;
 
 namespace PDF_Office.ViewModels
 {
@@ -85,11 +88,14 @@ namespace PDF_Office.ViewModels
 
         public IContainerProvider container;
 
-        public MainContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IContainerProvider containerProvider)
+        public IDialogService dialogs;
+
+        public MainContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IContainerProvider containerProvider,IDialogService dialogService)
         {
             toolregion = regionManager;
             eventer = eventAggregator;
             container = containerProvider;
+            dialogs = dialogService;
 
             CloseTab = new DelegateCommand<object>(CloseTabItem);
 
@@ -117,23 +123,80 @@ namespace PDF_Office.ViewModels
 
         public void OpenFile(string filePath)
         {
+            var result = LoadFileFormPath(filePath);
+            if (!result)
+            {
+                IsLoading = Visibility.Collapsed;
+                return;
+            }
             FilePath = filePath;
-            NavigationParameters parameters = new NavigationParameters { { "MainViewModel", this } };
+            
+            NavigationParameters parameters = new NavigationParameters { 
+                { ParameterNames.MainViewModel, this },
+                { ParameterNames.PDFViewer,PDFViewer}
+            };
             System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
                 {
                     if (toolregion.Regions.ContainsRegionWithName(MainContentRegionName))
                         toolregion.RequestNavigate(MainContentRegionName, "ViewContent", parameters);
+                }));
+            
+        }
 
+        /// <summary>
+        /// 从文件路径创建PDFViewer对象,已包含文档解密逻辑
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        private bool LoadFileFormPath(string path)
+        {
+            PDFViewer = new CPDFViewer();
+            PDFViewer.InitDocument(path);
+            if (PDFViewer.Document == null)
+            {
+                //MessageBoxEx.Show(App.MainPageLoader.GetString("Main_OpenFileFailedWarning"));
+                return false;
+            }
+            else
+            {
+                if (PDFViewer.Document.IsLocked)
+                {
+                    DialogParameters value = new DialogParameters();
+                    value.Add(ParameterNames.PDFDocument,PDFViewer.Document);
+                    dialogs.ShowDialog(DialogNames.VerifyPassWordDialog,value,e=> { 
+                        if(e.Result== ButtonResult.OK)
+                        {
+                            if(e.Parameters.ContainsKey(ParameterNames.PassWord)&&e.Parameters.GetValue<string>(ParameterNames.PassWord) !=null)
+                            {
+                                PDFViewer.Tag = e.Parameters.GetValue<string>(ParameterNames.PassWord).ToString();
+                            }
+                        }
+                    });
+
+                    if (PDFViewer.Document.IsLocked)
+                    {
+                        //未成功解密文档时,释放Document对象,返回
+                        PDFViewer.Document.Release();
+                        return false;
+                    }
+                }
+            }
 
+            PDFViewer.Load();
 
-                }));
+            if (App.mainWindowViewModel != null)
+            {
+                App.mainWindowViewModel.CurrentPDFViewer = PDFViewer;
+            }
+            App.OpenedFileList.Add(path);
+            return true;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             if (navigationContext.Parameters.Count <= 0)
                 return;
-            var filepath = navigationContext.Parameters["filePath"];
+            var filepath = navigationContext.Parameters[ParameterNames.FilePath];
             if (filepath != null)
             {
                 OpenFile(filepath.ToString());

+ 3 - 8
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -1,5 +1,6 @@
 using Microsoft.Win32;
 using PDF_Office.CustomControl;
+using PDF_Office.Model;
 using PDF_Office.EventAggregators;
 using PDF_Office.Views;
 using Prism.Commands;
@@ -98,12 +99,7 @@ namespace PDF_Office.ViewModels
         /// </summary>
         private void AddTabItem()
         {
-            NavigationParameters parameters = new NavigationParameters
-            {
-                { "AddTab",true}
-            };
-
-            region.RequestNavigate(RegionNames.MainRegion, "MainContent", parameters);
+            region.RequestNavigate(RegionNames.MainRegion, "MainContent");
         }
 
         /// <summary>
@@ -114,8 +110,7 @@ namespace PDF_Office.ViewModels
         {
             NavigationParameters parameters = new NavigationParameters
             {
-                { "filePath", filePath },
-                { "AddTab",true}
+                { ParameterNames.FilePath, filePath }
             };
             region.RequestNavigate(RegionNames.MainRegion, "MainContent", parameters);
         }

+ 25 - 21
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -10,6 +10,10 @@ using ComPDFKitViewer.PdfViewer;
 using Prism.Regions;
 using DryIoc;
 using System.Diagnostics;
+using Prism.Services.Dialogs;
+using PDF_Office.CustomControl;
+using PDF_Office.Model;
+using PDF_Office.Tools;
 
 namespace PDF_Office.ViewModels
 {
@@ -26,6 +30,8 @@ namespace PDF_Office.ViewModels
 
         public IRegionManager region;
 
+        public IDialogService dialogs;
+
         public string ViwerRegionName { get; set; }
 
         public string BOTARegionName { get; set; }
@@ -39,10 +45,13 @@ namespace PDF_Office.ViewModels
         /// </summary>
         private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
 
-        public ViewContentViewModel(IRegionManager regionManager)
+        public ViewContentViewModel(IRegionManager regionManager,IDialogService dialogService)
         {
-            LoadFile = new DelegateCommand(loadFile);
             region = regionManager;
+            dialogs = dialogService;
+
+            LoadFile = new DelegateCommand(loadFile);
+            Load = new DelegateCommand(LoadControl);
 
             ViwerRegionName = Guid.NewGuid().ToString();
             BOTARegionName = Guid.NewGuid().ToString();
@@ -61,28 +70,17 @@ namespace PDF_Office.ViewModels
             ));
         }
 
+        /// <summary>
+        /// 将PDFViwer
+        /// </summary>
         private void loadFile()
         {
-            if (mainViewModel == null || string.IsNullOrEmpty(mainViewModel.FileName))
-            {
-                return;
-            }
-            string filepath = mainViewModel.FilePath;
-            PDFViewer = new CPDFViewer();
             PDFViewer.MouseWheelZoomHandler += PdfViewer_MouseWheelZoomHandler;
-            PDFViewer.InitDocument(filepath);
-            PDFViewer.Load();
-
-            mainViewModel.PDFViewer = PDFViewer;
-            if(App.mainWindowViewModel!=null)
-            {
-                App.mainWindowViewModel.CurrentPDFViewer = PDFViewer;
-            }
-            App.OpenedFileList.Add(filepath);
             region.AddToRegion(ViwerRegionName, PDFViewer);
         }
 
-        private void PdfViewer_MouseWheelZoomHandler(object sender, bool e)
+        #region PDFViewer鼠标滚轮缩放事件
+        public void PdfViewer_MouseWheelZoomHandler(object sender, bool e)
         {
             double newZoom = CheckZoomLevel(PDFViewer.ZoomFactor + (e ? 0.01 : -0.01), e);
             PDFViewer.Zoom(newZoom);
@@ -116,20 +114,26 @@ namespace PDF_Office.ViewModels
             }
             return standardZoom / 100;
         }
-
+        #endregion
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             if (isOpenFile)
                 return;
 
-            var mainVM = navigationContext.Parameters["MainViewModel"] as MainContentViewModel;
+            var mainVM = navigationContext.Parameters[ParameterNames.MainViewModel] as MainContentViewModel;
             if (mainVM != null)
             {
                 mainViewModel = mainVM;
             }
+            var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+            if (pdfview!=null)
+            {
+                PDFViewer = pdfview;
+                loadFile();
+            }
+
 
-            loadFile();
             isOpenFile = true;
         }
 

+ 4 - 2
PDF Office/Views/BottomToolContent.xaml

@@ -12,7 +12,6 @@
     d:DesignHeight="450"
     d:DesignWidth="1280"
     prism:ViewModelLocator.AutoWireViewModel="True"
-    Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>
         <Style x:Key="Radion_ButtonStyle" TargetType="{x:Type RadioButton}">
@@ -215,7 +214,10 @@
             <Button
                 Width="24"
                 Height="24"
-                Margin="4" />
+                Margin="4"
+                Command="{Binding OpenFullCommand}">
+                <Path Data="M15,1 L15,6 L14,6 L14,2.706 L2.706,14 L6,14 L6,15 L1,15 L1,10 L2,10 L2,13.292 L13.292,2 L10,2 L10,1 L15,1 Z" Fill="Black" />
+            </Button>
         </StackPanel>
     </Grid>
 </UserControl>

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

@@ -24,10 +24,5 @@ namespace PDF_Office.Views
         {
             InitializeComponent();
         }
-
-        private void UserControl_Loaded(object sender, RoutedEventArgs e)
-        {
-
-        }
     }
 }

+ 86 - 6
PDF Office/Views/Dialog/FullScreenWindow.xaml

@@ -1,13 +1,93 @@
-<Window
+<UserControl
     x:Class="PDF_Office.Views.Dialog.FullScreenWindow"
     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:dialog="clr-namespace:PDF_Office.ViewModels.Dialog"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    Title="FullScreenWindow"
-    Width="800"
-    Height="450"
+    xmlns:prism="http://prismlibrary.com/"
+    MinWidth="800"
+    MinHeight="450"
+    d:DataContext="{d:DesignInstance Type=dialog:FullScreenWindowViewModel}"
+    prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
-    <Grid />
-</Window>
+    <prism:Dialog.WindowStyle>
+        <Style TargetType="{x:Type Window}">
+            <Setter Property="Title" Value="{Binding Title}" />
+            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
+            <Setter Property="ShowInTaskbar" Value="False" />
+            <Setter Property="WindowState" Value="Maximized" />
+            <Setter Property="WindowStyle" Value="None" />
+        </Style>
+    </prism:Dialog.WindowStyle>
+
+    <UserControl.InputBindings>
+        <KeyBinding Key="Esc" Command="{Binding ExitCommand}" />
+    </UserControl.InputBindings>
+
+    <Grid Name="GridRoot">
+        <ContentControl prism:RegionManager.RegionName="{Binding RegionName}" />
+        <Grid
+            Name="GridTip"
+            Height="32"
+            VerticalAlignment="Top"
+            Cursor="Hand">
+            <TextBlock
+                x:Name="PressEscTip"
+                Padding="0,8,0,0"
+                Background="#99000000"
+                Foreground="#FFFFFFFF"
+                Text="Press Esc to exit Full Screen"
+                TextAlignment="Center" />
+            <Button
+                Name="BtnHideTip"
+                Width="16"
+                Height="16"
+                Margin="0,0,12,0"
+                HorizontalAlignment="Right">
+                <Polygon Fill="#FFDBDDE5" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
+                <Button.Triggers>
+                    <!--  按钮点击后顶部栏消失  -->
+                    <EventTrigger RoutedEvent="Button.Click">
+                        <EventTrigger.Actions>
+                            <BeginStoryboard>
+                                <Storyboard>
+                                    <ObjectAnimationUsingKeyFrames
+                                        BeginTime="00:00:00"
+                                        Storyboard.TargetName="GridTip"
+                                        Storyboard.TargetProperty="(UIElement.Visibility)">
+                                        <DiscreteObjectKeyFrame KeyTime="00:00:0.1" Value="{x:Static Visibility.Collapsed}" />
+                                    </ObjectAnimationUsingKeyFrames>
+                                </Storyboard>
+                            </BeginStoryboard>
+                        </EventTrigger.Actions>
+                    </EventTrigger>
+                </Button.Triggers>
+            </Button>
+            <!--  通过动画设置顶部栏15秒后消失  -->
+            <Grid.Triggers>
+                <EventTrigger RoutedEvent="Loaded">
+                    <EventTrigger.Actions>
+                        <BeginStoryboard>
+                            <Storyboard>
+                                <ObjectAnimationUsingKeyFrames
+                                    BeginTime="00:00:00"
+                                    Storyboard.TargetName="GridTip"
+                                    Storyboard.TargetProperty="(UIElement.Visibility)">
+                                    <DiscreteObjectKeyFrame KeyTime="00:00:15" Value="{x:Static Visibility.Collapsed}" />
+                                </ObjectAnimationUsingKeyFrames>
+                            </Storyboard>
+                        </BeginStoryboard>
+                    </EventTrigger.Actions>
+                </EventTrigger>
+            </Grid.Triggers>
+        </Grid>
+        <i:Interaction.Triggers>
+            <i:EventTrigger EventName="Loaded">
+                <i:InvokeCommandAction Command="{Binding LoadCommand}" CommandParameter="{Binding ElementName=GridRoot}" />
+            </i:EventTrigger>
+        </i:Interaction.Triggers>
+    </Grid>
+</UserControl>

+ 5 - 1
PDF Office/Views/Dialog/FullScreenWindow.xaml.cs

@@ -17,11 +17,15 @@ namespace PDF_Office.Views.Dialog
     /// <summary>
     /// FullScreenWindow.xaml 的交互逻辑
     /// </summary>
-    public partial class FullScreenWindow : Window
+    public partial class FullScreenWindow : UserControl
     {
         public FullScreenWindow()
         {
+             
             InitializeComponent();
+            //UserControl keybinding失效的处理方法,必须要以下两句。
+            Focusable = true;
+            this.Focus();
         }
     }
 }

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

@@ -42,7 +42,7 @@
             <Button
                 Width="16"
                 Height="16"
-                Margin="8"
+                Margin="8" 
                 ToolTip="Undo" />
             <Button
                 Width="16"