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


C# Definitions.WebPartDefinition类代码示例

本文整理汇总了C#中SPMeta2.Definitions.WebPartDefinition的典型用法代码示例。如果您正苦于以下问题:C# WebPartDefinition类的具体用法?C# WebPartDefinition怎么用?C# WebPartDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WebPartDefinition类属于SPMeta2.Definitions命名空间,在下文中一共展示了WebPartDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeployWebPartToPage

 public static void DeployWebPartToPage(SPLimitedWebPartManager webPartManager,
     WebPartDefinition webpartDefinitions,
     Action<WebPart> onUpdating,
     Action<WebPart> onUpdated)
 {
     DeployWebPartToPage(webPartManager, webpartDefinitions, onUpdating, onUpdated, null);
 }
开发者ID:ReneHezser,项目名称:spmeta2,代码行数:7,代码来源:WebPartExtensions.cs

示例2: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<PageViewerWebPart>("webpartInstance", value => value.RequireNotNull());
            var definition = webpartModel.WithAssertAndCast<PageViewerWebPartDefinition>("webpartModel", value => value.RequireNotNull());

            if (!string.IsNullOrEmpty(definition.ContentLink))
            {
                var contentLinkValue = definition.ContentLink ?? string.Empty;

                TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Original contentLinkValue: [{0}]", contentLinkValue);

                contentLinkValue = TokenReplacementService.ReplaceTokens(new TokenReplacementContext
                {
                    Value = contentLinkValue,
                    Context = CurrentHost.HostFile.Web
                }).Value;

                TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Token replaced contentLinkValue: [{0}]", contentLinkValue);

                typedWebpart.ContentLink = contentLinkValue;
            }

            if (!string.IsNullOrEmpty(definition.SourceType))
            {
                typedWebpart.SourceType = (PathPattern)Enum.Parse(typeof(PathPattern), definition.SourceType);
            }
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:29,代码来源:PageViewerWebPartModelHandler.cs

示例3: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<SPUserCodeWebPart>("webpartInstance", value => value.RequireNotNull());
            var typedModel = webpartModel.WithAssertAndCast<UserCodeWebPartDefinition>("webpartModel", value => value.RequireNotNull());


            // TODO
            typedWebpart.SolutionId = typedModel.SolutionId;
            typedWebpart.AssemblyFullName = typedModel.AssemblyFullName;
            typedWebpart.TypeFullName = typedModel.TypeFullName;

            foreach (var prop in typedModel.UserCodeProperties)
            {
                var currentProperty = typedWebpart.Properties
                    .OfType<SPUserCodeProperty>()
                    .FirstOrDefault(p => p.Name.ToUpper() == prop.Name.ToUpper());

                if (currentProperty == null)
                {
                    currentProperty = new SPUserCodeProperty();
                    currentProperty.Name = prop.Name;

                    typedWebpart.Properties.Add(currentProperty);
                }

                currentProperty.Value = prop.Value;
            }
        }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:30,代码来源:UserCodePartModelHandler.cs

示例4: OnBeforeDeployModel

        protected override void OnBeforeDeployModel(WebpartPageModelHost host, WebPartDefinition webpartModel)
        {
            _host = host;

            var typedModel = webpartModel.WithAssertAndCast<ClientWebPartDefinition>("webpartModel", value => value.RequireNotNull());
            typedModel.WebpartType = typeof(ClientWebPart).AssemblyQualifiedName;
        }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:7,代码来源:ClientWebPartModelHandler.cs

示例5: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<SilverlightWebPart>("webpartInstance", value => value.RequireNotNull());
            var typedDefinition = webpartModel.WithAssertAndCast<SilverlightWebPartDefinition>("webpartModel", value => value.RequireNotNull());

            if (!string.IsNullOrEmpty(typedDefinition.Url))
            {
                var linkValue = typedDefinition.Url;

                TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Original Url: [{0}]", linkValue);

                linkValue = TokenReplacementService.ReplaceTokens(new TokenReplacementContext
                {
                    Value = linkValue,
                    Context = CurrentHost.HostFile.Web
                }).Value;

                TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Token replaced Url: [{0}]", linkValue);

                typedWebpart.Url = linkValue;
            }

            if (!string.IsNullOrEmpty(typedDefinition.CustomInitParameters))
            {
                typedWebpart.CustomInitParameters = typedDefinition.CustomInitParameters;
            }
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:29,代码来源:SilverlightWebPartModelHandler.cs

