123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using PDF_Office.CustomControl;
- using PDF_Office.Helper;
- 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)
- {
- ListBox listBox = CommonHelper.FindVisualParent<ListBox>(sender as ListBoxItem);
- if (listBox != null)
- {
- if (listBox.Tag!=null&&listBox.Tag.ToString() == "Dynamic")
- {
- (DataContext as StampAnnotPropertyViewModel).SetDynamicStamp((sender as ListBoxItem).DataContext as Stamp);
- return;
- }
- }
- (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)
- {
- if (sender is MenuItem)
- {
- MenuItem item = sender as MenuItem;
- (DataContext as StampAnnotPropertyViewModel).DeleteStamp(item.DataContext as Stamp);
- }
- else if (sender is Button)
- {
- Button item = sender as Button;
- (DataContext as StampAnnotPropertyViewModel).DeleteStamp(item.DataContext as Stamp);
- }
- }
- private void DeleteAll_Click(object sender, RoutedEventArgs e)
- {
- AlertsMessage alertsMessage = new AlertsMessage();
- alertsMessage.ShowDialog("提示", "确定要全部删除吗?", "Cancel", "OK");
- if (alertsMessage.result == ContentResult.Ok)
- {
- (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);
- }
- private void UserControl_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Escape)
- {
- (DataContext as StampAnnotPropertyViewModel).Close();
- e.Handled = true;
- }
- }
- private void UserControl_Loaded(object sender, RoutedEventArgs e)
- {
- AnnoteTypeTitle.Text= App.MainPageLoader.GetString("Stamp_Title");
- }
- }
- }
|