Table of Contents

Class Module

Namespace
Dynamicweb.Notifications
Assembly
Dynamicweb.dll

Class provides information about possible module manipulations

public sealed class Module
Inheritance
Module
Inherited Members

Examples

using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Notifications;

namespace Dynamicweb.Examples.Notifications;

[Subscribe(Module.Added)]
public class ModuleAddedObserver : NotificationSubscriber
{
    public override void OnNotify(string notification, NotificationArgs args)
    {
        if (args is null)
            return;

        var loadedArgs = (Module.AddedArgs)args;

        // Get module, which has been added
        var module = loadedArgs.Module;

        // Pass module name to the notification email
        string emailBody = $"The module '{module.Name}' has been added.";
    }
}

Remarks

The passed NotificationArgs is Module.AddedArgs

Fields

Added

Event occurs after the module was added

public const string Added = "DWN_MODULE_EVENT_ADDED"

Field Value

string

Examples

using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Notifications;

namespace Dynamicweb.Examples.Notifications;

[Subscribe(Module.Added)]
public class ModuleAddedObserver : NotificationSubscriber
{
    public override void OnNotify(string notification, NotificationArgs args)
    {
        if (args is null)
            return;

        var loadedArgs = (Module.AddedArgs)args;

        // Get module, which has been added
        var module = loadedArgs.Module;

        // Pass module name to the notification email
        string emailBody = $"The module '{module.Name}' has been added.";
    }
}

Remarks

The passed NotificationArgs is Module.AddedArgs

Removed

Event occurs after the module was deleted

public const string Removed = "DWN_MODULE_EVENT_REMOVED"

Field Value

string

Examples

namespace Dynamicweb.Examples.Notifications;

[Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Notifications.Module.Removed)]
public class ModuleRemovedObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
    public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
    {
        if (args is null)
            return;

        var loadedArgs = (Dynamicweb.Notifications.Module.RemovedArgs)args;

        // Get module, which has been removed
        Dynamicweb.Modules.Module module = loadedArgs.Module;

        // Pass module name to the notification email
        string emailBody = $"The module '{module.Name}' has been removed.";
    }
}

Remarks

The passed NotificationArgs is Module.RemovedArgs

To top