using System;
using System.Windows.Forms;
namespace Common.Infrastructure.Messaging
{
///
/// A message that can be sent to notify registered listeners that a modal window can be closed.
///
///
/// The type of the modal result.
/// A ViewModel can send back data in the Result property as the result of the modal window.
/// This is handy for capturing information and sending it back to the viewmodel that requested the modal window in the first place.
///
public class CloseModalMessage
{
///
/// Gets the dialog result.
///
/// The dialog result.
public DialogResult DialogResult { get; private set; }
///
/// Gets the result of the modal window.
///
/// The result of the modal window.
public TModalResult Result { get; private set; }
///
/// Initializes a new instance of the class.
///
/// The dialog result.
public CloseModalMessage(DialogResult dialogResult)
: this(dialogResult, default(TModalResult))
{
}
///
/// Initializes a new instance of the class.
///
/// The dialog result.
/// The result.
public CloseModalMessage(DialogResult dialogResult, TModalResult result)
{
DialogResult = dialogResult;
Result = result;
}
}
}