protected override void OnMonitoredItemDeleted(
ServerSystemContext context,
NodeHandle handle,
MonitoredItem monitoredItem)
{
// check if diagnostics collection needs to be turned off.
if (IsDiagnosticsNode(handle.Node))
{
if (monitoredItem.MonitoringMode != MonitoringMode.Disabled)
{
m_diagnosticsMonitoringCount--;
if (m_diagnosticsMonitoringCount == 0 && m_diagnosticsScanTimer != null)
{
m_diagnosticsScanTimer.Dispose();
m_diagnosticsScanTimer = null;
}
if (m_diagnosticsScanTimer != null)
{
DoScan(true);
}
}
}
// check if sampling needs to be turned off.
if (monitoredItem.AttributeId == Attributes.Value)
{
BaseVariableState variable = handle.Node as BaseVariableState;
if (variable != null && variable.MinimumSamplingInterval > 0)
{
DeleteSampledItem(monitoredItem);
}
}
}