HomePagePictureToPDFDialog.xaml.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using DryIoc;
  2. using ImTools;
  3. using PDF_Office.Model.Dialog.HomePageToolsDialogs;
  4. using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Diagnostics;
  9. using System.Windows.Controls;
  10. using System.Windows.Input;
  11. using System.Xml.Linq;
  12. namespace PDF_Office.Views.Dialog.HomePageToolsDialogs
  13. {
  14. /// <summary>
  15. /// Interaction logic for HomePagePictureToPDFDialogs
  16. /// </summary>
  17. public partial class HomePagePictureToPDFDialog : UserControl
  18. {
  19. public HomePagePictureToPDFDialog()
  20. {
  21. InitializeComponent();
  22. }
  23. private void Menu_Click(object sender, System.Windows.RoutedEventArgs e)
  24. {
  25. menuPop1.IsOpen = true;
  26. }
  27. private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
  28. {
  29. IList list = listView.SelectedItems;
  30. var lists = listView.Items;
  31. System.Data.DataRowView a;
  32. ((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Clear();
  33. foreach (var item in list)
  34. {
  35. a = (System.Data.DataRowView)item;
  36. ((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Add(lists.IndexOf(a));
  37. }
  38. if (((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Count > 0)
  39. {
  40. ((HomePagePictureToPDFDialogViewModel)this.DataContext).RemoveIsEnable = "True";
  41. }
  42. else
  43. {
  44. ((HomePagePictureToPDFDialogViewModel)this.DataContext).RemoveIsEnable = "False";
  45. }
  46. }
  47. private void RemoveFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
  48. {
  49. ((HomePagePictureToPDFDialogViewModel)this.DataContext).removepicturefile();
  50. }
  51. private void OpenFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
  52. {
  53. ((HomePagePictureToPDFDialogViewModel)this.DataContext).openfiledialog();
  54. }
  55. private void RadioButton_Click(object sender, System.Windows.RoutedEventArgs e)
  56. {
  57. var radiobutton = sender as RadioButton;
  58. switch (radiobutton.Name.ToString())
  59. {
  60. case "NewFilesRadioButtom":
  61. {
  62. ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles;
  63. }
  64. break;
  65. case "OneNewFileNameRadioButtom":
  66. {
  67. ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile;
  68. }
  69. break;
  70. case "SelectFileNameRadioButton":
  71. {
  72. ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.SelectFileName;
  73. }
  74. break;
  75. default:
  76. break;
  77. }
  78. }
  79. }
  80. }