using System; namespace DTS.Common.Interactivity { public class InteractionRequest : IInteractionRequest where T : INotification { /// /// Fired when interaction is needed. /// public event EventHandler Raised; /// /// Fires the Raised event. /// /// The context for the interaction request. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] public void Raise(T context) { Raise(context, c => { }); } /// /// Fires the Raised event. /// /// The context for the interaction request. /// The callback to execute when the interaction is completed. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] public void Raise(T context, Action callback) { var handler = Raised; if (handler != null) { handler(this, new InteractionRequestedEventArgs(context, () => { if (callback != null) callback(context); })); } } } }