コード例 #1
0
        private static bool IsReadOnlyReferenceBookAttribute(IAttribute attribute, IAttributeFormatParser attributeFormatParser)
        {
            if (attribute.Configuration == null)
            {
                return(false);
            }

            IReferenceBookConfiguration attributeConfiguration;
            var success = attributeFormatParser.TryParseReferenceBookConfiguration(attribute.Configuration, out attributeConfiguration);

            return(success && !attributeConfiguration.IsEditable);
        }
コード例 #2
0
        public CardControlViewModel(IAttribute attribute, IType type, object initValue, bool isReadOnly,
                                    IPilotDialogService dialogService, IObjectsRepository repository, IObjectCardAutoComplete autoComplete,
                                    IAttributeFormatParser attributeFormatParser, bool editMode)
        {
            if (dialogService == null)
            {
                throw new ArgumentNullException(nameof(dialogService));
            }
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }
            if (attributeFormatParser == null)
            {
                throw new ArgumentNullException(nameof(attributeFormatParser));
            }
            if (autoComplete == null)
            {
                throw new ArgumentNullException(nameof(autoComplete));
            }
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            _type                  = type;
            _dialogService         = dialogService;
            _repository            = repository;
            _attributeFormatParser = attributeFormatParser;
            _autoComplete          = autoComplete;
            _editMode              = editMode;

            Attribute      = attribute;
            _originalValue = DValue.GetDValue(initValue);
            _value         = initValue;
            IsReadOnly     = isReadOnly;

            Format = _attributeFormatParser.GetAttributeFormat(Attribute.Configuration);
            if (_originalValue != null && (_originalValue.DateValue != null && Format == null))
            {
                Format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
            }

            Culture = _attributeFormatParser.GetAttributeFormatCulture(Attribute.Configuration);
        }
コード例 #3
0
        public ProjectCloneCreator(IObjectsRepository repository, IPilotDialogService pilotDialogService, IAttributeFormatParser attributeFormatParser,
                                   IObjectModifier modifier, IFileProvider fileProvider, ITabServiceProvider tabServiceProvider)
        {
            _repository            = repository;
            _pilotDialogService    = pilotDialogService;
            _attributeFormatParser = attributeFormatParser;
            _fileProvider          = fileProvider;
            _tabServiceProvider    = tabServiceProvider;
            _modifier = modifier;

            InitColorScheme(pilotDialogService);

            Icon = "menu_icon_dark.svg";
            if (pilotDialogService.Theme == ThemeNames.Jedi)
            {
                Icon = "menu_icon_light.svg";
            }
        }
コード例 #4
0
 public ProjectCloneToolbar(IObjectsRepository repository, IPilotDialogService pilotDialogService, IAttributeFormatParser attributeFormatParser,
                            IObjectModifier modifier, IFileProvider fileProvider, ITabServiceProvider tabServiceProvider)
 {
     _projectCloneCreator = new ProjectCloneCreator(repository, pilotDialogService, attributeFormatParser, modifier, fileProvider, tabServiceProvider);
 }
コード例 #5
0
        private static void BuildReferenceBookItems(Guid parentId, Dictionary <Guid, IDataObject> objects, IList <string> categories, string stringFormat, List <ReferenceBookItem> result, IList <string> typesToShow, IAttributeFormatParser attributeFormatParser)
        {
            var children = GetSortedChildren(parentId, objects, typesToShow);

            if (children == null)
            {
                return;
            }

            foreach (var child in children)
            {
                var title = child.DisplayName;
                if (IsLeaf(child))
                {
                    var formattedTitle = string.IsNullOrEmpty(stringFormat)
                        ? title
                        : attributeFormatParser.AttributesFormat(stringFormat, child.Attributes.ToDictionary(x => x.Key, x => x.Value));
                    result.Add(new ReferenceBookItem(child, formattedTitle, categories.ToList()));
                }
                else
                {
                    BuildReferenceBookItems(child.Id, objects, categories.Union(new[] { title }).ToList(), stringFormat, result, typesToShow, attributeFormatParser);
                }
            }
        }
コード例 #6
0
        private static IEnumerable GetCollectionView(Guid sourceId, Dictionary <Guid, IDataObject> objects, string stringFormat, IList <string> typesToShow, IAttributeFormatParser attributeFormatParser)
        {
            var items = new List <ReferenceBookItem>();

            BuildReferenceBookItems(sourceId, objects, new string[0], stringFormat, items, typesToShow, attributeFormatParser);
            if (!items.Any())
            {
                return(null);
            }

            var lcv = new ListCollectionView(items);

            for (int i = 0; i < items.Max(x => x.Categories.Count); i++)
            {
                lcv.GroupDescriptions.Add(new PropertyGroupDescription(string.Format("Categories[{0}]", i)));
            }
            return(lcv);
        }
コード例 #7
0
 public ProjectCardPageViewModel(CreationInfo creationInfo, IObjectsRepository repository, IPilotDialogService dialogService, IAttributeFormatParser attributeFormatParser)
 {
     _creationInfo        = creationInfo;
     _objectCardViewModel = new ObjectCardViewModel(repository, dialogService, attributeFormatParser);
     _objectCardViewModel.IsValidInputChanged += OnIsValidInputChanged;
 }