Beispiel #1
0
        public AssemblyViewModel(MainViewModel main, Assembly assembly)
            : base(main)
        {
            this.assembly = assembly;

            var references = new ItemViewModel(main, "References", "reference");

            this.Childs.Add(references);

            AddCommand("Show _CG", ModifierKeys.Control, Key.C, OnShowCG);
            AddCommand("Show _CH", ModifierKeys.Control, Key.H, OnShowCH);

            foreach (var reference in assembly.References)
            {
                var vm = new ReferenceViewModel(main, reference);
                references.Childs.Add(vm);
            }

            foreach (var @namespace in assembly.RootNamespace.Namespaces)
            {
                var vm = new NamespaceViewModel(main, @namespace);
                this.Childs.Add(vm);
            }

            foreach (var type in assembly.RootNamespace.Types)
            {
                var vm = new TypeViewModel(main, type);
                this.Childs.Add(vm);
            }
        }
Beispiel #2
0
        public NamespaceViewModel(MainViewModel main, Namespace @namespace)
            : base(main)
        {
            this.@namespace = @namespace;

            foreach (var nestedNamespace in @namespace.Namespaces)
            {
                var vm = new NamespaceViewModel(main, nestedNamespace);
                this.Childs.Add(vm);
            }

            foreach (var type in @namespace.Types)
            {
                var vm = new TypeViewModel(main, type);
                this.Childs.Add(vm);
            }
        }
Beispiel #3
0
        private ItemViewModelBase CreateItemViewModel(ITypeMemberDefinition member)
        {
            ItemViewModelBase result = null;

            if (member is ITypeDefinition)
            {
                var type = member as ITypeDefinition;
                result = new TypeViewModel(this.Main, type);
            }
            else if (member is FieldDefinition)
            {
                var field = member as FieldDefinition;
                result = new FieldViewModel(this.Main, field);
            }
            else if (member is MethodDefinition)
            {
                var method = member as MethodDefinition;
                result = new MethodViewModel(this.Main, method);
            }

            return(result);
        }