123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using PDF_Office.ViewModels.EditTools.Background;
- using PDF_Office.ViewModels.EditTools.Bates;
- using PDFSettings;
- using System.Diagnostics;
- using System.Windows;
- using System;
- using System.Windows.Controls;
- using System.Windows.Media.Imaging;
- using System.IO;
- using System.Collections.Generic;
- namespace PDF_Office.Views.EditTools.Bates
- {
- /// <summary>
- /// Interaction logic for BatesTemplateListContentContent
- /// </summary>
- public partial class BatesTemplateListContent : UserControl
- {
- private BatesTemplateListContentViewModel viewModel;
- public BatesTemplateListContent()
- {
- InitializeComponent();
- viewModel = this.DataContext as BatesTemplateListContentViewModel;
- }
- 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 BatesHeaderFooterItem;
- var TemplateIndex = panel.FindName("TemplateIndexTextBox") as TextBlock;
- var LeftHeader = panel.FindName("LeftHeaderTextBox") as TextBlock;
- var RightHeader = panel.FindName("RightHeaderTextBox") as TextBlock;
- var CenterHeader = panel.FindName("CenterHeaderTextBox") as TextBlock;
- var LeftFooter = panel.FindName("LeftFooterTextBox") as TextBlock;
- var RightFooter = panel.FindName("RightFooterTextBox") as TextBlock;
- var CenterFooter = panel.FindName("CenterFooterTextBox") as TextBlock;
- List<TextBlock> textBlocks = new List<TextBlock>() { LeftHeader, RightHeader, CenterHeader, LeftFooter, RightFooter, CenterFooter };
- if (data.TextData != null)
- {
- TemplateIndex.Text = data.ItemName;
- foreach (var textBlock in textBlocks)
- {
- textBlock.Text = data.TextData[textBlocks.IndexOf(textBlock)].text;
- if (textBlock.Text == "") { textBlock.Visibility = Visibility.Collapsed; }
- else { textBlock.Visibility = Visibility.Visible; }
- }
- }
- }
- catch { }
- }
- }
- }
|