Dynamicweb 8 Documentation
Module Class
Members  Example 

Class provides information about possible module manipulations
Syntax
'Declaration
 
Public NotInheritable Class Module 
public sealed class Module 
Remarks
The passed NotificationArgs is Module.AddedArgs
Example
Overriding notification of the module addingOverriding notification of the module adding
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
Inheritance Hierarchy

System.Object
   Dynamicweb.Notifications.Module

Requirements

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

See Also

Reference

Module Members
Dynamicweb.Notifications Namespace

Send Feedback