Dynamicweb.Notifications Namespace > Module Class : Added Field |
namespace Dynamicweb.Examples.CSharp.Notifications { [Extensibility.Subscribe(Dynamicweb.Notifications.Module.Added)] public class ModuleAddedObserver : Dynamicweb.Extensibility.NotificationSubscriber { public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args) { if (args == null) { return; } var loadedArgs = (Dynamicweb.Notifications.Module.AddedArgs)args; // Get module, which has been added Dynamicweb.Modules.Module module = loadedArgs.Module; // Pass module name to the notification email string emailBody = string.Format("The module '{0}' has been added.", module.Name); Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "ModuleAddedObserver", "admin", "noreply@dynamicweb.dk", emailBody, "UTF-8"); } } }
Namespace Notifications <Extensibility.Subscribe(Global.Dynamicweb.Notifications.Module.Added)> _ Public Class ModuleAddedObserver Inherits Global.Dynamicweb.Extensibility.NotificationSubscriber Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Global.Dynamicweb.Extensibility.NotificationArgs) If args Is Nothing Then Return End If Dim loadedArgs As Global.Dynamicweb.Notifications.Module.AddedArgs = DirectCast(args, Global.Dynamicweb.Notifications.Module.AddedArgs) ' Get module, which has been added Dim addedModule As Global.Dynamicweb.Modules.Module = loadedArgs.Module End Sub End Class End Namespace
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2