如何在 Umbraco 默认弹出窗口中发送错误消息?

How to send a error Message in Umbraco default popup?

我正在这样挂接发布事件:

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
}

当用户 "Saving and publish" 内容时,我想用我的自定义错误消息显示 umbraco 默认错误弹出窗口。

可能吗? 提前致谢。

在你的 ContentService_Published 方法中,我相信你可以这样做:

e.Cancel = true;
e.Messages.Add(new EventMessage("Ouch!", "Better try that again but more gently this time!!!", EventMessageType.Error));