Table of Contents

Class NotificationSubscriber

Namespace
Dynamicweb.Extensibility.Notifications
Assembly
Dynamicweb.Extensibility.dll
Base implementation of notification subscribers.
public abstract class NotificationSubscriber : IComparable<NotificationSubscriber>
Inheritance
NotificationSubscriber
Implements
Inherited Members

Examples

//Create notification
    Dynamicweb.Extensibility.NotificationManager.Notify("MY_NOTIFICATION", new string[] { "my notification" });
    ...
    //How to subscribe to notification
    [Dynamicweb.Extensibility.Subscribe("MY_NOTIFICATION")]
       public class MyObserver : Dynamicweb.Extensibility.NotificationSubscriber
       {
           public override void OnNotify(string notification, object[] args)
           {
               if (args == null || args.Length != 1)
                   return;

           Class1.vb    string message = (string)args[0];

               Dynamicweb.Common.SystemTools.StringHelper.WriteEventLog(message, System.Diagnostics.EventLogEntryType.Information);
           }
       }

Properties

IsActive

Gets a value indicating whether this instance is active.
public virtual bool IsActive { get; }

Property Value

bool
true if this instance is active; otherwise, false.

IsFrontend

Gets a value indicating whether the current code executes in the frontend
[Obsolete("Deprecated, use Dynamicweb.Environment.ExecutingContext.IsFrontEnd() instead", true)]
public bool IsFrontend { get; }

Property Value

bool
true if in frontend; otherwise, false.

Rank

Gets the rank.
public virtual int Rank { get; }

Property Value

int
The rank.

Remarks

The subscriber with the highest rank will be notified last

TypeInfo

Gets the type info in a string with namespace, class and assembly name.
protected string TypeInfo { get; }

Property Value

string
The type info string.

Methods

CompareTo(NotificationSubscriber)

When sorted, the Rank is used.
public int CompareTo(NotificationSubscriber other)

Parameters

other NotificationSubscriber
The other.

Returns

int

OnNotify(string, NotificationArgs)

Call to invoke observer.
public virtual void OnNotify(string notification, NotificationArgs args)

Parameters

notification string
The notification.
args NotificationArgs
The args.
To top