DFLayoutSignaturePadProperties.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. namespace InABox.Core
  4. {
  5. // need to add a property to signaturefield (manager signature or something) that prevents a form being saved for later if the
  6. // manager signature is present - ensures that form is completed and submitted / cannot be changed
  7. public class DFLayoutSignaturePadProperties : DFLayoutFieldProperties<byte[], byte[]?>
  8. {
  9. [EditorSequence(-995)]
  10. [NullEditor]
  11. public override byte[] Default { get; set; } = new byte[] { };
  12. public override string FormatValue(byte[]? value)
  13. {
  14. return value != null ? "Yes" : "";
  15. }
  16. public override byte[] GetValue(byte[]? value)
  17. {
  18. return value ?? Array.Empty<byte>();
  19. }
  20. public override byte[]? DeserializeValue(DFLoadStorageEntry entry)
  21. {
  22. return entry.GetValue<byte[]>();
  23. }
  24. public override void SerializeValue(DFSaveStorageEntry entry, byte[]? value)
  25. {
  26. entry.SetValue(value);
  27. }
  28. }
  29. }