Ver código fonte

最近列表 - 根据设计图逻辑进行调整,重整代码逻辑

chenrongqian 2 anos atrás
pai
commit
151a3b8151

+ 52 - 0
PDF Office/Styles/ButtonStyle.xaml

@@ -64,6 +64,58 @@
             </Setter.Value>
         </Setter>
     </Style>
+    
+    <!--只有内容的按钮(普通状态下,没有固定的边框和背景色)-->
+    <!--<Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
+    <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />-->
+    <Style x:Key="OnlyContentBtn" TargetType="{x:Type Button}">
+        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="HorizontalContentAlignment" Value="Center" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="Background" Value="Transparent"/>
+        <Setter Property="BorderBrush" Value="Transparent"/>
+        <Setter Property="Padding" Value="0" />
+        <Setter Property="Width" Value="32" />
+        <Setter Property="Height" Value="32" />
+        <Setter Property="IsTabStop" Value="False" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Button}">
+                    <Border
+                        x:Name="border"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <ContentPresenter
+                            x:Name="contentPresenter"
+                            Margin="{TemplateBinding Padding}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Focusable="False"
+                            RecognizesAccessKey="True"
+                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource Button.MouseOver.Background}" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.MouseOver.Border}" />
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Pressed.Background}" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Pressed.Border}" />
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
+                            <Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 
     <!--  阅读模式的按钮模板样式  -->
     <ControlTemplate x:Key="zoomout" TargetType="{x:Type ButtonBase}">

+ 5 - 15
PDF Office/Styles/ListViewStyle.xaml

@@ -27,12 +27,13 @@
                                         <ColumnDefinition Width="2*" />
                                         <ColumnDefinition Width="100" />
                                     </Grid.ColumnDefinitions>
+                                    <!--以下是列表模式的列标题-->
                                     <TextBlock
                                         Margin="12,0,0,6"
                                         HorizontalAlignment="Left"
                                         VerticalAlignment="Center"
                                         FontSize="14" />
-                                    <!--  Text="{x:Static homePageUI:HomePage.RencentFiles_Name}"  -->
+
                                     <TextBlock
                                         Grid.Column="1"
                                         Margin="0,0,0,6"
@@ -41,17 +42,16 @@
                                         FontSize="14"
                                         TextAlignment="Center"
                                         TextWrapping="Wrap" />
-                                    <!--  Text="{x:Static homePageUI:HomePage.RencentFiles_LastOpenedTime}"  -->
                                     <TextBlock
                                         Grid.Column="2"
                                         Margin="0,0,0,6"
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
                                         FontSize="14" />
-                                    <!--  Text="{x:Static homePageUI:HomePage.RencentFiles_Size}"  -->
+                                    <!--列表模式的列标题的分隔线-->
                                     <Rectangle
                                         Grid.ColumnSpan="4"
-                                        Height="1"
+                                        Height="0"
                                         Margin="12,0,0,0"
                                         HorizontalAlignment="Stretch"
                                         VerticalAlignment="Bottom"
@@ -68,17 +68,6 @@
 
     <Style x:Key="FilesListViewItemStyle" TargetType="{x:Type ListViewItem}">
         <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
-        <!--<Setter Property="Control.Padding" Value="4,1" />
-        <Setter Property="Control.HorizontalContentAlignment">
-        <Setter.Value>
-        <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
-        </Setter.Value>
-        </Setter>
-        <Setter Property="Control.VerticalContentAlignment">
-        <Setter.Value>
-        <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
-        </Setter.Value>
-        </Setter>-->
         <Setter Property="Panel.Background" Value="#00FFFFFF" />
         <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
         <Setter Property="Border.BorderThickness" Value="1" />
@@ -147,6 +136,7 @@
                                 ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
                                 ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                                 SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+                            <Rectangle Grid.Column="1" Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Fill="#C5CBD3"/>
                         </Grid>
                     </Border>
                     <ControlTemplate.Triggers>

+ 74 - 0
PDF Office/Styles/RadioButtonStyle.xaml

