本文整理汇总了C#中IEditorData.GetSelectedFilter方法的典型用法代码示例。如果您正苦于以下问题:C# IEditorData.GetSelectedFilter方法的具体用法?C# IEditorData.GetSelectedFilter怎么用?C# IEditorData.GetSelectedFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditorData
的用法示例。
在下文中一共展示了IEditorData.GetSelectedFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Populate
public void Populate(IEditorData data)
{
m_data = data;
if (data == null) return;
m_populating = true;
string selectedItem = data.GetSelectedFilter(m_filterGroup);
if (selectedItem == null) selectedItem = m_helper.ControlDefinition.Parent.GetDefaultFilterName(m_filterGroup, data);
lstDropdown.Text = m_dropDownValues[selectedItem];
m_populating = false;
}
示例2: IsVisible
public bool IsVisible(IEditorData data)
{
if (m_alwaysVisible) return true;
if (m_visibilityExpression != null)
{
// evaluate <onlydisplayif> expression, with "this" as the current element
Scripts.Context context = new Scripts.Context();
context.Parameters = new Scripts.Parameters("this", m_worldModel.Elements.Get(data.Name));
bool result = m_visibilityExpression.Execute(context);
if (!result) return false;
}
if (m_relatedAttribute != null)
{
object relatedAttributeValue = data.GetAttribute(m_relatedAttribute);
if (relatedAttributeValue is IDataWrapper) relatedAttributeValue = ((IDataWrapper)relatedAttributeValue).GetUnderlyingValue();
string relatedAttributeType = relatedAttributeValue == null ? "null" : WorldModel.ConvertTypeToTypeName(relatedAttributeValue.GetType());
return relatedAttributeType == m_visibleIfRelatedAttributeIsType;
}
if (m_visibleIfElementInheritsType != null)
{
if (m_visibleIfElementInheritsTypeElement == null)
{
m_visibleIfElementInheritsTypeElement = m_worldModel.Elements.Get(ElementType.ObjectType, m_visibleIfElementInheritsType);
}
return m_worldModel.Elements.Get(data.Name).Fields.InheritsType(m_visibleIfElementInheritsTypeElement);
}
if (m_notVisibleIfElementInheritsType != null)
{
if (m_notVisibleIfElementInheritsTypeElement == null)
{
// convert "mustnotinherit" type names list into a list of type elements
m_notVisibleIfElementInheritsTypeElement = new List<Element>(
m_notVisibleIfElementInheritsType.Select(t => m_worldModel.Elements.Get(ElementType.ObjectType, t))
);
}
// if the element does inherit any of the "forbidden" types, then this control is not visible
Element element = m_worldModel.Elements.Get(data.Name);
foreach (Element forbiddenType in m_notVisibleIfElementInheritsTypeElement)
{
if (element.Fields.InheritsType(forbiddenType))
{
return false;
}
}
return true;
}
if (m_filterGroup != null)
{
// This control is visible if the named filtergroup's current filter selection is this control's filter.
string selectedFilter = data.GetSelectedFilter(m_filterGroup);
// Or, if the named filtergroup's current filter selection is not set, infer the current filter value
// based on which attribute is populated for this data.
if (selectedFilter == null) selectedFilter = m_parent.GetDefaultFilterName(m_filterGroup, data);
return (selectedFilter == m_filter);
}
return false;
}