public AncestryBrowserWindowViewModel(TypeDefinition typeDefinition)
        {
            _typeDefinition = typeDefinition;

            ExpandCollapseAllCommand = new DelegateCommand(ExpandCollapseAllCommandHandler);

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

            _typeViewModel = new TypeViewModel(_typeDefinition);

            _ancestry = _typeViewModel.Ancestry.ToList();
            _ancestry.Last().IsLast = true;
            _assemblies = _ancestry
                .GroupBy(t => t.TypeDefinition.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;
                }
            }

            UpdateMembers();
        }
        public void UpdateMembers(MemberOptions options)
        {
            IEnumerable<MemberViewModel> members = new MemberViewModel[0];

            if (options.ShowFields)
            {
                var fields = _typeDefinition.Fields
                    .Select(f => new FieldViewModel(f))
                    .OfType<MemberViewModel>();
                members = members.Concat(fields);
            }

            if (options.ShowProperties)
            {
                var properties = _typeDefinition.Properties
                    .Select(p => new PropertyViewModel(p))
                    .OfType<MemberViewModel>();
                members = members.Concat(properties);
            }

            if (options.ShowEvents)
            {
                var events = _typeDefinition.Events
                    .Select(e => new EventViewModel(e))
                    .OfType<MemberViewModel>();
                members = members.Concat(events);
            }

            if (options.ShowMethods)
            {
                var methods = _typeDefinition.Methods
                    .Where(m => !m.IsGetter && !m.IsSetter && !m.IsAddOn && !m.IsRemoveOn)
                    .Select(m => new MethodViewModel(m))
                    .OfType<MemberViewModel>();
                members = members.Concat(methods);
            }

            if (!options.ShowPrivate)
            {
                members = members.Where(m => !m.IsPrivate);
            }
            if (!options.ShowInternal)
            {
                members = members.Where(m => !m.IsInternal);
            }
            if (!options.ShowProtected)
            {
                members = members.Where(m => !m.IsProtected);
            }
            if (!options.ShowProtectedInternal)
            {
                members = members.Where(m => !m.IsProtectedInternal);
            }
            if (!options.ShowPublic)
            {
                members = members.Where(m => !m.IsPublic);
            }
            if (!string.IsNullOrWhiteSpace(options.SearchTerm))
            {
                members = members.Where(m => m.MemberReference.Name.StartsWith(options.SearchTerm.Trim(), StringComparison.InvariantCultureIgnoreCase));
            }

            Members = members;
        }