@@ -185,4 +185,78 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <!--最近列表列表模式单选按钮-->
+    <Style x:Key="ListModeRadioBtnStyle" TargetType="{x:Type RadioButton}">
+        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
+        <Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
+        <Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}"/>
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type RadioButton}">
+                    <Border CornerRadius="4" x:Name="root" Background="#EEF2F3">
+                   
+                        <Grid x:Name="templateRoot" SnapsToDevicePixels="True" VerticalAlignment="Center" HorizontalAlignment="Center">
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="Auto"/>
+                                <ColumnDefinition Width="*"/>
+                            </Grid.ColumnDefinitions>
+                            <Border x:Name="radioButtonBorder" Visibility="Collapsed" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
+                                <Grid x:Name="markGrid" Margin="2">
+                                    <Ellipse x:Name="optionMark" Fill="{StaticResource RadioButton.Static.Glyph}" MinWidth="6" MinHeight="6" Opacity="0"/>
+                                </Grid>
+                            </Border>
+
+                            <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
+                            </ContentPresenter>
+                        </Grid>
+
+                    </Border>
+
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="HasContent" Value="true">
+                            <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
+                            <Setter Property="Padding" Value="4,-1,0,0"/>
+                        </Trigger>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Background}"/>
+                            <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Border}"/>
+                            <Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.MouseOver.Glyph}"/>
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Background}"/>
+                            <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Border}"/>
+                            <Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Disabled.Glyph}"/>
+                            <Setter Property="Border.Background" TargetName="root">
+                                <Setter.Value>
+                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
+                                        <GradientStop Color="White" Offset="0.0" />
+                                        <GradientStop Color="#CFCFCF" Offset="0.5" />
+                                        <GradientStop Color="White" Offset="0.0" />
+                                    </LinearGradientBrush>
+                                </Setter.Value>
+                            </Setter>
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Background}"/>
+                            <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Border}"/>
+                            <Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Pressed.Glyph}"/>
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="true">
+                            <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
+                            <Setter Property="Border.Background" TargetName="root" Value="White">
+                              
+                            </Setter>
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="{x:Null}">
+                            <Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
+
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 169 - 2
PDF Office/ViewModels/HomePanel/RecentFiles/RecentFilesContentViewModel.cs

@@ -1,4 +1,5 @@
-using PDF_Office.CustomControl;
+using Microsoft.Win32;
+using PDF_Office.CustomControl;
 using PDF_Office.Helper;
 using PDF_Office.Properties;
 using PDF_Office.Views;
@@ -8,6 +9,8 @@ using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Text;
@@ -22,6 +25,9 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
         #region 属性
 
         private ObservableCollection<OpenFileInfo> _recentFilesGroup = new ObservableCollection<OpenFileInfo>();
+        /// <summary>
+        /// 最近列表:文件集合
+        /// </summary>
         public ObservableCollection<OpenFileInfo> RecentFilesGroup
         {
             get { return _recentFilesGroup; }
@@ -31,22 +37,128 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
             }
         }
 
+        private bool _isEmpty = false;
+        /// <summary>
+        /// 最近列表是否为空
+        /// </summary>
+        public bool IsEmpty
+        {
+            get { return _isEmpty; }
+            set
+            {
+                SetProperty(ref _isEmpty, value);
+            }
+        }
+
+
+        private bool _isListMode = false;
+        /// <summary>
+        /// 是否为列表模式
+        /// </summary>
+        public bool IsListMode
+        {
+            get { return _isListMode; }
+            set
+            {
+                SetProperty(ref _isListMode, value);
+            }
+        }
+
         #endregion
 
         public DelegateCommand<object> RemoveFileItemCommand { get; set; }
         public DelegateCommand<object> RemoveFilesFromContainerCommand { get; set; }
+        public DelegateCommand<object> OpenRecentFilesCommand { get; set; }
         public DelegateCommand<object> OpenFilesCommand { get; set; }
 
+        public DelegateCommand<object> ListModeCheckedCommand { get; set; }
+
+        public DelegateCommand<object> ExplorerFileCommand { get; set; }
+
+        public event EventHandler<bool> RecentFilesSelectionHandler;
         public RecentFilesContentViewModel()
+        {
+            InitVariables();
+            InitCommands();
+            InitEvents();
+        }
+
+        #region 初始化
+        private void InitVariables()
         {
             RecentFilesGroup = new ObservableCollection<OpenFileInfo>(Settings.Default.RecentOpenFiles);
+            RecentFileGroupIsEmpty();
+
+            int mode = Settings.Default.AppProperties.RecentFileListMode;
+            if (mode == 0)
+                IsListMode = false;
+            else
+                IsListMode = true;
+        }
 
+        private void InitCommands()
+        {
             RemoveFilesFromContainerCommand = new DelegateCommand<object>(RemoveFilesFromContainer_Command);
             RemoveFileItemCommand = new DelegateCommand<object>(RemoveFileItem_Command);
+            OpenRecentFilesCommand = new DelegateCommand<object>(OpenRecentFiles_Command);
+            ListModeCheckedCommand = new DelegateCommand<object>(ListMode_Checked);
             OpenFilesCommand = new DelegateCommand<object>(OpenFiles_Command);
+            ExplorerFileCommand = new DelegateCommand<object>(ExplorerFile_Command);
+        }
 
+        private void InitEvents()
+        {
+            RecentFilesGroup.CollectionChanged -= RecentFilesGroup_CollectionChanged;
+            RecentFilesGroup.CollectionChanged += RecentFilesGroup_CollectionChanged;
         }
 
