using System; using Caliburn.Execution; namespace Caliburn.Metadata { public abstract class InfoBase : MetadataContainer { private IUnboundMethod _rescueMethod; public bool HasRescue { get { return _rescueMethod != null; } } public bool PerformRescue(object presenterInstance, Exception exception) { if(HasRescue) { _rescueMethod.Execute(presenterInstance, exception); return true; } else return false; } public void InitializeRescue(Type instanceType, string methodName) { _rescueMethod = UnboundMethodFactory.Create(instanceType.GetMethod(methodName)); } } }