namespace Caliburn.Micro.Core {
///
/// A result decorator that overrides of the decorated instance.
///
public class OverrideCancelResultDecorator : ResultDecoratorBase {
static readonly ILog Log = LogManager.GetLog(typeof(OverrideCancelResultDecorator));
///
/// Initializes a new instance of the class.
///
/// The result to decorate.
public OverrideCancelResultDecorator(IResult result)
: base(result) { }
///
/// Called when the execution of the decorated result has completed.
///
/// The context.
/// The decorated result.
/// The instance containing the event data.
protected override void OnInnerResultCompleted(CoroutineExecutionContext context, IResult innerResult, ResultCompletionEventArgs args) {
if (args.WasCancelled)
Log.Info(string.Format("Overriding WasCancelled from {0}.", innerResult.GetType().Name));
OnCompleted(new ResultCompletionEventArgs { Error = args.Error });
}
}
}