+        private void RecentFilesGroup_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            RecentFileGroupIsEmpty();
+        }
+
+        private void RecentFileGroupIsEmpty()
+        {
+            if (RecentFilesGroup.Count == 0)
+            {
+                IsEmpty = true;
+            }
+            else
+            {
+                IsEmpty = false;
+            }
+        }
+
+        #endregion
+
+        /// <summary>
+        /// 最近列表:文件列表模式选中事件
+        /// </summary>
+        /// <param name="obj"></param>
+        private void ListMode_Checked(object obj)
+        {
+            if (obj is string)
+            {
+                var tag = obj as string;
+                if (tag == "ListMode")
+                {
+                    IsListMode = true;
+                    Settings.Default.AppProperties.RecentFileListMode = 1;
+                }
+                else
+                {
+                    IsListMode = false;
+                    Settings.Default.AppProperties.RecentFileListMode = 0;
+                }
+                Settings.Default.Save();
+                RecentFilesSelectionHandler?.Invoke(null, IsListMode);
+            }
+        }
+
+        /// <summary>
+        /// 移除文件记录:单个文件
+        /// </summary>
+        /// <param name="obj"></param>
         private void RemoveFileItem_Command(object obj)
         {
             var openFileInfo = obj as OpenFileInfo;
@@ -58,7 +170,7 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
         }
 
         /// <summary>
-        /// 删除按钮触发事件
+        /// 删除按钮触发事件:选中的文件
         /// </summary>
         /// <param name="obj">选中的文档</param>
         private void RemoveFilesFromContainer_Command(object obj)
@@ -132,7 +244,58 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
             }
         }
 
+        /// <summary>
+        /// 空状态时,点击文件浏览器弹窗,打开文件
+        /// </summary>
         private void OpenFiles_Command(object obj)
