123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- 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;
- using ComPDFKit.PDFDocument;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.Helper;
- using PDFSettings.Settings;
- namespace PDF_Office.Views.HomePanel.RecentFiles
- {
- /// <summary>
- /// DocItemListViewControl.xaml 的交互逻辑
- /// </summary>
- 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 DocItemListViewControl()
- {
- InitializeComponent();
- SetLangText();
- }
- private void SetLangText()
- {
- }
- #region UI
- public bool IsHoverState
- {
- get { return (bool)GetValue(IsHoverStateProperty); }
- set { SetValue(IsHoverStateProperty, value); }
- }
- public static readonly DependencyProperty IsHoverStateProperty =
- DependencyProperty.Register("IsHoverState", typeof(bool), typeof(DocItemListViewControl), new PropertyMetadata(false));
- private void UserControl_MouseEnter(object sender, MouseEventArgs e)
- {
- IsHoverState = true;
- }
- private void UserControl_MouseLeave(object sender, MouseEventArgs e)
- {
- IsHoverState = false;
- }
- private void UserControl_MouseMove(object sender, MouseEventArgs e)
- {
- IsHoverState = true;
- }
- private void MoreButton_Initialized(object sender, EventArgs e)
- {
- MoreButton.ContextMenu = null;
- }
- private void MoreButton_Click(object sender, RoutedEventArgs e)
- {
- MenuMore.PlacementTarget = MoreButton;
- MenuMore.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
- MenuMore.IsOpen = true;
- }
- #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)
- {
- DeleteItemHandler.Invoke(sender, e);
- }
- private void MenuFilePath_Click(object sender, RoutedEventArgs e)
- {
- FilePathItemHandler.Invoke(sender, e);
- }
- private void MenuMore_Loaded(object sender, RoutedEventArgs e)
- {
- }
- private void Grid_Loaded(object sender, RoutedEventArgs e)
- {
- var grid = sender as Grid;
- if (grid != null)
- {
- var data = grid.DataContext as OpenFileInfo;
- if (data == null) return;
- if (File.Exists(data.ThumbImgPath))
- {
- CoverImage.Source = ToolMethod.GetFileThumbImg(data.ThumbImgPath);
- }
- else if (data.ThumbImgPath.Equals("pack://application:,,,/Resources/FilesType/ic_propertybar_file_pdf_lock.png"))
- CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources/FilesType/ic_propertybar_file_pdf_lock.png");
- else//最近文档 但是删除了缩略图的情况
- CoverImage.Source = ToolMethod.GetFileThumbImg("pack://application:,,,/Resources/FilesType/ic_propertybar_file_png_Large.png");
- }
- }
-
- }
- }
|