123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using PDF_Master.ViewModels.EditTools.Background;
- 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.Background
- {
- /// <summary>
- /// Interaction logic for BackgroundTemplateListFileContent
- /// </summary>
- public partial class BackgroundTemplateListFileContent : UserControl
- {
- private BackgroundTemplateListFileContentViewModel viewModel;
- public BackgroundTemplateListFileContent()
- {
- InitializeComponent();
- viewModel = this.DataContext as BackgroundTemplateListFileContentViewModel;
- }
- private void DeleteTemplateBtn_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- viewModel.DeleteTemplateItemCommand?.Execute(sender);
- }
- private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var listBox = sender as ListBox;
- viewModel.SelectTemplateItemCommand?.Execute(sender);
- //listBox.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 BackgroundItem;
- var img = panel.FindName("BackgroundPreview") 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 { }
- }
- }
- }
|