using PDF_Office.Model.AnnotPanel;
using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
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.PropertyPanel.AnnotPanel
{
    /// <summary>
    /// SignatureAnnotProperty.xaml 的交互逻辑
    /// </summary>
    public partial class SignatureAnnotProperty : UserControl
    {
        public SignatureAnnotProperty()
        {
            InitializeComponent();
        }

        private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            (DataContext as SignatureAnnotPropertyViewModel).SetSignature((sender as ListBoxItem).DataContext as Signature);
        }

        private void Save_Click(object sender, RoutedEventArgs e)
        {

            MenuItem item = sender as MenuItem;
            (DataContext as SignatureAnnotPropertyViewModel).SaveToPath(item.Tag.ToString(), item.DataContext as Signature);
        }

        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            (DataContext as SignatureAnnotPropertyViewModel).DeleteSignature(item.DataContext as Signature);
        }

        private void DeleteAll_Click(object sender, RoutedEventArgs e)
        {
            (DataContext as SignatureAnnotPropertyViewModel).DeleteAll();
        }
    }
}
