Пример #1
0
 /// <summary>
 /// Handles the <see cref="DatePickerDateTextBox.CheckDate"/> event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// A <see cref="CheckDateEventArgs"/> that contains the event data.
 /// </param>
 private void DateTextBoxCheckDate(object sender, CheckDateEventArgs e)
 {
     this.enhancedMonthCalendar.SelectionRange = new SelectionRange(e.Date, e.Date);
     this.enhancedMonthCalendar.EnsureSeletedDateIsVisible();
     CheckDateEventArgs newArgs = new CheckDateEventArgs(e.Date, this.IsValidDate(e.Date));
     this.OnValueChanged(newArgs);
     e.IsValid = newArgs.IsValid;
 }
Пример #2
0
 /// <summary>
 /// Raises the <see cref="ValueChanged"/> event.
 /// </summary>
 /// <param name="e">
 /// A <see cref="EventArgs"/> that contains the event data.
 /// </param>
 private void OnValueChanged(CheckDateEventArgs e)
 {
     if (this.ValueChanged != null)
     {
         this.ValueChanged(this, e);
     }
 }
Пример #3
0
        /// <summary>
        /// Sets the specified <paramref name="date"/> as the currently displayed date.
        /// </summary>
        /// <param name="date">
        /// The date to set.
        /// </param>
        private void SetNewDate(DateTime date)
        {
            this._currentDate = date;

            if (this.CheckDate != null)
            {
                CheckDateEventArgs checkEventArgs = new CheckDateEventArgs(date, true);

                this.CheckDate(this, checkEventArgs);

                this._isValidDate = checkEventArgs.IsValid;

                this.Invalidate();
            }
        }
Пример #4
0
        /// <summary>
        /// The date picker_ value changed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void datePicker_ValueChanged(object sender, CheckDateEventArgs e)
        {
            if (sender == this.departureDatePicker)
            {
                this.returnDatePicker.MinDate = this.departureDatePicker.Value;
            }

            if (this.departureDatePicker.Value > this.returnDatePicker.Value)
            {
                this.returnDatePicker.Value = this.departureDatePicker.Value.AddDays(7);
            }
        }