示例6: WithExistingWebPart

        //protected void WithExistingWebPart(ListItem listItem, WebPartDefinition webPartModel,
        //  Action<WebPart> action)
        //{
        //    WithExistingWebPart(listItem.File, webPartModel, action);
        //}

        protected void WithExistingWebPart(File file, WebPartDefinition webPartModel,
           Action<WebPart> action)
        {
            WithExistingWebPart(file, webPartModel, (w, d) =>
            {
                action(w);
            });
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:14,代码来源:WebPartModelHandler.cs

示例7: WithWithExistingWebPart

 protected void WithWithExistingWebPart(ListItem listItem, WebPartDefinition webPartModel,
     Action<WebPart> action)
 {
     WithWithExistingWebPart(listItem, webPartModel, (w, d) =>
     {
         action(w);
     });
 }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:8,代码来源:WebPartModelHandler.cs

示例8: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<ContactFieldControl>("webpartInstance", value => value.RequireNotNull());
            var typedModel = webpartModel.WithAssertAndCast<ContactFieldControlDefinition>("webpartModel", value => value.RequireNotNull());

        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:8,代码来源:ContactFieldControlModelHandler.cs

示例9: WebPartDefinitionTests_WebpartType_NonAssemblyQualifiedName_ShouldFail

        public void WebPartDefinitionTests_WebpartType_NonAssemblyQualifiedName_ShouldFail()
        {
            var type = "Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=16.0.0.0, Culture=neutral";

            var def = new WebPartDefinition
            {
                WebpartType = type
            };
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:9,代码来源:WebPartDefinitionTests.cs

示例10: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<UserDocsWebPart>("webpartInstance", value => value.RequireNotNull());
            var definition = webpartModel.WithAssertAndCast<UserDocsWebPartDefinition>("webpartModel", value => value.RequireNotNull());

            // TODO, specific provision
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:9,代码来源:UserDocsWebPartModelHandler.cs

示例11: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<ScriptEditorWebPart>("webpartInstance", value => value.RequireNotNull());
            var typedModel = webpartModel.WithAssertAndCast<ScriptEditorWebPartDefinition>("webpartModel", value => value.RequireNotNull());

            typedWebpart.Content = typedModel.Content ?? string.Empty;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:9,代码来源:ScriptEditorWebPartModelHandler.cs

示例12: WebPartDefinitionTests_WebpartType_AssemblyQualifiedName_ShouldPass

        public void WebPartDefinitionTests_WebpartType_AssemblyQualifiedName_ShouldPass()
        {
            var type = "Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c";

            var def = new WebPartDefinition
            {
                WebpartType = type
            };

            Assert.IsTrue(type == def.WebpartType);
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:11,代码来源:WebPartDefinitionTests.cs

示例13: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition webpartModel)
        {
            base.ProcessWebpartProperties(webpartInstance, webpartModel);

            var typedWebpart = webpartInstance.WithAssertAndCast<ClientWebPart>("webpartInstance", value => value.RequireNotNull());
            var typedModel = webpartModel.WithAssertAndCast<ClientWebPartDefinition>("webpartModel", value => value.RequireNotNull());

            typedWebpart.FeatureId = typedModel.FeatureId;
            typedWebpart.ProductId = typedModel.ProductId;
            typedWebpart.WebPartName = typedModel.WebPartName;
            typedWebpart.ProductWebId = _host.SPLimitedWebPartManager.Web.ID;
        }
开发者ID:Uolifry,项目名称:spmeta2,代码行数:12,代码来源:ClientWebPartModelHandler.cs

示例14: ProcessWebpartProperties

        protected virtual void ProcessWebpartProperties(WebPart instance, WebPartDefinition definition)
        {
            if (definition.Width.HasValue)
                instance.Width = new Unit(definition.Width.Value);

            if (definition.Height.HasValue)
                instance.Height = new Unit(definition.Height.Value);

            if (!string.IsNullOrEmpty(definition.ChromeState))
                instance.ChromeState = (PartChromeState)Enum.Parse(typeof(PartChromeState), definition.ChromeState);

            if (!string.IsNullOrEmpty(definition.ChromeType))
            {
                var chromeType = WebPartChromeTypesConvertService.NormilizeValueToPartChromeTypes(definition.ChromeType);
                instance.ChromeType = (PartChromeType)Enum.Parse(typeof(PartChromeType), chromeType);
            }

            if (!string.IsNullOrEmpty(definition.ImportErrorMessage))
                instance.ImportErrorMessage = definition.ImportErrorMessage;

            if (!string.IsNullOrEmpty(definition.Description))
                instance.Description = definition.Description;

            if (!string.IsNullOrEmpty(definition.TitleIconImageUrl))
                instance.TitleIconImageUrl = definition.TitleIconImageUrl;

            if (!string.IsNullOrEmpty(definition.TitleUrl))
            {
                var urlValue = definition.TitleUrl ?? string.Empty;

                TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Original value: [{0}]",
                    urlValue);

                urlValue = TokenReplacementService.ReplaceTokens(new TokenReplacementContext
                {
                    Value = urlValue,
                    Context = CurrentHost.HostFile.Web
                }).Value;

                TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Token replaced value: [{0}]", urlValue);

                instance.TitleUrl = urlValue;
            }

            if (!string.IsNullOrEmpty(definition.ExportMode))
                instance.ExportMode = (WebPartExportMode)Enum.Parse(typeof(WebPartExportMode), definition.ExportMode);

            ProcessWebpartCustomProperties(instance, definition);
            ProcessParameterBindings(instance, definition);
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:50,代码来源:WebPartModelHandler.cs

示例15: ProcessWebpartProperties

        protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition definition)
        {
            base.ProcessWebpartProperties(webpartInstance, definition);

            var typedWebpart = webpartInstance.WithAssertAndCast<RefinementScriptWebPart>("webpartInstance", value => value.RequireNotNull());
            var typedModel = definition.WithAssertAndCast<RefinementScriptWebPartDefinition>("webpartModel", value => value.RequireNotNull());


            if (!string.IsNullOrEmpty(typedModel.SelectedRefinementControlsJson))
                typedWebpart.SelectedRefinementControlsJson = typedModel.SelectedRefinementControlsJson;

            if (!string.IsNullOrEmpty(typedModel.EmptyMessage))
                typedWebpart.EmptyMessage = typedModel.EmptyMessage;
        }
开发者ID:karayakar,项目名称:spmeta2,代码行数:14,代码来源:RefinementScriptWebPartModelHandler.cs


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