HomePageConverterCSVViewModel.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using PDF_Master.Model;
  2. using Prism.Commands;
  3. using Prism.Mvvm;
  4. using Prism.Regions;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. namespace PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageConverter
  9. {
  10. public class HomePageConverterCSVViewModel : BindableBase, INavigationAware
  11. {
  12. #region 委托声明
  13. public DelegateCommand<string> RadioButtonCommand { get; set; }
  14. public HomePageConverterDialogViewModel homePageConverterDialogViewModel { get; set; }
  15. #endregion
  16. public HomePageConverterCSVViewModel()
  17. {
  18. RadioButtonCommand = new DelegateCommand<string>(radiobutton);
  19. }
  20. #region 逻辑函数
  21. private void radiobutton(string e)
  22. {
  23. string radioButton = e;
  24. if (radioButton != null)
  25. {
  26. switch (radioButton)
  27. {
  28. case "ForEachPageRadioBtn":
  29. homePageConverterDialogViewModel.ConverterCSVModel.Options.IsMergeCsv = false;
  30. break;
  31. case "OnlyTableRadioBtn":
  32. homePageConverterDialogViewModel.ConverterCSVModel.Options.IsMergeCsv = true;
  33. break;
  34. default:
  35. break;
  36. }
  37. }
  38. }
  39. #endregion
  40. #region 构架行为
  41. public void OnNavigatedTo(NavigationContext navigationContext)
  42. {
  43. var homePageConverterVM = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as HomePageConverterDialogViewModel;
  44. if (homePageConverterVM != null)
  45. {
  46. homePageConverterDialogViewModel = homePageConverterVM;
  47. homePageConverterDialogViewModel.ConverterCSVModel.Options.IsMergeCsv = false;
  48. }
  49. }
  50. public bool IsNavigationTarget(NavigationContext navigationContext)
  51. {
  52. return true;
  53. }
  54. public void OnNavigatedFrom(NavigationContext navigationContext)
  55. {
  56. }
  57. #endregion
  58. }
  59. }