private EventFieldList GetEventFields(FilterContext context, EventFilter filter, IFilterTarget instance)
{
// fetch the event fields.
EventFieldList fields = new EventFieldList();
fields.ClientHandle = m_clientHandle;
fields.Handle = instance;
foreach (SimpleAttributeOperand clause in filter.SelectClauses)
{
// get the value of the attribute (apply localization).
object value = instance.GetAttributeValue(
context,
clause.TypeDefinitionId,
clause.BrowsePath,
clause.AttributeId,
clause.ParsedIndexRange);
// add the value to the list of event fields.
if (value != null)
{
// translate any localized text.
LocalizedText text = value as LocalizedText;
if (text != null)
{
value = m_server.ResourceManager.Translate(m_session.PreferredLocales, text);
}
// add value.
fields.EventFields.Add(new Variant(value));
}
// add a dummy entry for missing values.
else
{
fields.EventFields.Add(Variant.Null);
}
}
return fields;
}