DFLayoutDocumentFieldProperties.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. namespace InABox.Core
  3. {
  4. public class DFLayoutDocumentFieldProperties : DFLayoutFieldProperties<Guid>
  5. {
  6. public string? FileMask { get; set; }
  7. public override string FormatValue(object? value)
  8. {
  9. return value != null ? "Yes" : "";
  10. }
  11. public override object? ParseValue(object? value)
  12. {
  13. if (value is Guid)
  14. return value;
  15. if (value is string)
  16. try
  17. {
  18. return Guid.Parse(value as string);
  19. }
  20. catch (Exception)
  21. {
  22. return null;
  23. }
  24. return null;
  25. }
  26. protected override void LoadProperties()
  27. {
  28. base.LoadProperties();
  29. FileMask = GetProperty("FileMask", FileMask);
  30. }
  31. protected override void SaveProperties()
  32. {
  33. base.SaveProperties();
  34. SetProperty("FileMask", FileMask);
  35. }
  36. }
  37. }