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


C# SPField.GetType方法代码示例

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


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

示例1: UpdateFieldVisibility

        private void UpdateFieldVisibility(SPField field, BaseFieldInfo fieldInfo)
        {
            field.ShowInListSettings = !fieldInfo.IsHiddenInListSettings;
            field.ShowInDisplayForm = !fieldInfo.IsHiddenInDisplayForm;
            field.ShowInEditForm = !fieldInfo.IsHiddenInEditForm;
            field.ShowInNewForm = !fieldInfo.IsHiddenInNewForm;

            // Apply Hidden here again (even through it's already set through the schema XML),
            // because otherwise updates to Hidden will not work.
            if (!field.CanToggleHidden)
            {
                bool before = field.Hidden;

                // Use reflection to get around the CanToggleHidden constraint. Keep in mind that
                // there may be some unintended consequenced from hiding/showing and previously
                // shown/hidden field (hence the logged warning).
                Type type = field.GetType();
                MethodInfo mi = type.GetMethod("SetFieldBoolValue", BindingFlags.NonPublic | BindingFlags.Instance);
                mi.Invoke(field, new object[] { "CanToggleHidden", true });
                field.Hidden = fieldInfo.IsHidden;
                mi.Invoke(field, new object[] { "CanToggleHidden", false });

                this.log.Warn(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "FieldHelper.EnsureField - Forced field (id={0}, name={1}) from Hidden={2} to Hidden={3} even though it should've been impossible because CanToggleHidden=false.",
                        field.Id,
                        field.InternalName,
                        before,
                        fieldInfo.IsHidden));
            }
            else
            {
                // No need to use reflection before being able to set the Hidden property
                field.Hidden = fieldInfo.IsHidden;
            }
        }
开发者ID:ASAGARG,项目名称:Dynamite,代码行数:37,代码来源:FieldHelper.cs


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