12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using PDF_Master.ViewModels.EditTools.Bates;
- using PDF_Master.ViewModels.EditTools.HeaderFooter;
- 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_Master.Views.EditTools.HeaderFooter
- {
- /// <summary>
- /// Interaction logic for HeaderFooterTemplateListContent
- /// </summary>
- public partial class HeaderFooterTemplateListContent : UserControl
- {
- private HeaderFooterTemplateListContentViewModel viewModel;
- public HeaderFooterTemplateListContent()
- {
- InitializeComponent();
- viewModel = this.DataContext as HeaderFooterTemplateListContentViewModel;
- }
- 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 { }
- }
- }
- }
|