+        {
+            var dlg = new OpenFileDialog();
+            dlg.Multiselect = true;
+            dlg.Filter = Properties.Resources.OpenDialogFilter;
+
+            if (dlg.ShowDialog() == true)
+            {
+                LoadPdfViewer(dlg.FileNames);
+            }
+        }
+
+        /// <summary>
+        /// 打开文件路径
+        /// </summary>
+        private void ExplorerFile_Command(object obj)
+        {
+            try
+            {
+                var fileInfo = obj as OpenFileInfo;
+                if (fileInfo != null)
+                {
+                    if (string.IsNullOrEmpty(fileInfo.FilePath) == false)
+                    {
+                        if (!File.Exists(fileInfo.FilePath))
+                        {
+                            MessageBoxEx.Show("文件不存在");
+                            SettingHelper.RemoveRecentOpenFile(fileInfo.FilePath);
+                            RecentFilesGroup.Remove(fileInfo);
+                        }
+                        else
+                        {
+                            Process.Start("explorer", "/select,\"" + fileInfo.FilePath + "\"");
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+            
+        }
+
+        /// <summary>
+        /// 从最近列表里,打开文档
+        /// </summary>
+        /// <param name="obj"></param>
+        private void OpenRecentFiles_Command(object obj)
         {
             var fileInfo = obj as OpenFileInfo;
             if (fileInfo != null)
@@ -153,6 +316,10 @@ namespace PDF_Office.ViewModels.HomePanel.RecentFiles
 
         }
 
+        /// <summary>
+        /// 打开文档
+        /// </summary>
+        /// <param name="filePaths"></param>
         public void LoadPdfViewer(string[] filePaths)
         {
             var content = App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel;

Diferenças do arquivo suprimidas por serem muito extensas
+ 19 - 58
PDF Office/Views/HomePanel/RecentFiles/DocItemListViewControl.xaml


+ 14 - 25
PDF Office/Views/HomePanel/RecentFiles/DocItemListViewControl.xaml.cs

@@ -27,10 +27,7 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
     public partial class DocItemListViewControl : UserControl
     {
         public event EventHandler<RoutedEventArgs> DeleteItemHandler;
-        public event EventHandler<RoutedEventArgs> PrintItemHandler;
-        public event EventHandler<RoutedEventArgs> FileInfoItemHandler;
-        public event EventHandler<RoutedEventArgs> ShareItemHandler;
-        public event EventHandler<RoutedEventArgs> FilePathItemHandler;
+        public event EventHandler<RoutedEventArgs> OpenFileItemHandler;
 
         public DocItemListViewControl()
         {
@@ -55,17 +52,17 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
 
         private void UserControl_MouseEnter(object sender, MouseEventArgs e)
         {
-            IsHoverState = true;
+           // IsHoverState = true;
         }
 
         private void UserControl_MouseLeave(object sender, MouseEventArgs e)
         {
-            IsHoverState = false;
+           // IsHoverState = false;
         }
 
         private void UserControl_MouseMove(object sender, MouseEventArgs e)
         {
-            IsHoverState = true;
+           // IsHoverState = true;
         }
 
         private void MoreButton_Initialized(object sender, EventArgs e)
@@ -83,20 +80,7 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
         #endregion
 
         #region 事件
-        private void MenuPrint_Click(object sender, RoutedEventArgs e)
-        {
-            PrintItemHandler.Invoke(sender, e);
-        }
-
-        private void MenuShare_Click(object sender, RoutedEventArgs e)
-        {
-            ShareItemHandler.Invoke(sender, e);
-        }
 
-        private void MenuFileInfo_Click(object sender, RoutedEventArgs e)
-        {
-            FileInfoItemHandler.Invoke(sender, e);
-        }
         #endregion
 
         private void DeleteButton_Click(object sender, RoutedEventArgs e)
@@ -104,10 +88,7 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
             DeleteItemHandler.Invoke(sender, e);
         }
 
-        private void MenuFilePath_Click(object sender, RoutedEventArgs e)
-        {
-            FilePathItemHandler.Invoke(sender, e);
-        }
+
 
         private void MenuMore_Loaded(object sender, RoutedEventArgs e)
         {
@@ -136,6 +117,14 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
 
         }
 
-     
+        private void MenuOpenFile_Click(object sender, RoutedEventArgs e)
+        {
+            OpenFileItemHandler?.Invoke(sender, e);
+        }
+
+        private void MenuDelete_Click(object sender, RoutedEventArgs e)
+        {
+            DeleteItemHandler?.Invoke(sender, e);
+        }
     }
 }

+ 90 - 50
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml

@@ -5,6 +5,8 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
              xmlns:customControl ="clr-namespace:PDF_Office.CustomControl"
+             xmlns:DataConvert ="clr-namespace:PDF_Office.DataConvert"
+             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:prism ="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" Loaded="UserControl_Loaded"
@@ -14,16 +16,18 @@
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="../../../Styles/ListViewStyle.xaml"/>
                 <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
+                <ResourceDictionary Source="../../../Styles/RadioButtonStyle.xaml"/>
+                <ResourceDictionary Source="../../../Styles/ButtonStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
+            <DataConvert:BoolToVisible x:Key="BoolToVisible"/>
+            <DataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
+            <DataConvert:InvertBoolConvert x:Key="InvertBoolConvert"/>
+
             <DataTemplate x:Key="listviewItem">
                 <local:DocItemListViewControl HorizontalAlignment="Stretch"
-                                              
+                                              OpenFileItemHandler ="DocItemListViewControl_OpenFileItemHandler"
+                                              DeleteItemHandler="DocItemListViewControl_DeleteItemHandler"
                                               />
-                <!--FileInfoItemHandler="FileInfoMenuItem_Click"  
-                                              PrintItemHandler="PrintMenuItem_Click"  
-                                              DeleteItemHandler="DeleteItemHandler_Click"
-                                              ShareItemHandler="ShareMenuItem_Click"
-                                              FilePathItemHandler ="FilePathMenuItem_Click"-->
             </DataTemplate>
 
             <DataTemplate x:Key="gridviewItem">
@@ -46,7 +50,7 @@
                         <Setter Property="VerticalContentAlignment" Value="Center"/>
                     </Style>
                 </ContextMenu.ItemContainerStyle>
-                <MenuItem Name="FilePathMenuItem" Header="FilePath" IsEnabled="True" Click="FilePathMenuItem_Click">
+                <MenuItem Name="FilePathMenuItem" Header="打开文件路径" IsEnabled="True" Click="FilePathMenuItem_Click">
                     <MenuItem.Icon>
                         <Path Fill="Black"
                                               Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z">
@@ -76,7 +80,8 @@
                 <EventSetter Event="PreviewMouseRightButtonDown"
                              Handler="ListViewItem_PreviewMouseRightButtonDown"/>
                 <EventSetter Event="PreviewMouseDoubleClick"
-                             Handler="RecentFilesList_PreviewMouseDoubleClick"/>
+                             Handler="RecentFilesList_PreviewMouseDoubleClick">
+                </EventSetter>
             </Style>
 
             <Style x:Key="HomeGridViewItemStyle" BasedOn="{StaticResource FilesGridItemStyle}" TargetType="{x:Type ListViewItem}">
@@ -100,48 +105,80 @@
                 <RowDefinition />
             </Grid.RowDefinitions>
             <Grid x:Name="GridRecentFilesTile" Margin="32,38,0,13">
-                <TextBlock x:Name="TxbRecentlyTile" Text="Recent" HorizontalAlignment="Left" FontWeight="Semibold" FontSize="24" Padding="0,6,0,0" Margin="0,0,0,0"/>
-
+                <TextBlock x:Name="TxbRecentlyTile" Text="Recent" HorizontalAlignment="Left" FontWeight="Semibold" FontSize="20" Padding="0,6,0,0" Margin="0,0,0,0"/>
                 <StackPanel x:Name="PnlRightBtns" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
-
-
-                    <customControl:CustomIconToggleBtn x:Name="BtnListMode" Tag="ListMode" Width="32" Height="24" Click="ListModeBtn_Click"
-                                              Style="{StaticResource ToggleBtnViewModeStyle}">
-                        <StackPanel Orientation="Horizontal" Margin="8,0,8,0">
-                            <Path Fill="Black" Data="M15 2H1V7H15V2ZM14 3V6H2V3H14ZM15 9H1V14H15V9ZM14 10V13H2V10H14Z"/>
-                        </StackPanel>
-                    </customControl:CustomIconToggleBtn>
-
-                    <customControl:CustomIconToggleBtn x:Name="BtnGridMode" Margin="0" Width="32" Height="24" Tag="GridMode" Click="GridModeBtn_Click" 
-                                              Style="{StaticResource ToggleBtnViewModeStyle}">
-                        <StackPanel Orientation="Horizontal" Margin="8,0,8,0">
-                            <Path Fill="Black" Data="M7 2H2V7H7V2ZM6 3V6H3V3H6ZM14 2H9V7H14V2ZM13 3V6H10V3H13ZM2 9H7V14H2V9ZM6 13V10H3V13H6ZM14 9H9V14H14V9ZM13 10V13H10V10H13Z"/>
+                    <Border  Background="#EEF2F3" Height="30" CornerRadius="4" Padding="1,0,1,0">
+                        <StackPanel Orientation="Horizontal">
+                            <RadioButton x:Name="BtnListMode" GroupName="Mode" Tag="ListMode" Width="40" Height="28" Foreground="#333333" 
+                                         HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
+                                         IsChecked="{Binding IsListMode,Mode=OneTime}"
+                                         Style="{StaticResource ListModeRadioBtnStyle}">
+                                <Grid  Margin="-5,0,0,0" HorizontalAlignment="Center">
+                                    <Path Data="M3 5L17 5" Stroke="{Binding ElementName=BtnListMode,Path=Foreground}" StrokeThickness="1.5" StrokeStartLineCap="Round" />
+                                    <Path Data="M3 10H17" Stroke="{Binding ElementName=BtnListMode,Path=Foreground}" StrokeThickness="1.5" StrokeStartLineCap="Round" />
+                                    <Path Data="M3 15H17" Stroke="{Binding ElementName=BtnListMode,Path=Foreground}" StrokeThickness="1.5" StrokeStartLineCap="Round" />
+                                </Grid>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="Checked">
+                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode,Path =Tag}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </RadioButton>
+
+                            <RadioButton x:Name="BtnGridMode" GroupName="Mode" Tag="GridMode" Width="40" Height="28" Foreground="#6B869C"
+                                         HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
+                                        IsChecked="{Binding IsListMode,Converter={StaticResource InvertBoolConvert},Mode=OneTime}"
+                                         Style="{StaticResource ListModeRadioBtnStyle}">
+                                <Grid  Margin="-5,0,0,0" HorizontalAlignment="Center">
+                                    <Grid.RowDefinitions>
+                                        <RowDefinition />
+                                        <RowDefinition />
+                                    </Grid.RowDefinitions>
+                                    <Grid.ColumnDefinitions>
+                                        <ColumnDefinition/>
+                                        <ColumnDefinition/>
+                                    </Grid.ColumnDefinitions>
+                                    <Rectangle Grid.Row="0" Grid.Column="0" Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
+                                    <Rectangle Grid.Row="0" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
+                                    <Rectangle Grid.Row="1" Grid.Column="0"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
+                                    <Rectangle Grid.Row="1" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
+                                </Grid>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="Checked">
+                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode,Path =Tag}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </RadioButton>
                         </StackPanel>
-                    </customControl:CustomIconToggleBtn>
-
-
+                    </Border>
+                    
                     <Separator  Margin="1 0 1 0" Width="1" Height="16" BorderBrush="#1A000000" BorderThickness="1"/>
 
-                    <Button x:Name="BtnDelete" Margin="0" Padding="0,0,0,0" MaxHeight="40" Width="20" Height="20" Background="Transparent" BorderThickness="0" Command="{Binding RemoveFilesFromContainerCommand}" CommandParameter="{Binding ElementName=RecentFilesList,Path=SelectedItems}"
-                         >
-                        <StackPanel Orientation="Horizontal">
-                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="4,0,4,0">
-                                <Path  Fill="Black" VerticalAlignment="Center" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z"/>
-                            </StackPanel>
-                        </StackPanel>
+                    <Button x:Name="BtnDelete" Margin="0" Padding="0,0,0,0" MaxHeight="40" Width="28" Height="28" Background="Transparent" BorderThickness="0" 
+                            IsEnabled="{Binding IsEmpty,Converter={StaticResource InvertBoolConvert},Mode=OneWay}"
+                            Command="{Binding RemoveFilesFromContainerCommand}" CommandParameter="{Binding ElementName=RecentFilesList,Path=SelectedItems}"
+                         Style="{StaticResource OnlyContentBtn}" Foreground="#6B6F7D"
+                            >
+                        <Grid Width="20" Height="20">
+                            <Path Data="M8 2H12" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
+                            <Path Data="M5 5V17H15V5" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
+                            <Path Data="M17 5H3" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
+                            <Path Data="M10 9V13" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
+                        </Grid>
                     </Button>
 
                 </StackPanel>
 
             </Grid>
 
-            <Grid  Grid.Row="2">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="799*"/>
-                    <ColumnDefinition Width="*"/>
-                </Grid.ColumnDefinitions>
-                <ListView x:Name="RecentFilesList" 
-                      ItemsSource="{Binding RecentFilesGroup}"   
+                <Grid  Grid.Row="2" Visibility="{Binding IsEmpty,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="799*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+                <Border Visibility="{Binding IsListMode,Converter={StaticResource BoolToVisible}}">
+                    <ListView x:Name="RecentFilesList" 
+                      ItemsSource="{Binding RecentFilesGroup}"
                       Margin="32,0,0,0"
                       VirtualizingPanel.IsVirtualizing="True" 
                       VirtualizingPanel.CacheLengthUnit="Page"
@@ -152,17 +189,19 @@
                       Background="Transparent" BorderThickness="0" 
                       Padding="0,0,0,0" MinHeight="216" MinWidth="380" 
                       SelectionMode="Multiple"
-                      SelectionChanged="RecentFilesList_SelectionChanged"
                       ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
                       Style="{StaticResource FilesListViewStyle}"
                       ItemTemplate="{StaticResource listviewItem}"
                      ItemsPanel="{StaticResource listPanel}" Grid.ColumnSpan="2"
                      >
-                </ListView>
+                    </ListView>
+                </Border>
+                   
 
-                <ListView x:Name="GridRecentFilesList" 
-                       ItemsSource="{Binding RecentFilesGroup}"   
-                      Margin="32,0,0,0" Visibility="Collapsed"
+                    <ListView x:Name="GridRecentFilesList" 
+                      Visibility="{Binding IsListMode,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                      ItemsSource="{Binding RecentFilesGroup}"   
+                      Margin="32,0,0,0"
                       VirtualizingPanel.IsVirtualizing="True" 
                       VirtualizingPanel.CacheLengthUnit="Page"
                       VirtualizingPanel.CacheLength="1"
@@ -172,22 +211,23 @@
                       Background="Transparent" BorderThickness="0" 
                       Padding="0,0,0,0" MinHeight="216" MinWidth="380" 
                       SelectionMode="Multiple"
-                      SelectionChanged="GridRecentFilesList_SelectionChanged"
                       ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
                       Style="{StaticResource FilesGridViewStyle}"
                       ItemTemplate="{StaticResource gridviewItem}"
                      ItemsPanel="{StaticResource gridPanel}" Grid.ColumnSpan="2"
                      >
-                </ListView>
+                    </ListView>
 
-            </Grid>
-            <StackPanel x:Name="BlankContentPanel" Grid.Row="1" Grid.RowSpan="2"  HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
+                </Grid>
+
+            <StackPanel x:Name="BlankContentPanel" Grid.Row="1" Grid.RowSpan="2"  HorizontalAlignment="Center" VerticalAlignment="Center" 
+                        Visibility="{Binding IsEmpty,Converter={StaticResource BoolToVisible}}">
                 <!--<Image Source="../../Resources/Image/Home/empty_recent2x.png" Width="140" Height="140" Stretch="Uniform" VerticalAlignment="Center"/>-->
                 <TextBlock x:Name="NoFilesText" Text="No documents" TextAlignment="Center"  HorizontalAlignment="Center" FontSize="16" LineHeight="22" Foreground="#FF333333" FontFamily="Segoe UI" />
                 <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
                     <TextBlock x:Name="clickFileText" Text="Drop documents here or click the '" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14"/>
                     <TextBlock  Margin="2,0,2,0" VerticalAlignment="Center" FontSize="15">
-                        <Hyperlink   Click="OpenFiles_Click">
+                        <Hyperlink  Command="{Binding OpenFilesCommand}">
                             <TextBlock x:Name="OpenFilesLinkText" Text="Open Files"/>
                         </Hyperlink>
                     </TextBlock>

+ 90 - 197
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml.cs

@@ -28,148 +28,101 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
             InitializeComponent();
         }
 
+        #region 初始化
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            RecentFilesList.SelectedItem = null;
-            ShowListViewContentUI();
+            InitVariables();
+            InitEvents();
         }
 
