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


C# IEditableRoot.GetCurrentStateGuid方法代码示例

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


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

示例1: Create

        public static IFieldInfo Create(PropertyInfo prop, IEditableRoot editableRoot, IField field, object rawValue, IValidationContext validationContext)
        {
            var customAttr = prop.GetCustomAttribute<CommonSettingsAttribute>();
            var promptAttr = prop.GetCustomAttribute<PromptAttribute>();
            var docAttr = prop.GetCustomAttribute<DocumentationAttribute>();
            var fieldTypeAttr = prop.GetCustomAttribute<FieldTypeAttribute>();
            var hasCalculatedAttr = prop.GetCustomAttributes(typeof(CalculatedAttribute), false).Any();
            var hasDefaultExpressionAttr = prop.GetCustomAttributes(typeof(HasDefaultExpressionAttribute), false).Any();

            //Set common properties
            var fieldInfo = CreateFieldInfo(fieldTypeAttr.ColumnType, prop, rawValue, editableRoot);
            fieldInfo.Id = editableRoot.Id;
            fieldInfo.SystemName = field.SystemName;
            fieldInfo.DisplayName = customAttr.Name;
            fieldInfo.Width = customAttr.Width;
            fieldInfo.CanRead = editableRoot.CanReadProperty(prop.Name);
            fieldInfo.IsRequired = validationContext != null && validationContext.IsRequired(editableRoot.ProcessName, field.SystemName, editableRoot.GetCurrentStateGuid());
            fieldInfo.CanRead = editableRoot.CanReadProperty(prop.Name);
            fieldInfo.CanWrite = editableRoot.CanWriteProperty(prop.Name) && !hasCalculatedAttr;
            fieldInfo.BackColor = GetBackColor(editableRoot, prop);
            fieldInfo.Prompt = promptAttr == null
                ? string.Format(CultureInfo.InvariantCulture,
                    LanguageService.Translate("Tooltip_EnterPrompt"), customAttr.Name)
                : promptAttr.PromptString;

            fieldInfo.IsDocumentationAvailable = docAttr != null;

            if (hasCalculatedAttr || hasDefaultExpressionAttr)
            {
                fieldInfo.ExpressionType = hasCalculatedAttr ? FieldExpressionType.Calculated : FieldExpressionType.Default;
                fieldInfo.Expression = GetExpression(editableRoot, prop);
            }

            // docAttr == null ? string.Empty : ClrUnicodeConverter.ToText(docAttr.DocumentationBody),

            return fieldInfo;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:37,代码来源:FieldInfoFactory.cs

示例2: CreateDetailsResult

        private static DetailsCommandResult CreateDetailsResult(IEditableRoot editableRoot)
        {
            var result = new DetailsCommandResult { Id = editableRoot.Id, DisplayName = editableRoot.ProcessDisplayName, IsTabbedUI = IsTabbedUI(editableRoot) };
            var visibleFields = new HashSet<string>(editableRoot.Sections.SelectMany(s => s.Fields).Where(f => !f.IsHidden).Select(f => f.SystemName));
            var validationContext = editableRoot.GetValidationContext();

            foreach (var sect in editableRoot.Sections)
            {
                var section = new SectionInfo { Name = sect.Name };
                var row = new RowInfo();
                var rowLength = 0d;

                foreach (var field in sect.Fields)
                {
                    var prop = editableRoot.GetPropertyByName(field.SystemName);
                    if (!visibleFields.Contains(prop.Name))
                    {
                        continue;
                    }

                    var fieldInfo = FieldInfoFactory.Create(prop, editableRoot, field, GetValue(prop, editableRoot), validationContext);
                    if (rowLength + fieldInfo.Width > 100)
                    {
                        if (row.Fields.Any())
                            section.Rows.Add(row);
                        row = new RowInfo();
                        rowLength = fieldInfo.Width >= 100 ? 100 : fieldInfo.Width;
                    }
                    else
                        rowLength += fieldInfo.Width;

                    row.Fields.Add(fieldInfo);
                }

                if (row.Fields.Any())
                    section.Rows.Add(row);

                if (section.Rows.Any())
                    result.Sections.Add(section);
            }


            result.States = new List<IStateInfo>();
            var supportStates = editableRoot as ISupportStates;
            if (supportStates != null)
            {
                foreach (var s in supportStates.StateManager.States)
                {
                    result.States.Add(new StateInfo(s.Name, s.Guid));
                }
            }

            result.CurrentStateGuid = editableRoot.GetCurrentStateGuid();

            return result;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:56,代码来源:DetailsCommand.cs


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