| 12345678910111213141516171819202122232425262728293031323334353637383940 | using System;namespace InABox.Core{    public class DFLayoutDateFieldProperties : DFLayoutFieldProperties<DateTime>    {        public DFLayoutDateFieldProperties()        {            Format = "dd MMM yy";        }        public string Format { get; set; }        public override string FormatValue(object? value)        {            return string.Format("{0" + (string.IsNullOrWhiteSpace(Format) ? "" : ":" + Format.Replace(":", "\\:")) + "}", value);        }        public override object? ParseValue(object? value)        {            if (value is DateTime)                return value;            if (DateTime.TryParse(value as string, out var result))                return result;            return null;        }        protected override void LoadProperties()        {            base.LoadProperties();            Format = GetProperty("Format", Format);        }        protected override void SaveProperties()        {            base.SaveProperties();            SetProperty("Format", Format);        }    }}
 |