123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using ComPDFKitViewer;
- using PDF_Master.ViewModels.EditTools.Watermark;
- using PDFSettings;
- using System.Diagnostics;
- using System;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media.Imaging;
- using System.IO;
- namespace PDF_Master.Views.EditTools.Watermark
- {
- /// <summary>
- /// Interaction logic for WatermarkTemplateListTextContent
- /// </summary>
- public partial class WatermarkTemplateListTextContent : UserControl
- {
- private WatermarkTemplateListTextContentViewModel viewModel;
- public WatermarkTemplateListTextContent()
- {
- InitializeComponent();
- viewModel = this.DataContext as WatermarkTemplateListTextContentViewModel;
- }
- private void DeleteTemplateBtn_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- viewModel.DeleteTemplateItemCommand?.Execute(sender);
- }
- private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- viewModel.SelectTemplateItemCommand?.Execute(sender);
- //TextWatermarkListbox.SelectedIndex = -1;
- }
- private void MenuEdit_Click(object sender, RoutedEventArgs e)
- {
- viewModel.EditTemplateItemCommand?.Execute(sender);
- }
- private void MenuDeleteCurrent_Click(object sender, RoutedEventArgs e)
- {
- viewModel.DeleteTemplateItemCommand?.Execute(sender);
- }
- private void MenuDeleteAll_Click(object sender, RoutedEventArgs e)
- {
- viewModel.DeleteAllTemplateItemCommand?.Execute();
- }
- private void EditTemplateBtn_Click(object sender, RoutedEventArgs e)
- {
- viewModel.EditTemplateItemCommand?.Execute(sender);
- }
- private void itemPanel_Loaded(object sender, RoutedEventArgs e)
- {
- try
- {
- StackPanel panel = sender as StackPanel;
- var data = panel.DataContext as WatermarkItem;
- var img = panel.FindName("WatermarkPreview") as Image;
- Trace.WriteLine(data.previewImagePath);
- if (!string.IsNullOrEmpty(data.previewImagePath) && File.Exists(data.previewImagePath))
- {
- BitmapSource bmp = new BitmapImage(new Uri(data.previewImagePath));
- img.Source = bmp;
- }
- }
- catch { }
- }
- }
- }
|