|
// ****************************************************************************
// <copyright file="NotificationMessageActionGeneric.cs" company="GalaSoft Laurent Bugnion">
// Copyright © GalaSoft Laurent Bugnion 2009-2011
// </copyright>
// ****************************************************************************
// <author>Laurent Bugnion</author>
// <email>laurent@galasoft.ch</email>
// <date>29.11.2009</date>
// <project>GalaSoft.MvvmLight</project>
// <web>http://www.galasoft.ch</web>
// <license>
// See license.txt in this solution or http://www.galasoft.ch/license_MIT.txt
// </license>
// ****************************************************************************
using System;
////using GalaSoft.Utilities.Attributes;
namespace CBR.Core.Helpers
{
/// <summary>
/// Provides a message class with a built-in callback. When the recipient
/// is done processing the message, it can execute the callback to
/// notify the sender that it is done. Use the <see cref="Execute" />
/// method to execute the callback. The callback method has one parameter.
/// <seealso cref="NotificationMessageAction"/>.
/// </summary>
/// <typeparam name="TCallbackParameter">The type of the callback method's
/// only parameter.</typeparam>
public class NotificationMessageAction<TCallbackParameter> : NotificationMessageWithCallback
{
/// <summary>
/// Initializes a new instance of the
/// <see cref="NotificationMessageAction<TCallbackParameter>" /> class.
/// </summary>
/// <param name="notification">An arbitrary string that will be
/// carried by the message.</param>
/// <param name="callback">The callback method that can be executed
/// by the recipient to notify the sender that the message has been
/// processed.</param>
public NotificationMessageAction(string notification, Action<TCallbackParameter> callback)
: base(notification, callback)
{
}
/// <summary>
/// Initializes a new instance of the
/// <see cref="NotificationMessageAction<TCallbackParameter>" /> class.
/// </summary>
/// <param name="sender">The message's sender.</param>
/// <param name="notification">An arbitrary string that will be
/// carried by the message.</param>
/// <param name="callback">The callback method that can be executed
/// by the recipient to notify the sender that the message has been
/// processed.</param>
public NotificationMessageAction(object sender, string notification, Action<TCallbackParameter> callback)
: base(sender, notification, callback)
{
}
/// <summary>
/// Initializes a new instance of the
/// <see cref="NotificationMessageAction<TCallbackParameter>" /> class.
/// </summary>
/// <param name="sender">The message's sender.</param>
/// <param name="target">The message's intended target. This parameter can be used
/// to give an indication as to whom the message was intended for. Of course
/// this is only an indication, amd may be null.</param>
/// <param name="notification">An arbitrary string that will be
/// carried by the message.</param>
/// <param name="callback">The callback method that can be executed
/// by the recipient to notify the sender that the message has been
/// processed.</param>
public NotificationMessageAction(
object sender,
object target,
string notification,
Action<TCallbackParameter> callback)
: base(sender, target, notification, callback)
{
}
/// <summary>
/// Executes the callback that was provided with the message.
/// </summary>
/// <param name="parameter">A parameter requested by the message's
/// sender and providing additional information on the recipient's
/// state.</param>
public void Execute(TCallbackParameter parameter)
{
base.Execute(parameter);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
WPF and MVVM fan, I practice C # in all its forms from the beginning of the NET Framework without mentioning C ++ / MFC and other software packages such as databases, ASP, WCF, Web & Windows services, Application, and now Core and UWP.
In my wasted hours, I am guilty of having fathered C.B.R. and its cousins C.B.R. for WinRT and UWP on the Windows store.
But apart from that, I am a great handyman ... the house, a rocket stove to heat the jacuzzi and the last one: a wood oven for pizza, bread, and everything that goes inside
https://guillaumewaser.wordpress.com/
https://fouretcompagnie.wordpress.com/