public TypeViewModel(TypeInfo typeInfo)
        {
            _isExpanded = true;
            _typeInfo = typeInfo;
            if (_typeInfo.BaseType != null)
            {
                BaseType = new TypeViewModel(_typeInfo.BaseType);
            }

            _fields = _typeInfo.Fields
                .OrderBy(f => f.Name)
                .Select(f => new FieldViewModel(f))
                .OfType<MemberViewModel>()
                .ToArray();
            _properties = _typeInfo.Properties
                .OrderBy(p => p.Name)
                .Select(p => new PropertyViewModel(p))
                .OfType<MemberViewModel>()
                .ToArray();
            _events = _typeInfo.Events
                .OrderBy(e => e.Name)
                .Select(e => new EventViewModel(e))
                .OfType<MemberViewModel>()
                .ToArray();
            _methods = _typeInfo.Methods
                .OrderBy(m => m.Name)
                .Select(m => new MethodViewModel(m))
                .OfType<MemberViewModel>()
                .ToArray();

            NavigateCommand = new DelegateCommand(NavigateCommandHandler);
            BrowseInteractionsCommand = new DelegateCommand(BrowseInteractionsCommandHandler);
        }
Пример #2
0
        public TypeViewModel(TypeInfo typeInfo)
        {
            _isExpanded = true;
            TypeInfo    = typeInfo;
            if (TypeInfo.BaseType != null)
            {
                BaseType = new TypeViewModel(TypeInfo.BaseType);
            }

            _fields = TypeInfo.Fields
                      .OrderBy(f => f.Name)
                      .Select(f => new FieldViewModel(f))
                      .OfType <MemberViewModel>()
                      .ToArray();
            _properties = TypeInfo.Properties
                          .OrderBy(p => p.Name)
                          .Select(p => new PropertyViewModel(p))
                          .OfType <MemberViewModel>()
                          .ToArray();
            _events = TypeInfo.Events
                      .OrderBy(e => e.Name)
                      .Select(e => new EventViewModel(e))
                      .OfType <MemberViewModel>()
                      .ToArray();
            _methods = TypeInfo.Methods
                       .OrderBy(m => m.Name)
                       .Select(m => new MethodViewModel(m))
                       .OfType <MemberViewModel>()
                       .ToArray();

            NavigateCommand           = new DelegateCommand(NavigateCommandHandler);
            BrowseInteractionsCommand = new DelegateCommand(BrowseInteractionsCommandHandler);
        }
        public AncestryBrowserWindowViewModel(TypeInfo typeInfo)
        {
            _typeInfo = typeInfo;

            ExpandCollapseAllCommand = new DelegateCommand(ExpandCollapseAllCommandHandler);

            _options = new MemberOptions
            {
                ShowProperties        = true,
                ShowEvents            = true,
                ShowMethods           = true,
                ShowProtected         = true,
                ShowProtectedInternal = true,
                ShowPublic            = true
            };

            Type = new TypeViewModel(_typeInfo);

            _ancestry = Type.Ancestry.ToList();
            _ancestry.Last().IsLast = true;
            Assemblies = _ancestry
                         .GroupBy(t => t.TypeInfo.Module.Assembly)
                         .Select(g => new AssemblyViewModel(g.Key, g))
                         .ToList();

            var currentIndex = 0;

            foreach (var assembly in Assemblies)
            {
                var brush = BrushProvider.BrushPairs[currentIndex].Background as SolidColorBrush;
                brush = new SolidColorBrush(
                    new Color {
                    A = 72, R = brush.Color.R, G = brush.Color.G, B = brush.Color.B
                });

                assembly.BackgroundBrush = brush;
                assembly.CaptionBrush    = BrushProvider.BrushPairs[currentIndex].Caption;
                currentIndex++;
                if (currentIndex == BrushProvider.BrushPairs.Count)
                {
                    currentIndex = 0;
                }
            }

            KindGroup = new CommandsGroupViewModel(
                Resources.Members,
                new List <GroupedUserCommand>
            {
                new GroupedUserCommand(Resources.All, ShowAllMemberKinds, true),
                new GroupedUserCommand(Resources.Virtual, ShowVirtualMembers)
            });

            UpdateMembers();
            FillToolTips();
        }
        public AncestryBrowserWindowViewModel(TypeInfo typeInfo)
        {
            _typeInfo = typeInfo;

            ExpandCollapseAllCommand = new DelegateCommand(ExpandCollapseAllCommandHandler);

            _options = new MemberOptions
            {
                ShowProperties = true,
                ShowEvents = true,
                ShowMethods = true,
                ShowProtected = true,
                ShowProtectedInternal = true,
                ShowPublic = true
            };

            _typeViewModel = new TypeViewModel(_typeInfo);

            _ancestry = _typeViewModel.Ancestry.ToList();
            _ancestry.Last().IsLast = true;
            _assemblies = _ancestry
                .GroupBy(t => t.TypeInfo.Module.Assembly)
                .Select(g => new AssemblyViewModel(g.Key, g))
                .ToList();

            int currentIndex = 0;
            foreach (var assembly in _assemblies)
            {
                var brush = BrushProvider.BrushPairs[currentIndex].Background as SolidColorBrush;
                brush = new SolidColorBrush(
                    new Color { A = 72, R = brush.Color.R, G = brush.Color.G, B = brush.Color.B});

                assembly.BackgroundBrush = brush;
                assembly.CaptionBrush = BrushProvider.BrushPairs[currentIndex].Caption;
                currentIndex++;
                if (currentIndex == BrushProvider.BrushPairs.Count)
                {
                    currentIndex = 0;
                }
            }

            KindGroup = new CommandsGroupViewModel(
                    Resources.Members,
                    new List<GroupedUserCommand>
                     	{
                            new GroupedUserCommand(Resources.All, ShowAllMemberKinds, true),
                            new GroupedUserCommand(Resources.Virtual, ShowVirtualMembers)
                        });

            UpdateMembers();
            FillToolTips();
        }