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


C# SourceCode.GetServiceInstanceForExtend方法代码示例

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


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

示例1: CreateSmartBoxSmartObject

        private SourceCode.SmartObjects.Authoring.SmartObjectDefinition CreateSmartBoxSmartObject(SourceCode.SmartObjects.Management.SmartObjectManagementServer SmartObjectManagementSvr, K2Field.Apps.Framework.Build.SmartObjectDefinition SmO, string DeploymentCategory)
        {
            ServiceInstance serviceInstance = ServiceInstance.Create(SmartObjectManagementSvr.GetServiceInstanceForExtend(SmO.ServiceInstanceId, string.Empty));
            ExtendObject extendObject = serviceInstance.GetCreateExtender();
            // do set ID here - set on SmartObjectDefinition - extender is specifically for SmartBox
            //extendObject.Guid = SmO.Id;
            extendObject.Name = SmO.SystemName;
            extendObject.Metadata.DisplayName = SmO.DisplayName;
            extendObject.Metadata.Description = SmO.Description;

            foreach(K2Field.Apps.Framework.Build.SmartObjectProperty prop in SmO.Properties)
            {
                ExtendObjectProperty SoProp = new ExtendObjectProperty();
                SoProp.Guid = prop.Id;
                SoProp.Name = prop.SystemName.Replace(" ", "_").Replace(".", "_");
                SoProp.Metadata.DisplayName = prop.DisplayName;
                SoProp.Type = (PropertyDefinitionType)prop.DataType;
                SoProp.ExtendType = (SourceCode.SmartObjects.Authoring.ExtendPropertyType)prop.ExtendType;

                if (prop.DataType == SmODataType.Text)
                {
                    if (prop.MaxSize.HasValue && prop.MaxSize.Value > 0)
                    {
                        SoProp.Metadata.AddServiceElement("maxsize", prop.MaxSize.Value.ToString());
                    }
                    else
                    {
                        SoProp.Metadata.AddServiceElement("maxsize", "200");
                    }
                }

                if (!extendObject.Properties.ContainsName(prop.SystemName))
                {
                    extendObject.Properties.Add(SoProp);
                }
            }

            SourceCode.SmartObjects.Authoring.SmartObjectDefinition smoDefinition = new SourceCode.SmartObjects.Authoring.SmartObjectDefinition();

            try
            {

                // Create SmartObject Definition
                smoDefinition.Create(extendObject);

                // must set the SmartObject Id here
                smoDefinition.Guid = SmO.Id;
                smoDefinition.AddDeploymentCategory(DeploymentCategory);

                smoDefinition.Build();
            }
            catch (SmartObjectDefinitionException defEx)
            {
                MessageBox.Show(defEx.Message);
                throw;
            }

            return smoDefinition;
        }
开发者ID:jonnoking,项目名称:K2-Field-App-Framework,代码行数:59,代码来源:MainWindow.xaml.cs


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