AI OnAI Off
Hi Raymond,
Have you resolved the issue? Seems that I have faced the same..
Works in EPiServer 9 at least...tried this:
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))] public class EventsInitialization : IInitializableModule { private IContentEvents _contentEvents; public void Initialize(InitializationEngine context) { if (_contentEvents == null) { _contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>(); } _contentEvents.MovingContent += Moving;
....
private void Moving(object sender, ContentEventArgs e) { var args = e as MoveContentEventArgs; if (args != null) { args.CancelAction = true; args.CancelReason = "this didn't work out at all"; } }
....
public void Uninitialize(InitializationEngine context) { if (_contentEvents == null) { _contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>(); } _contentEvents.MovingContent -= Moving;
...
Works like a charm!
I want to controll the deletion of blocks and send a message to the user. So I setup the event Instance_MovingPage in EPiServer.DataFactory.Instance. In the event I set a message for the user in e.CancelReason and e.CancelAction = true. The move is canceled but my reason message is not displayed. There is a standard message displayed instead.
Isn´t this supposed to work?
/Raymond