12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using ComPDFKitViewer;
- using PDF_Master.ViewModels.Dialog.HomePageToolsDialogs;
- using PDF_Master.ViewModels.EditTools.Watermark;
- using PDFSettings;
- using System;
- using System.Collections;
- using System.Diagnostics;
- using System.IO;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media.Imaging;
- namespace PDF_Master.Views.EditTools.Watermark
- {
- /// <summary>
- /// Interaction logic for WatermarkTemplateListFileContent
- /// </summary>
- public partial class WatermarkTemplateListFileContent : UserControl
- {
- private WatermarkTemplateListFileContentViewModel viewModel;
- public WatermarkTemplateListFileContent()
- {
- InitializeComponent();
- viewModel = this.DataContext as WatermarkTemplateListFileContentViewModel;
- }
- private void DeleteTemplateBtn_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- viewModel.DeleteTemplateItemCommand?.Execute(sender);
- }
- private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- IList list = FileWatermarkListbox.SelectedItems;
- var lists = FileWatermarkListbox.Items;
- foreach (var item in list)
- {
-
- Trace.WriteLine( lists.IndexOf(item));
- }
- viewModel.SelectTemplateItemCommand?.Execute(sender);
- //FileWatermarkListbox.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 { }
- }
- }
- }
|