CPDFStampUIViewModel.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using compdfkit_tools.Data;
  2. using compdfkit_tools.Properties;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.ComponentModel;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace compdfkit_tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI
  12. {
  13. public class CPDFStampUIViewModel : INotifyPropertyChanged
  14. {
  15. public event PropertyChangedEventHandler PropertyChanged;
  16. public void RaisePropertyChanged(string PropertyName)
  17. {
  18. if (this.PropertyChanged!=null)
  19. {
  20. this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(PropertyName));
  21. }
  22. }
  23. public ObservableCollection<CPDFStampData> StandardStampList { get; set; }
  24. public ObservableCollection<CPDFStampData> CustomStampList { get; set; }
  25. public CPDFStampUIViewModel()
  26. {
  27. StandardStampList = new ObservableCollection<CPDFStampData>();
  28. CustomStampList = new ObservableCollection<CPDFStampData>();
  29. InitStandardStamp();
  30. LoadSettings();
  31. }
  32. public void InitStandardStamp()
  33. {
  34. }
  35. /// <summary>
  36. /// Loading CacheStamp
  37. /// </summary>
  38. public void LoadSettings()
  39. {
  40. }
  41. public void DeleteStamp(CPDFStampData stampData)
  42. {
  43. int index = CustomStampList.IndexOf(stampData);
  44. DirectoryInfo CreatedFilePathFolder = new DirectoryInfo(stampData.SourcePath);
  45. if (CreatedFilePathFolder.Exists)
  46. {
  47. Directory.Delete(stampData.SourcePath, true);
  48. }
  49. CustomStampList.RemoveAt(index);
  50. }
  51. }
  52. }