Example #1
0
        private TypeMemberViewModel(TypeViewModel type)
            : base(type.ContainingAssembly.AssemblyBrowser.MemoryExplorer)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            _type = type;
        }
Example #2
0
        public TypeMemberViewModel(TypeViewModel type, PropertyInfo property)
            : this(type)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            _member = _property = property;
            _field  = null;

            base.DisplayName = _property.Name;
        }
Example #3
0
        void OnTypeViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            TypeViewModel typeVM = sender as TypeViewModel;

            if (typeVM.IsSelected)
            {
                this.SelectedType = typeVM;
            }
            else
            {
                this.SelectedType = null;
            }
        }
Example #4
0
        public TypeMemberViewModel(TypeViewModel type, FieldInfo field)
            : this(type)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            _member   = _field = field;
            _property = null;

            base.DisplayName = _field.Name;
        }
Example #5
0
        List <TypeViewModel> LoadTypesInAssembly()
        {
            List <TypeViewModel> list = new List <TypeViewModel>();

            foreach (Type type in _assembly.GetTypes())
            {
                TypeViewModel typeVM = new TypeViewModel(type, this);

                // Exclude the Private Implementation Details classes.
                if (!type.FullName.Contains("<") &&
                    !type.FullName.Contains("$"))
                {
                    typeVM.PropertyChanged += this.OnTypeViewModelPropertyChanged;
                    list.Add(typeVM);
                }
            }

            list.Sort((t1, t2) =>
            {
                bool t1IsInternal = t1.UnqualifiedName.StartsWith("_");
                bool t2IsInternal = t2.UnqualifiedName.StartsWith("_");

                if (t1IsInternal && !t2IsInternal)
                {
                    return(+1);
                }

                if (!t1IsInternal && t2IsInternal)
                {
                    return(-1);
                }

                return(t1.UnqualifiedName.CompareTo(t2.UnqualifiedName));
            });

            return(list);
        }