PS: I guess I have posted in the wrong forum, I don't know how to move this question to "OPC-ALARM-EVENTS" Forum, Can any moderator please move it over there.
In one of my projects, I have to keep a track of all active events in a DataGrid,
The catch here is if the same event happens after lets say 10 seconds again,then only display in the Grid
here is my Source Code...
private readonly DataTable _alarms = new DataTable("Alarms");
private int _handle;
_dataGridView.DataSource = _alarms;
private void AlarmControl_Load(object sender, EventArgs e)
easyAEClient1.Notification += OnNotification;
_handle = easyAEClient1.SubscribeEvents("", "MyServerName", 100);
private void RefreshBtn_Click(object sender, EventArgs e)
private void ExitBtn_Click(object sender, EventArgs e)
private void OnNotification(object sender, EasyAENotificationEventArgs args)
if (args.Exception != null || args.Event == null)
var row = _alarms.NewRow();
row["Time"] = args.Event.Time;
row["Active"] = args.Event.Active;
row["Condition"] = args.Event.ConditionName;
row["Severity"] = args.Event.Severity;
row["Message"] = args.Event.Message;
// Here I want a 10 seconds Timer and check if the same Event Still exists,only then Insert in DataGrid
One way I can think is the moment I get this Event Notification, unsubscribe from the event and after 10 seconds call RefreshEventSubscription , if I get same Event Notification, then only add to my Grid.
However I am not sure if this the best way to achieve my requirement, What could be the the best way to achieve it?