Quantcast
Viewing all articles
Browse latest Browse all 1794

Alarm And Event Subscription - by: Jannie@Moore

Hi there i need to be able to access Area, CategoryName and Code on the below alarm event.
public void client_Notification(object sender, EasyAENotificationEventArgs e)
{
    try
    {
        var AE_subscription = Server.Subscriptions.FirstOrDefault();
        if (AE_subscription != null)
        {
 
 
            if (e.Exception != null)
            {
                Console.WriteLine("Exception Message: {0}", e.Exception.Message);
                Console.WriteLine("Exception Source: {0}", e.Exception.Source);
                return;
            }
 
            if (!(e.EventData is null))
            {
                ConditionalAlarmData alarmData = new ConditionalAlarmData
                {
                    Area = null,
                    Source = e.EventData?.QualifiedSourceName,
                    CategoryID = e.EventData?.CategoryId,
                    CategoryName = null,
                    TimeStamp = e.EventData?.Time,
                    Message = e.EventData?.Message,
                    Severity = e.EventData?.Severity.ToString(),
                    Condition = e.EventData?.ConditionName,
                    SubCondition = e.EventData?.SubconditionName,
                    Quality = e.EventData?.Quality.ToString(),
                    Enabled = e.EventData?.Enabled.ToString(),
                    Active = e.EventData?.Active.ToString(),
                    Acknowledged = e.EventData?.Acknowledged.ToString(),
                    ActiveTime = e.EventData?.ActiveTime,
                    Code = null,
                    AcknowledgedRequired = e.EventData?.AcknowledgeRequired.ToString()
                };
 
                _fileLogger.Log($@"Testing AE " + stateItem.ConnectionString, true, "AE Client"); ;
 
 
            } 
        }
    }
    catch
    {
        _fileLogger.Log($@"Error Occured while getting event data.", true, "AE Client");
    }
 
}

Viewing all articles
Browse latest Browse all 1794

Trending Articles