-        private void SetLangText()
+        private void InitVariables()
         {
+            if (RecentFilesList.SelectedItems != null)
+                RecentFilesList.SelectedItems.Clear();
 
+            if (GridRecentFilesList.SelectedItems != null)
+                GridRecentFilesList.SelectedItems.Clear();
         }
-
-        private void InitContextMenu()
-        {
-
-        }
-
-        private void InitUI()
-        {
-
-        }
-
-
-        #region UI
-        #region 列表和网格模式
-        private void ListModeBtn_Click(object sender, RoutedEventArgs e)
-        {
-            SwitchFilesMode(sender);
-
-            if (BtnListMode.IsChecked == false)
-                BtnListMode.IsChecked = true;
-        }
-
-        private void GridModeBtn_Click(object sender, RoutedEventArgs e)
+        private void InitEvents()
         {
-            SwitchFilesMode(sender);
-
-            if (BtnGridMode.IsChecked == false)
-                BtnGridMode.IsChecked = true;
+            ViewModel.RecentFilesSelectionHandler -= ViewModel_RecentFilesSelection;
+            ViewModel.RecentFilesSelectionHandler += ViewModel_RecentFilesSelection;
         }
+        #endregion
 
-        private void SwitchFilesMode(object sender)
+        #region UI操作
+        private void ViewModel_RecentFilesSelection(object sender, bool e)
         {
-            try
+            if (e)
             {
-                var btn = sender as CustomIconToggleBtn;
-                switch (btn.Tag.ToString())
+                RecentFilesList.SelectedItems.Clear();
+                if (GridRecentFilesList.SelectedItems.Count > 0)
                 {
-                    case "ListMode":
-                        BtnGridMode.IsChecked = false;
-
-                        GridRecentFilesList.Visibility = Visibility.Collapsed;
-                        RecentFilesList.Visibility = Visibility.Visible;
-                        RecentFilesList.SelectedItems.Clear();
-                        if (GridRecentFilesList.SelectedItems.Count > 0)
-                        {
-                            for (int i = 0; i < GridRecentFilesList.SelectedItems.Count; i++)
-                            {
-                                RecentFilesList.SelectedItems.Add(GridRecentFilesList.SelectedItems[i]);
-                            }
-
-                        }
-                        
-                        break;
-
-                    case "GridMode":
-                        BtnListMode.IsChecked=false;
-
-                        GridRecentFilesList.Visibility = Visibility.Visible;
-                        RecentFilesList.Visibility = Visibility.Collapsed;
-                        GridRecentFilesList.SelectedItems.Clear();
-                        if (RecentFilesList.SelectedItems.Count > 0)
-                        {
-                            for (int i = 0; i < RecentFilesList.SelectedItems.Count; i++)
-                            {
-                                GridRecentFilesList.SelectedItems.Add(RecentFilesList.SelectedItems[i]);
-                            }
+                    for (int i = 0; i < GridRecentFilesList.SelectedItems.Count; i++)
+                    {
+                        RecentFilesList.SelectedItems.Add(GridRecentFilesList.SelectedItems[i]);
+                    }
 
-                        }
-                        
-                        break;
                 }
-              
-            }
-            catch { }
-        }
-
-        private void ShowListViewContentUI()
-        {
-            if (RecentFilesList.Items.Count == 0)
-            {
-                BlankContentPanel.Visibility = Visibility.Visible;
-                RecentFilesList.Visibility = Visibility.Collapsed;
-                PnlRightBtns.Visibility = Visibility.Collapsed;
             }
             else
             {
-                RecentFilesList.Visibility = Visibility.Visible;
-                PnlRightBtns.Visibility = Visibility.Visible;
-                BlankContentPanel.Visibility = Visibility.Collapsed;
-            }
-        }
-
-        #endregion
-
-        private void RecentFilesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-           
-        }
+                GridRecentFilesList.SelectedItems.Clear();
+                if (RecentFilesList.SelectedItems.Count > 0)
+                {
+                    for (int i = 0; i < RecentFilesList.SelectedItems.Count; i++)
+                    {
+                        GridRecentFilesList.SelectedItems.Add(RecentFilesList.SelectedItems[i]);
+                    }
 
-        private void GridRecentFilesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-        
+                }
+            }
         }
 
         private void ContextMenu_Opened(object sender, RoutedEventArgs e)
         {
-           
-        }
-
-        /// <summary>
-        /// 未被选中的项目,或只有一个被选中的项
-        /// </summary>
-        private void showMoreContexMenu(ContextMenu contexMenu)
-        {
-            foreach (var item in contexMenu.Items)
+            try
             {
-                var menuitem = item as MenuItem;
-                menuitem.Visibility = Visibility.Visible;
-               
+                var contexMenu = sender as ContextMenu;
+                if (contexMenu != null)
+                {
+                    foreach (var item in contexMenu.Items)
+                    {
+                        var menuitem = item as MenuItem;
+                        menuitem.Visibility = Visibility.Visible;
+                    }
+                }
+                if (RecentFilesList.SelectedItems.Count >= 2)
+                {
+                    foreach (var item in contexMenu.Items)
+                    {
+                        var menuitem = item as MenuItem;
+                        if (menuitem.Name == "FilePathMenuItem")
+                            menuitem.Visibility = Visibility.Collapsed;
+                    }
+                }
             }
+            catch { }
         }
 
