40 lines
773 B
C#
40 lines
773 B
C#
namespace CustomsComponentsVar2;
|
||
|
||
public partial class CustomDateTimePicker : UserControl
|
||
{
|
||
public CustomDateTimePicker()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
public event EventHandler<DateTime> _dateChanged;
|
||
public DateTime dateStart;
|
||
public DateTime dateEnd;
|
||
public DateTime date
|
||
{
|
||
get
|
||
{
|
||
if (dateStart == null || dateEnd == null)
|
||
{
|
||
throw new RangeNotSetException("Не задан диапазон.");
|
||
}
|
||
if (date < dateStart && date > dateEnd)
|
||
{
|
||
throw new ValueNotInRangeException("Значение не входит в диапазон");
|
||
}
|
||
return date;
|
||
}
|
||
set
|
||
{
|
||
if (value >= dateStart && value <= dateEnd)
|
||
{
|
||
date = value;
|
||
}
|
||
}
|
||
}
|
||
|
||
public void dateChanged(DateTime date)
|
||
{
|
||
_dateChanged?.Invoke(this, date);
|
||
}
|
||
}
|