Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm having trouble registering events with ApplicationEventHandler:
public class RegisterEvents : ApplicationEventHandler
//this is never hit...
Any ideas what may be causing this?
This is because ApplicationEventHandler is a base class. So you need to override the methods you want to use. Probably the ApplicationStarted can be a good method to override.
Here you can find an example which will probably help you out: Events Documentation
Could you please advise how to get code of RegisterEvents class to be executed by Umbraco?
Should I register the class somehow (e.g. in Global.asax ) ?
Or should it be installed as part of custom plugin?
Any help is very appreciated.
Arjan, please ignore my question. I've already find out - Umbraco automatically resolves any inherited classes from ApplicationEventHandler. So no special 'registration' needed.
Arjan, thank you for your reply. I have already tried overriding the methods. None of them fire unfortunately. And I think you are wrong, I don't think you have to override a method, unless you need something from the Umbraco context. I also found an example of what I'm trying to do here, but as I said the constructor is never hit.
You are right it should call your constructor. What are you trying to achieve?
I'm actually implementing Tea Commerce and would like to cancel the sending of the confirmation emails when the order status is different from 'authorized'. And that example is very close to what I need, just that in EmailTemplate_MailSending I set the mailMessage to null in some situations.
There is something weird with the site, I just can't put my finger on it. For example unless I add in views (that do inherit UmbracoTemplatePage) a 'using' directive for the Umbraco.Web namespace, intellisense tells me extensions like GetPropertyValue don't exist on Model.Content... The view still works without the 'using' though. Umbraco was added to an MVC project created with Visual Studio 2013, and it defaulted to MVC 5, so I had to update some of the System assemblies for it to work, but there were no problems there, and I see no reason for this to cause such problems.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted