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>
    /// StampAnnotProperty.xaml 的交互逻辑
    /// </summary>
    public partial class StampAnnotProperty : UserControl
    {
        public StampAnnotProperty()
        {
            InitializeComponent();
        }

        private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            (DataContext as StampAnnotPropertyViewModel).SetStamp((sender as ListBoxItem).DataContext as Stamp);
        }

        private void DydamicListBox_Loaded(object sender, RoutedEventArgs e)
        {
            (DataContext as StampAnnotPropertyViewModel).UpDataDynamicStampList();
        }

        private void Save_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            (DataContext as StampAnnotPropertyViewModel).SaveToPath(item.Tag.ToString(), item.DataContext as Stamp);
        }

        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            (DataContext as StampAnnotPropertyViewModel).DeleteStamp(item.DataContext as Stamp);
        }

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

        private void Editor_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            (DataContext as StampAnnotPropertyViewModel).EditorCustomStamp(item.DataContext as Stamp);
        }
    }
}