+        /// <summary>
+        /// 禁用触发鼠标右键,列表项被选中
+        /// </summary>
         private void ListViewItem_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
         {
             Trace.WriteLine("Preview MouseRightButtonDown");
             e.Handled = true;
         }
+
         #endregion
 
+
         #region Events
-       
 
+
+        /// <summary>
+        /// 右键菜单:删除文件记录
+        /// </summary>
         private void DeleteMenuItem_Click(object sender, RoutedEventArgs e)
         {
             if (RecentFilesList.SelectedItems == null || RecentFilesList.SelectedItems.Count == 0)
@@ -187,122 +140,62 @@ namespace PDF_Office.Views.HomePanel.RecentFiles
 
         }
 
-        private void DeleteItemHandler_Click(object sender, RoutedEventArgs e)
-        {
-            DeleteFileItem(sender);
-        }
-
-        private bool IsSelectedFile(object sender)
-        {
-
-            return true;
-        }
-
-        private void DeleteFileItem(object sender)
+        /// <summary>
+        /// 右键菜单:打开文件路径
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void FilePathMenuItem_Click(object sender, RoutedEventArgs e)
         {
-            if (RecentFilesList.SelectedItems.Count > 1)
+            if ((sender as MenuItem) != null)
             {
-                var isSelected = IsSelectedFile(sender);
-                if (!isSelected)
-                {
-                    ShowListViewContentUI();
-                    return;
-                }
-
-                string msg = "";
-                if (RecentFilesList.SelectedItems.Count == RecentFilesList.Items.Count)
-                    msg = "RecentFiles_AllClearMsg";
-                else
-                    msg = "RecentFiles_SelectedClearMsg";
-
-                //if (MessageBoxEx.Show(msg, "", winform.MessageBoxButtons.OKCancel, winform.MessageBoxIcon.Question) == winform.DialogResult.OK)
-                //    RemoveRecentFilesFrom(2);
-                //else
-                //    return;
+                var menuItem = sender as MenuItem;
+                var file = menuItem.DataContext as OpenFileInfo;
+                ViewModel?.ExplorerFileCommand.Execute(file);
             }
-            else
-            {
-                if (MessageBoxEx.Show("RecentFiles_ClearMsg", "", winform.MessageBoxButtons.OKCancel, winform.MessageBoxIcon.Question) != winform.DialogResult.OK)
-                    return;
-
-                OpenFileInfo file = null;
-                if ((sender as MenuItem) != null)
-                {
-                    var menuItem = sender as MenuItem;
-                    file = menuItem.DataContext as OpenFileInfo;
-                    if (file != null)
-                    {
-                        SettingHelper.RemoveRecentOpenFile(file.FilePath);
-                      //  RecentFilesGroup.Remove(file);
-                    }
-                }
-                else if ((sender as Button) != null)
-                {
-                    var btn = sender as Button;
-                    file = btn.DataContext as OpenFileInfo;
-                    if (file != null)
-                    {
-                        SettingHelper.RemoveRecentOpenFile(file.FilePath);
-                      //  RecentFilesGroup.Remove(file);
-                    }
-
-                }
-            }
-            ShowListViewContentUI();
         }
 
