using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExtensionsDev
{
    public static class DateEditExtension
    {
        public static DateEdit UseDefault(this DateEdit ctrl, string nullPrompt = "", string format = "yyyy-MM-dd HH:mm:ss")
        {
            ctrl.Properties.NullValuePrompt = nullPrompt;
            ctrl.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
            ctrl.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            ctrl.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            ctrl.Properties.VistaTimeProperties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            ctrl.Properties.VistaTimeProperties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            ctrl.Properties.DisplayFormat.FormatString = format;
            ctrl.Properties.EditFormat.FormatString = format;
            ctrl.Properties.Mask.EditMask = format;
            ctrl.Properties.Appearance.Options.UseFont = true;
            ctrl.Properties.UseAdvancedMode = DevExpress.Utils.DefaultBoolean.True;
            ctrl.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.Fluent;
            ctrl.Properties.ShowToday = true;
            ctrl.Properties.ShowClear = true;
            return ctrl;
        }

    }
}
