DFLayoutOptionFieldProperties.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace InABox.Core
  2. {
  3. public class DFLayoutOptionFieldProperties : DFLayoutFieldProperties<string>
  4. {
  5. public DFLayoutOptionFieldProperties()
  6. {
  7. Options = "";
  8. OptionType = DFLayoutOptionType.Combo;
  9. }
  10. [MemoEditor]
  11. [EditorSequence(1)]
  12. public string Options { get; set; }
  13. [EnumLookupEditor(typeof(DFLayoutOptionType))]
  14. [EditorSequence(2)]
  15. public DFLayoutOptionType OptionType { get; set; }
  16. protected override void LoadProperties()
  17. {
  18. base.LoadProperties();
  19. Options = GetProperty("Options", "");
  20. OptionType = GetProperty("OptionType", DFLayoutOptionType.Combo);
  21. }
  22. protected override void SaveProperties()
  23. {
  24. base.SaveProperties();
  25. SetProperty("Options", Options);
  26. SetProperty("OptionType", OptionType);
  27. }
  28. public override object ParseValue(object value)
  29. {
  30. return value?.ToString();
  31. }
  32. public override string FormatValue(object value)
  33. {
  34. return value?.ToString() ?? "";
  35. }
  36. }
  37. }