public SearchScreen(AssemblyBrowserWindowViewModel windowViewModel)
            : base(windowViewModel)
        {
            InitializeSearchTimer();

            NavigateToHomePageCommand = new DelegateCommand(() => Process.Start(HomePageUri));
            ClearSearchCommand = new DelegateCommand(ClearSearchCommandHandler);

            InitializeSearchControl();
        }
        public AssemblyBrowserWindow(IEnumerable<AssemblyInfo> assemblies, TypeInfo typeInfo)
        {
            InitializeComponent();

            ViewModel = new AssemblyBrowserWindowViewModel(assemblies, typeInfo, Dispatcher);

            CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseForward,
                                                   (s, e) => ViewModel.NavigateForwardCommand.Execute(null)));
            CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseBack,
                                                   (s, e) => ViewModel.NavigateBackCommand.Execute(null)));

            WindowManager.AddAssemblyBrowser(this);
        }
        public AssemblyViewModel(AssemblyInfo assemblyInfo, 
								 AssemblyBrowserWindowViewModel windowViewModel)
        {
            _assemblyInfo = assemblyInfo;
            _windowViewModel = windowViewModel;

            var types = _assemblyInfo.Modules
                .SelectMany(m => m.Types);
            _exportedTypesCount = assemblyInfo.ExportedTypesCount;
            _internalTypesCount = assemblyInfo.InternalTypesCount;

            RemoveCommand = new DelegateCommand(RemoveCommandHandler);

            RefreshForeground();
        }
        public AssemblyViewModel(AssemblyInfo assemblyInfo,
                                 AssemblyBrowserWindowViewModel windowViewModel)
        {
            _assemblyInfo    = assemblyInfo;
            _windowViewModel = windowViewModel;

            var types = _assemblyInfo.Modules
                        .SelectMany(m => m.Types);

            _exportedTypesCount = assemblyInfo.ExportedTypesCount;
            _internalTypesCount = assemblyInfo.InternalTypesCount;

            RemoveCommand = new DelegateCommand(RemoveCommandHandler);

            RefreshForeground();
        }
        public GraphScreen(AssemblyBrowserWindowViewModel windowViewModel)
            : base(windowViewModel)
        {
            PinCommand = new DelegateCommand(PinCommandHandler);
            HideSearchCommand = new DelegateCommand(HideSearchCommandHandler);
            ShowSearchCommand = new DelegateCommand(ShowSearchCommandHandler);

            _toggleColorizeUserCommand = new UserCommand(WindowViewModel.IsColorized
                                                            ? Resources.Decolorize
                                                            : Resources.Colorize, ToggleColorizeCommandHandler);

            Commands = new ObservableCollection<UserCommand>
                       	{
                       		new UserCommand(Resources.FillGraph, OnFillGraphRequest),
                       		new UserCommand(Resources.OriginalSize, OnOriginalSizeRequest),
                       		                    WindowViewModel.ShowSearchUserCommand,
                       		new UserCommand(Resources.SearchInGraph, ShowSearchCommand),
                       		_toggleColorizeUserCommand
                       	};
        }
示例#6
0
 public Screen(AssemblyBrowserWindowViewModel windowViewModel)
 {
     WindowViewModel = windowViewModel;
 }
