Browse Source

Move CalendarDatePickerDateValidationErrorEventArgs into its own file

pull/7958/head
robloo 4 years ago
parent
commit
d868552713
  1. 78
      src/Avalonia.Controls/Calendar/CalendarDatePicker.cs
  2. 82
      src/Avalonia.Controls/Calendar/CalendarDatePickerDateValidationErrorEventArgs.cs

78
src/Avalonia.Controls/Calendar/CalendarDatePicker.cs

@ -12,87 +12,9 @@ using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Layout;
namespace Avalonia.Controls
{
/// <summary>
/// Provides data for the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </summary>
public class CalendarDatePickerDateValidationErrorEventArgs : EventArgs
{
private bool _throwException;
/// <summary>
/// Initializes a new instance of the
/// <see cref="T:Avalonia.Controls.CalendarDatePickerDateValidationErrorEventArgs" />
/// class.
/// </summary>
/// <param name="exception">
/// The initial exception from the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </param>
/// <param name="text">
/// The text that caused the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </param>
public CalendarDatePickerDateValidationErrorEventArgs(Exception exception, string text)
{
this.Text = text;
this.Exception = exception;
}
/// <summary>
/// Gets the initial exception associated with the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </summary>
/// <value>
/// The exception associated with the validation failure.
/// </value>
public Exception Exception { get; private set; }
/// <summary>
/// Gets the text that caused the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </summary>
/// <value>
/// The text that caused the validation failure.
/// </value>
public string Text { get; private set; }
/// <summary>
/// Gets or sets a value indicating whether
/// <see cref="P:Avalonia.Controls.CalendarDatePickerDateValidationErrorEventArgs.Exception" />
/// should be thrown.
/// </summary>
/// <value>
/// True if the exception should be thrown; otherwise, false.
/// </value>
/// <exception cref="T:System.ArgumentException">
/// If set to true and
/// <see cref="P:Avalonia.Controls.CalendarDatePickerDateValidationErrorEventArgs.Exception" />
/// is null.
/// </exception>
public bool ThrowException
{
get { return this._throwException; }
set
{
if (value && this.Exception == null)
{
throw new ArgumentException("Cannot Throw Null Exception");
}
this._throwException = value;
}
}
}
/// <summary>
/// Specifies date formats for a
/// <see cref="T:Avalonia.Controls.CalendarDatePicker" />.

82
src/Avalonia.Controls/Calendar/CalendarDatePickerDateValidationErrorEventArgs.cs

@ -0,0 +1,82 @@
using System;
namespace Avalonia.Controls
{
/// <summary>
/// Provides data for the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </summary>
public class CalendarDatePickerDateValidationErrorEventArgs : EventArgs
{
private bool _throwException;
/// <summary>
/// Initializes a new instance of the
/// <see cref="T:Avalonia.Controls.CalendarDatePickerDateValidationErrorEventArgs" />
/// class.
/// </summary>
/// <param name="exception">
/// The initial exception from the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </param>
/// <param name="text">
/// The text that caused the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </param>
public CalendarDatePickerDateValidationErrorEventArgs(Exception exception, string text)
{
Text = text;
Exception = exception;
}
/// <summary>
/// Gets the initial exception associated with the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </summary>
/// <value>
/// The exception associated with the validation failure.
/// </value>
public Exception Exception { get; private set; }
/// <summary>
/// Gets the text that caused the
/// <see cref="E:Avalonia.Controls.CalendarDatePicker.DateValidationError" />
/// event.
/// </summary>
/// <value>
/// The text that caused the validation failure.
/// </value>
public string Text { get; private set; }
/// <summary>
/// Gets or sets a value indicating whether
/// <see cref="P:Avalonia.Controls.CalendarDatePickerDateValidationErrorEventArgs.Exception" />
/// should be thrown.
/// </summary>
/// <value>
/// True if the exception should be thrown; otherwise, false.
/// </value>
/// <exception cref="T:System.ArgumentException">
/// If set to true and
/// <see cref="P:Avalonia.Controls.CalendarDatePickerDateValidationErrorEventArgs.Exception" />
/// is null.
/// </exception>
public bool ThrowException
{
get => _throwException;
set
{
if (value && Exception == null)
{
throw new ArgumentException("Cannot Throw Null Exception");
}
_throwException = value;
}
}
}
}
Loading…
Cancel
Save