using System;
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public class DialogClosingEventArgs : RoutedEventArgs
{
public DialogClosingEventArgs(DialogSession session, object parameter)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Session = session;
Parameter = parameter;
}
public DialogClosingEventArgs(DialogSession session, object parameter, RoutedEvent routedEvent) : base(routedEvent)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Session = session;
Parameter = parameter;
}
public DialogClosingEventArgs(DialogSession session, object parameter, RoutedEvent routedEvent, object source) : base(routedEvent, source)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Session = session;
Parameter = parameter;
}
///
/// Cancel the close.
///
public void Cancel()
{
IsCancelled = true;
}
///
/// Indicates if the close has already been cancelled.
///
public bool IsCancelled { get; private set; }
///
/// Gets the paramter originally provided to /
///
public object Parameter { get; }
///
/// Allows interation with the current dialog session.
///
public DialogSession Session { get; }
///
/// Gets the which is currently displayed, so this could be a view model or a UI element.
///
[Obsolete("Prefer Session.Content")]
public object Content => Session.Content;
}
}