代码是不言自明的:
public class TooLateValidator : IApplicationStartupHandler
{
public TooLateValidator()
{
ContentService.Saving += ContentService_Saving;
}
private void ContentService_Saving(IContentService sender, Umbraco.Core.Events.SaveEventArgs<Umbraco.Core.Models.IContent> e)
{
if(DateTime.Now.Hour > 21){
e.Cancel = true;
//validation message: "it's too late for that"
// how do I throw this message to UI??
}
}
}
我正在使用 Umbraco 6。