Esempio n. 1
0
        private void buildObjectTypes(ObjectTreeViewEntity parentEntity, CancellationToken token)
        {
            List <string> types = imports.Where(import => import.PackageNameIndex.Name.Equals(parentEntity.Name, StringComparison.CurrentCultureIgnoreCase))
                                  .Select(import => import.TypeNameIndex.Name)
                                  .Distinct()
                                  .ToList();

            imports.RemoveAll(import => types.Contains(import.NameTableIndex.Name));

            List <ObjectTreeViewEntity> entities = types.Select(type => new ObjectTreeViewEntity {
                Name = type, IsExpanded = type.Equals("Class", StringComparison.CurrentCultureIgnoreCase)
            }).ToList();

            parentEntity.Children = new ObservableCollection <ObjectTreeViewEntity>(entities.OrderBy(entity => entity.Name));

            Parallel.ForEach(parentEntity.Children, childEntity =>
            {
                if (token.IsCancellationRequested)
                {
                    return;
                }

                buildObjectChildren(childEntity, token);
            });
        }
        private async void onObjectTreeViewEntityPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            ObjectTreeViewEntity entity = sender as ObjectTreeViewEntity;

            if (entity == null || !entity.IsExport)
            {
                return;
            }

            switch (args.PropertyName)
            {
            case "IsSelected": {
                if (entity.IsSelected)
                {
                    DomainExportTableEntry export = exports.Single(et => et.TableIndex == entity.TableIndex);

                    if (export.DomainObject == null)
                    {
                        await export.ParseDomainObject(header, menuViewModel.IsSkipProperties, menuViewModel.IsSkipParsing);
                    }

                    messenger.Send(new ExportTableEntrySelectedMessage {
                            ExportTableEntry = export
                        });
                }

                break;
            }

            default: {
                break;
            }
            }
        }
Esempio n. 3
0
        private void buildObjectChildren(ObjectTreeViewEntity parentEntity, CancellationToken token)
        {
            List <ObjectTreeViewEntity> entities = new List <ObjectTreeViewEntity>();

            List <DomainImportTableEntry> importChildren = imports.Where(import => import.TypeNameIndex.Name.Equals(parentEntity.Name, StringComparison.CurrentCultureIgnoreCase)).ToList();

            entities.AddRange(mapper.Map <IEnumerable <ObjectTreeViewEntity> >(importChildren));

            if (token.IsCancellationRequested)
            {
                return;
            }

            List <DomainExportTableEntry> exportChildren = exports.Where(export => export.TypeReferenceNameIndex.Name.Equals(parentEntity.Name, StringComparison.CurrentCultureIgnoreCase)).ToList();

            entities.AddRange(mapper.Map <IEnumerable <ObjectTreeViewEntity> >(exportChildren));

            if (token.IsCancellationRequested)
            {
                return;
            }

            entities.Where(entity => entity.IsExport).ForEach(entity => entity.PropertyChanged += onObjectTreeViewEntityPropertyChanged);

            parentEntity.Children = new ObservableCollection <ObjectTreeViewEntity>(entities.OrderBy(entity => entity.IsImport).ThenBy(entity => entity.Name));

            if (token.IsCancellationRequested)
            {
                return;
            }

            Parallel.ForEach(parentEntity.Children, childEntity =>
            {
                if (token.IsCancellationRequested)
                {
                    return;
                }

                buildObjectChildren(childEntity, token);
            });
        }
Esempio n. 4
0
    private void buildObjectChildren(ObjectTreeViewEntity parentEntity, CancellationToken token) {
      List<ObjectTreeViewEntity> entities = new List<ObjectTreeViewEntity>();

      List<DomainImportTableEntry> importChildren = imports.Where(import => import.TypeNameIndex.Name.Equals(parentEntity.Name, StringComparison.CurrentCultureIgnoreCase)).ToList();

      entities.AddRange(mapper.Map<IEnumerable<ObjectTreeViewEntity>>(importChildren));

      if (token.IsCancellationRequested) return;

      List<DomainExportTableEntry> exportChildren = exports.Where(export => export.TypeReferenceNameIndex.Name.Equals(parentEntity.Name, StringComparison.CurrentCultureIgnoreCase)).ToList();

      entities.AddRange(mapper.Map<IEnumerable<ObjectTreeViewEntity>>(exportChildren));

      if (token.IsCancellationRequested) return;

      entities.Where(entity => entity.IsExport).ForEach(entity => entity.PropertyChanged += onObjectTreeViewEntityPropertyChanged);

      parentEntity.Children = new ObservableCollection<ObjectTreeViewEntity>(entities.OrderBy(entity => entity.IsImport).ThenBy(entity => entity.Name));

      if (token.IsCancellationRequested) return;

      Parallel.ForEach(parentEntity.Children, childEntity => {
        if (token.IsCancellationRequested) return;

        buildObjectChildren(childEntity, token);
      });
    }
Esempio n. 5
0
    private void buildObjectTypes(ObjectTreeViewEntity parentEntity, CancellationToken token) {
      List<string> types = imports.Where(import => import.PackageNameIndex.Name.Equals(parentEntity.Name, StringComparison.CurrentCultureIgnoreCase))
                                  .Select(import => import.TypeNameIndex.Name)
                                  .Distinct()
                                  .ToList();

      imports.RemoveAll(import => types.Contains(import.NameTableIndex.Name));

      List<ObjectTreeViewEntity> entities = types.Select(type => new ObjectTreeViewEntity { Name = type, IsExpanded = type.Equals("Class", StringComparison.CurrentCultureIgnoreCase) }).ToList();

      parentEntity.Children = new ObservableCollection<ObjectTreeViewEntity>(entities.OrderBy(entity => entity.Name));

      Parallel.ForEach(parentEntity.Children, childEntity => {
        if (token.IsCancellationRequested) return;

        buildObjectChildren(childEntity, token);
      });
    }