示例#7
0
        public TypeViewModel(TypeInfo typeInfo, AssemblyViewModel assemblyViewModel,
                             AssemblyBrowserWindowViewModel windowViewModel)
        {
            _typeInfo          = typeInfo;
            _windowViewModel   = windowViewModel;
            _assemblyViewModel = assemblyViewModel;

            _name         = typeInfo.Name;
            _fullName     = typeInfo.FullName;
            _extendedInfo = IsInternal
                                ? string.Format("{0}\n{1}", FullName, Resources.Internal)
                                : FullName;
            if (_typeInfo.IsEnum)
            {
                var enumValues = _typeInfo.Fields.Where(f => f.Name != "value__").Select(f => f.Name);
                if (enumValues.Count() > 0)
                {
                    var values = string.Join("\n", _typeInfo.Fields.Where(f => f.Name != "value__").Select(f => f.Name));
                    _extendedInfo = string.Format("{0}\n\n{1}", _extendedInfo, values);
                }
            }
            else if (_typeInfo.IsInterface)
            {
                var members = _typeInfo.Events.Select(m => m.Text)
                              .Concat(_typeInfo.Properties.Select(p => p.Text))
                              .Concat(_typeInfo.Methods.Select(p => p.Text));
                if (members.Count() > 0)
                {
                    var values = string.Join("\n", members);
                    _extendedInfo = string.Format("{0}\n\n{1}", _extendedInfo, values);
                }
            }

            if (HasBaseType)
            {
                var baseType = _typeInfo.BaseType;

                _baseTypeName     = baseType.Name;
                _baseTypeFullName = baseType.FullName;
                if (baseType == null)
                {
                    _baseTypeFullName    = _baseTypeFullName + "\n" + Resources.NotAvailable;
                    _isBaseTypeAvailable = false;
                }
            }

            var properties = typeInfo.Properties
                             .Where(p => p.IsPublic)
                             .Select(p => new PropertyViewModel(p))
                             .OfType <MemberViewModel>();

            var events = typeInfo.Events
                         .Where(e => e.IsPublic)
                         .Select(e => new EventViewModel(e))
                         .OfType <MemberViewModel>();

            var methods = typeInfo.Methods
                          .Where(m => m.IsPublic)
                          .Select(m => new MethodViewModel(m))
                          .OfType <MemberViewModel>();

            Members       = properties.Concat(events).Concat(methods);
            _membersCount = typeInfo.MembersCount;

            VisualizeCommand          = new DelegateCommand(VisualizeCommandHandler);
            NavigateCommand           = new DelegateCommand(NavigateCommandHandler);
            NavigateToBaseCommand     = new DelegateCommand(NavigateToBaseCommandHandler);
            ShowMembersCommand        = new DelegateCommand(ShowMembersCommandHandler);
            BrowseAncestryCommand     = new DelegateCommand(BrowseAncestryCommandHandler);
            BrowseInteractionsCommand = new DelegateCommand(BrowseInteractionsCommandHandler);
            ExpandCommand             = new DelegateCommand(ExpandCommandHandler);

            RefreshBackground();
            ResetName();
        }
        public TypeViewModel(TypeInfo typeInfo, AssemblyViewModel assemblyViewModel, AssemblyBrowserWindowViewModel windowViewModel)
        {
            _typeInfo = typeInfo;
            _windowViewModel = windowViewModel;
            _assemblyViewModel = assemblyViewModel;

            _name = typeInfo.Name;
            _fullName = typeInfo.FullName;
            _extendedInfo = IsInternal
                                ? string.Format("{0}\n{1}", FullName, Resources.Internal)
                                : FullName;
            if (_typeInfo.IsEnum)
            {
                var enumValues = _typeInfo.Fields.Where(f => f.Name != "value__").Select(f => f.Name);
                if (enumValues.Count() > 0)
                {
                    var values = string.Join("\n", _typeInfo.Fields.Where(f => f.Name != "value__").Select(f => f.Name));
                    _extendedInfo = string.Format("{0}\n\n{1}", _extendedInfo, values);
                }
            }
            else if (_typeInfo.IsInterface)
            {
                var members = _typeInfo.Events.Select(m => m.Text)
                    .Concat(_typeInfo.Properties.Select(p => p.Text))
                    .Concat(_typeInfo.Methods.Select(p => p.Text));
                if (members.Count() > 0)
                {
                    var values = string.Join("\n", members);
                    _extendedInfo = string.Format("{0}\n\n{1}", _extendedInfo, values);
                }
            }

            if (HasBaseType)
            {
                var baseType = _typeInfo.BaseType;

                _baseTypeName = baseType.Name;
                _baseTypeFullName = baseType.FullName;
                if (baseType == null)
                {
                    _baseTypeFullName = _baseTypeFullName + "\n" + Resources.NotAvailable;
                    _isBaseTypeAvailable = false;
                }
            }

            var properties = typeInfo.Properties
                .Where(p => p.IsPublic)
                .Select(p => new PropertyViewModel(p))
                .OfType<MemberViewModel>();

            var events = typeInfo.Events
                .Where(e => e.IsPublic)
                .Select(e => new EventViewModel(e))
                .OfType<MemberViewModel>();

            var methods = typeInfo.Methods
                .Where(m => m.IsPublic)
                .Select(m => new MethodViewModel(m))
                .OfType<MemberViewModel>();

            Members = properties.Concat(events).Concat(methods);
            _membersCount = typeInfo.MembersCount;

            VisualizeCommand = new DelegateCommand(VisualizeCommandHandler);
            NavigateCommand = new DelegateCommand(NavigateCommandHandler);
            NavigateToBaseCommand = new DelegateCommand(NavigateToBaseCommandHandler);
            ShowMembersCommand = new DelegateCommand(ShowMembersCommandHandler);
            BrowseAncestryCommand = new DelegateCommand(BrowseAncestryCommandHandler);
            BrowseInteractionsCommand = new DelegateCommand(BrowseInteractionsCommandHandler);
            ExpandCommand = new DelegateCommand(ExpandCommandHandler);

            RefreshBackground();
            ResetName();
        }