public void OnTagValueChange(MonitoredItem item, MonitoredItemNotificationEventArgs e) { foreach (var value in item.DequeueValues()) { if (item.DisplayName == "ServerStatusCurrentTime") { LastTimeOPCServerFoundAlive = value.SourceTimestamp.ToLocalTime(); } else { if (value.Value != null) { Console.WriteLine("{0}: {1}, {2}, {3}", item.DisplayName, value.Value.ToString(), value.SourceTimestamp.ToLocalTime(), value.StatusCode); } else { Console.WriteLine("{0}: {1}, {2}, {3}", item.DisplayName, "Null Value", value.SourceTimestamp, value.StatusCode); } if (TagList.ContainsKey(item.DisplayName)) { if (value.Value != null) { TagList[item.DisplayName].LastGoodValue = value.Value.ToString(); TagList[item.DisplayName].CurrentValue = value.Value.ToString(); TagList[item.DisplayName].LastUpdatedTime = DateTime.Now; TagList[item.DisplayName].LastSourceTimeStamp = value.SourceTimestamp.ToLocalTime(); TagList[item.DisplayName].StatusCode = value.StatusCode.ToString(); } else { TagList[item.DisplayName].StatusCode = value.StatusCode.ToString(); TagList[item.DisplayName].CurrentValue = null; } } } } InitialisationCompleted = true; }