diff --git a/src/Umbraco.Core/Events/CancellableEventArgs.cs b/src/Umbraco.Core/Events/CancellableEventArgs.cs
new file mode 100644
index 0000000000..80e69ae353
--- /dev/null
+++ b/src/Umbraco.Core/Events/CancellableEventArgs.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Security.Permissions;
+
+namespace Umbraco.Core.Events
+{
+ ///
+ /// Event args for that can support cancellation
+ ///
+ [HostProtection(SecurityAction.LinkDemand, SharedState = true)]
+ public class CancellableEventArgs : EventArgs
+ {
+ private bool _cancel;
+
+ public CancellableEventArgs(bool canCancel)
+ {
+ CanCancel = canCancel;
+ }
+
+ public CancellableEventArgs()
+ : this(true)
+ {
+ }
+ ///
+ /// Flag to determine if this instance will support being cancellable
+ ///
+ public bool CanCancel { get; set; }
+
+ ///
+ /// If this instance supports cancellation, this gets/sets the cancel value
+ ///
+ public bool Cancel
+ {
+ get
+ {
+ if (!CanCancel)
+ {
+ throw new InvalidOperationException("This event argument class does not support cancelling.");
+ }
+ return _cancel;
+ }
+ set
+ {
+ if (!CanCancel)
+ {
+ throw new InvalidOperationException("This event argument class does not support cancelling.");
+ }
+ _cancel = value;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Events/CancellableObjectEventArgs.cs b/src/Umbraco.Core/Events/CancellableObjectEventArgs.cs
index b4efcca229..736f8c4361 100644
--- a/src/Umbraco.Core/Events/CancellableObjectEventArgs.cs
+++ b/src/Umbraco.Core/Events/CancellableObjectEventArgs.cs
@@ -1,4 +1,3 @@
-using System;
using System.Security.Permissions;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
@@ -10,14 +9,13 @@ namespace Umbraco.Core.Events
///
///
[HostProtection(SecurityAction.LinkDemand, SharedState = true)]
- public class CancellableObjectEventArgs : EventArgs, ICancellableObjectEventArgs
+ public class CancellableObjectEventArgs : CancellableEventArgs
{
- private bool _cancel;
public CancellableObjectEventArgs(T entity, bool canCancel)
+ : base(canCancel)
{
Entity = entity;
- CanCancel = canCancel;
}
public CancellableObjectEventArgs(T entity)
@@ -25,33 +23,6 @@ namespace Umbraco.Core.Events
{
}
- ///
- /// Flag to determine if this instance will support being cancellable
- ///
- public bool CanCancel { get; set; }
-
- ///
- /// If this instance supports cancellation, this gets/sets the cancel value
- ///
- public bool Cancel
- {
- get
- {
- if (!CanCancel)
- {
- throw new InvalidOperationException("This event argument class does not support cancelling.");
- }
- return _cancel;
- }
- set
- {
- if (!CanCancel)
- {
- throw new InvalidOperationException("This event argument class does not support cancelling.");
- }
- _cancel = value;
- }
- }
public T Entity { get; private set; }
diff --git a/src/Umbraco.Core/Events/EventExtensions.cs b/src/Umbraco.Core/Events/EventExtensions.cs
index 60a823a725..99cf145fe0 100644
--- a/src/Umbraco.Core/Events/EventExtensions.cs
+++ b/src/Umbraco.Core/Events/EventExtensions.cs
@@ -20,7 +20,7 @@ namespace Umbraco.Core.Events
this TypedEventHandler eventHandler,
TArgs args,
TSender sender)
- where TArgs : ICancellableObjectEventArgs
+ where TArgs : CancellableEventArgs
{
if (eventHandler != null)
eventHandler(sender, args);
diff --git a/src/Umbraco.Core/Events/ICancellableObjectEventArgs.cs b/src/Umbraco.Core/Events/ICancellableObjectEventArgs.cs
deleted file mode 100644
index 871362d9db..0000000000
--- a/src/Umbraco.Core/Events/ICancellableObjectEventArgs.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Umbraco.Core.Events
-{
- ///
- /// Interface for EventArgs clases to implement when they support cancelling operations
- ///
- public interface ICancellableObjectEventArgs
- {
- ///
- /// If this instance supports cancellation, this gets/sets the cancel value
- ///
- bool Cancel { get; set; }
-
- ///
- /// Flag to determine if this instance will support being cancellable
- ///
- bool CanCancel { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 909e74b89b..10487ee9ba 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -117,12 +117,12 @@
+
-