我正在挂像这样的publish事件:
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Published += ContentService_Published;
}
private void ContentService_Published(global::Umbraco.Core.Publishing.IPublishingStrategy sender, PublishEventArgs<IContent> e)
{
// My code , Send Error
}
当用户“保存并发布”一个内容时,我想显示umbraco默认错误弹出窗口,其中包含我的自定义错误消息中的错误。
有可能吗? 预先感谢。
答案 0 :(得分:1)
在您的ContentService_Published
方法中,我相信您可以执行以下操作:
e.Cancel = true;
e.Messages.Add(new EventMessage("Ouch!", "Better try that again but more gently this time!!!", EventMessageType.Error));