当前位置: 首页>>代码示例>>C#>>正文


C# IEditorData.GetAttribute方法代码示例

本文整理汇总了C#中IEditorData.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IEditorData.GetAttribute方法的具体用法?C# IEditorData.GetAttribute怎么用?C# IEditorData.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEditorData的用法示例。


在下文中一共展示了IEditorData.GetAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Populate

        public void Populate(IEditorData data)
        {
            m_data = data;

            if (data == null)
            {
                m_value = null;
                return;
            }

            m_populating = true;
            PopulateList();

            object attr = data.GetAttribute(m_definition.Attribute);
            IEditableObjectReference value = attr as IEditableObjectReference;

            if (value == null)
            {
                lstDropdown.Text = string.Empty;
                lstDropdown.IsEnabled = (attr == null);
            }
            else
            {
                lstDropdown.SelectedItem = value.Reference;
                lstDropdown.IsEnabled = !data.ReadOnly;
            }

            m_value = value;

            m_populating = false;
        }
开发者ID:JatinR,项目名称:quest,代码行数:31,代码来源:DropDownObjectsControl.xaml.cs

示例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;
        }
开发者ID:Pertex,项目名称:Quest,代码行数:70,代码来源:EditorVisibilityHelper.cs

示例3: Populate

 public void Populate(IEditorData data)
 {
     m_data = data;
     if (data != null)
     {
         Value = data.GetAttribute(m_attributeName);
         m_elementName = data.Name;
         ctlListEditor.IsReadOnly = data.ReadOnly;
     }
     else
     {
         Value = null;
         m_elementName = null;
     }
 }
开发者ID:Pertex,项目名称:Quest,代码行数:15,代码来源:WFDictionaryStringControl.cs

示例4: BindScript

        private object BindScript(IValueProvider provider, string attribute, IEditorData data, EditorController controller, string ignoreExpression)
        {
            IEditableScripts originalScript = (IEditableScripts)data.GetAttribute(attribute);

            if (originalScript == null) return null;

            ElementSaveData.ScriptsSaveData result = new ElementSaveData.ScriptsSaveData();

            BindScriptLines(provider, attribute, controller, originalScript, result, ignoreExpression);

            return result;
        }
开发者ID:JatinR,项目名称:quest,代码行数:12,代码来源:Element.cs

示例5: GetDefaultFilterName

        public string GetDefaultFilterName(string filterGroupName, IEditorData data)
        {
            FilterGroup filterGroup = m_filterGroups[filterGroupName];
            List<Filter> candidates = new List<Filter>();

            foreach (Filter filter in filterGroup.Filters.Values)
            {
                foreach (string attribute in filter.Attributes)
                {
                    if (data.GetAttribute(attribute) != null)
                    {
                        candidates.Add(filter);
                        break;
                    }
                }
            }

            // If there is only one candidate then we have our result
            if (candidates.Count == 1)
            {
                return candidates[0].Name;
            }

            // Otherwise just default to the first filter
            return filterGroup.Filters.First().Value.Name;
        }
开发者ID:Pertex,项目名称:Quest,代码行数:26,代码来源:EditorDefinition.cs

示例6: Populate

        public void Populate(IEditorData data)
        {
            m_data = data;
            m_storedValues.Clear();

            if (m_data == null)
            {
                if (CurrentElementEditor != null) CurrentElementEditor.Populate(m_data);
                return;
            }

            object value = m_data.GetAttribute(m_definition.Attribute);

            bool canEdit = CanEditType(value);

            lstTypes.IsEnabled = canEdit && !data.ReadOnly && m_definition.Attribute != "name";

            if (canEdit)
            {
                string typeName = GetTypeName(value);
                string editorName = GetEditorNameForType(typeName);
                SetSelectedType(typeName);
                GetOrCreateEditorControl(editorName);
                if (!string.IsNullOrEmpty(typeName))
                {
                    m_storedValues[typeName] = value;
                }
            }
        }
开发者ID:Pertex,项目名称:Quest,代码行数:29,代码来源:MultiControl.xaml.cs

示例7: PopulateData

 protected virtual void PopulateData(IEditorData data)
 {
     if (m_data == null)
     {
         Value = string.Empty;
     }
     else
     {
         Value = data.GetAttribute(m_attribute);
     }
 }
开发者ID:Pertex,项目名称:Quest,代码行数:11,代码来源:WFRichTextControl.cs


注:本文中的IEditorData.GetAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。