Developer forum

Forum » Development » DW Events in C#

DW Events in C#


Reply

Hello


 


Any body have a little sample code for using the DynamicWeb standard Event(described in the Extensibility API Doc. page 16) in C# ?


 


When looking for over the API before i started on this module it looked strait forward - but im failing to invoke thise events no matter what.


 


- Regards


Replies

 
Reply
Hi,



There is a class-consumer of the DW page loaded event:



//------------------------------------------------------

using Dynamicweb;

using Dynamicweb.Frontend;

using Dynamicweb.Extensibility;



namespace CustomModules.NotificationTest

{

    [Subscribe(Dynamicweb.Notifications.Standard.Page.Loaded)]

    public class PageLoadSubscriber : NotificationSubscriber

    {

        public override void OnNotify(string notification, object[] args)

        {

            if (args != null && args.Length > 0)

            {

                PageView pv = args[0] as PageView;

                if (pv != null)

                {

                   // you can do anything here for every DW page load event

                }

            }

        }

    }

}

//------------------------------------------------------



Let me know if something is still unclear.



Vitaly.
 
Reply

Hey, 




Have tried with this solution earlier with out success - how ever that didnt work out.




 




I am abit suspecious that the Event eCommence.order.State.Change event returns a String and not a Event like it should ?

 
Reply
The example I posted above doesn't use the "eCommence.order.State.Change" event, but did you try my example? Does it work for you? If not - describe in details, please, how do you test it. If yes, send me, your non-working code with the "eCommence.order.State.Change" event, will try to find out the reason.

 

You must be logged in to post in the forum