+        /// <summary>
+        /// 双击打开最近列表
+        /// </summary>
         private void RecentFilesList_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
         {
             var item = sender as ListViewItem;
             if (item != null && (item.DataContext as OpenFileInfo) != null)
             {
-               
                 var fileInfo = item.DataContext as OpenFileInfo;
                 if(fileInfo != null)
                 {
-                    ViewModel?.OpenFilesCommand.Execute(fileInfo);
-                }
-                if (File.Exists(fileInfo.FilePath))
-                {
-                    //MainWindow parentWindow = Window.GetWindow(this) as MainWindow;
-
-                    //string[] filePath = new string[1];
-                    //filePath[0] = fileInfo.FilePath;
-                    //parentWindow.LoadPdfViewer(filePath);
-                   // ViewModel?.OpenFilesCommand.Execute(fileInfo);
-                }
-                else
-                {
-                   // ViewModel?.RemoveFilesCommand.Execute(fileInfo);
-                    ShowListViewContentUI(); 
+                    ViewModel?.OpenRecentFilesCommand.Execute(fileInfo);
                 }
-
             }
 
         }
 
-        private async void OpenFiles_Click(object sender, RoutedEventArgs e)
+        /// <summary>
+        /// 文件列表项:打开文件
+        /// </summary>
+        private void DocItemListViewControl_OpenFileItemHandler(object sender, RoutedEventArgs e)
         {
-
-            var dlg = new OpenFileDialog();
-            dlg.Multiselect = true;
-            dlg.Filter = Properties.Resources.OpenDialogFilter;
-
-            if (dlg.ShowDialog() == true)
+            var item = (sender as MenuItem).DataContext as OpenFileInfo;
+            if (item != null)
             {
-                await Task.Delay(3);
-                MainWindow parentWindow = Window.GetWindow(this) as MainWindow;
-                parentWindow.LoadPdfViewer(dlg.FileNames);
+                ViewModel?.OpenRecentFilesCommand.Execute(item);
             }
         }
-        #endregion
 
-   
-        private void FilePathMenuItem_Click(object sender, RoutedEventArgs e)
+        /// <summary>
+        ///  文件列表项:删除文件记录
+        /// </summary>
+        private void DocItemListViewControl_DeleteItemHandler(object sender, RoutedEventArgs e)
         {
-
+            var item = (sender as MenuItem).DataContext as OpenFileInfo;
+            if (item != null)
+            {
+                ViewModel?.RemoveFileItemCommand.Execute(item);
+            }
         }
 
-      
+        #endregion
     }
 }