Example #1
0
        public FileTreeView(bool isGlobal, IFileTreeNodeFilter filter, IThemeManager themeManager, ITreeViewManager treeViewManager, ILanguageManager languageManager, IFileManager fileManager, IFileTreeViewSettings fileTreeViewSettings, IMenuManager menuManager, IDotNetImageManager dotNetImageManager, IWpfCommandManager wpfCommandManager, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable <Lazy <IDnSpyFileNodeProvider, IDnSpyFileNodeProviderMetadata> > dnSpyFileNodeProviders, [ImportMany] IEnumerable <Lazy <IFileTreeNodeDataFinder, IFileTreeNodeDataFinderMetadata> > mefFinders)
        {
            this.languageManager      = languageManager;
            this.themeManager         = themeManager;
            this.fileTreeViewSettings = fileTreeViewSettings;
            this.appSettings          = appSettings;

            this.context = new FileTreeNodeDataContext(this, resourceNodeFactory, filter ?? FilterNothingFileTreeNodeFilter.Instance)
            {
                SyntaxHighlight            = fileTreeViewSettings.SyntaxHighlight,
                SingleClickExpandsChildren = fileTreeViewSettings.SingleClickExpandsTreeViewChildren,
                ShowAssemblyVersion        = fileTreeViewSettings.ShowAssemblyVersion,
                ShowAssemblyPublicKeyToken = fileTreeViewSettings.ShowAssemblyPublicKeyToken,
                ShowToken            = fileTreeViewSettings.ShowToken,
                Language             = languageManager.Language,
                UseNewRenderer       = appSettings.UseNewRenderer_FileTreeView,
                DeserializeResources = fileTreeViewSettings.DeserializeResources,
                CanDragAndDrop       = isGlobal,
            };

            var options = new TreeViewOptions {
                AllowDrop          = true,
                IsVirtualizing     = true,
                VirtualizationMode = VirtualizationMode.Recycling,
                TreeViewListener   = this,
                RootNode           = new RootNode {
                    DropNodes = OnDropNodes,
                    DropFiles = OnDropFiles,
                },
            };

            this.fileTreeNodeGroups     = new FileTreeNodeGroups();
            this.dnSpyFileNodeProviders = dnSpyFileNodeProviders.OrderBy(a => a.Metadata.Order).ToArray();
            this.TreeView = treeViewManager.Create(new Guid(TVConstants.FILE_TREEVIEW_GUID), options);
            this.TreeView.SelectionChanged += TreeView_SelectionChanged;
            this.FileManager        = fileManager;
            this.DotNetImageManager = dotNetImageManager;
            this.dispatcher         = Dispatcher.CurrentDispatcher;
            this.FileManager.SetDispatcher(AddAction);
            fileManager.CollectionChanged        += FileManager_CollectionChanged;
            languageManager.LanguageChanged      += LanguageManager_LanguageChanged;
            themeManager.ThemeChanged            += ThemeManager_ThemeChanged;
            fileTreeViewSettings.PropertyChanged += FileTreeViewSettings_PropertyChanged;
            appSettings.PropertyChanged          += AppSettings_PropertyChanged;

            this.WpfCommands = wpfCommandManager.GetCommands(CommandConstants.GUID_FILE_TREEVIEW);

            if (isGlobal)
            {
                menuManager.InitializeContextMenu((FrameworkElement)this.TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_FILES_TREEVIEW_GUID), new GuidObjectsProvider(this.TreeView));
                wpfCommandManager.Add(CommandConstants.GUID_FILE_TREEVIEW, (UIElement)TreeView.UIObject);
            }

            this.nodeFinders = mefFinders.OrderBy(a => a.Metadata.Order).ToArray();
            InitializeFileTreeNodeGroups();
        }
Example #2
0
        public DocumentTreeView(bool isGlobal, IDocumentTreeNodeFilter filter, ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentService documentService, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable <Lazy <IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata> > dsDocumentNodeProvider, [ImportMany] IEnumerable <Lazy <IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata> > mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider)
        {
            this.decompilerService        = decompilerService;
            this.documentTreeViewSettings = documentTreeViewSettings;
            this.appSettings = appSettings;

            this.context = new DocumentTreeNodeDataContext(this, resourceNodeFactory, filter ?? FilterNothingDocumentTreeNodeFilter.Instance, treeViewNodeTextElementProvider)
            {
                SyntaxHighlight            = documentTreeViewSettings.SyntaxHighlight,
                SingleClickExpandsChildren = documentTreeViewSettings.SingleClickExpandsTreeViewChildren,
                ShowAssemblyVersion        = documentTreeViewSettings.ShowAssemblyVersion,
                ShowAssemblyPublicKeyToken = documentTreeViewSettings.ShowAssemblyPublicKeyToken,
                ShowToken            = documentTreeViewSettings.ShowToken,
                Decompiler           = decompilerService.Decompiler,
                UseNewRenderer       = appSettings.UseNewRenderer_DocumentTreeView,
                DeserializeResources = documentTreeViewSettings.DeserializeResources,
                CanDragAndDrop       = isGlobal,
            };

            var options = new TreeViewOptions {
                AllowDrop          = true,
                IsVirtualizing     = true,
                VirtualizationMode = VirtualizationMode.Recycling,
                TreeViewListener   = this,
                RootNode           = new RootNode {
                    DropNodes = OnDropNodes,
                    DropFiles = OnDropFiles,
                },
            };

            this.documentTreeNodeGroups = new DocumentTreeNodeGroups();
            this.dsDocumentNodeProvider = dsDocumentNodeProvider.OrderBy(a => a.Metadata.Order).ToArray();
            this.TreeView = treeViewService.Create(new Guid(TreeViewConstants.DOCUMENT_TREEVIEW_GUID), options);
            this.TreeView.SelectionChanged += TreeView_SelectionChanged;
            this.DocumentService            = documentService;
            this.DotNetImageService         = dotNetImageService;
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.DocumentService.SetDispatcher(AddAction);
            documentService.CollectionChanged        += DocumentService_CollectionChanged;
            decompilerService.DecompilerChanged      += DecompilerService_DecompilerChanged;
            documentTreeViewSettings.PropertyChanged += DocumentTreeViewSettings_PropertyChanged;
            appSettings.PropertyChanged += AppSettings_PropertyChanged;

            this.WpfCommands = wpfCommandService.GetCommands(ControlConstants.GUID_DOCUMENT_TREEVIEW);

            if (isGlobal)
            {
                menuService.InitializeContextMenu(this.TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_DOCUMENTS_TREEVIEW_GUID), new GuidObjectsProvider(this.TreeView));
                wpfCommandService.Add(ControlConstants.GUID_DOCUMENT_TREEVIEW, TreeView.UIObject);
            }

            this.nodeFinders = mefFinders.OrderBy(a => a.Metadata.Order).ToArray();
            InitializeDocumentTreeNodeGroups();
        }
Example #3
0
 AppWindow(ISettingsService settingsService, IDocumentTabService documentTabService, AppToolBar appToolBar, MainWindowControl mainWindowControl, IWpfCommandService wpfCommandService)
 {
     assemblyInformationalVersion = CalculateAssemblyInformationalVersion(GetType().Assembly);
     uiSettings = new UISettings(settingsService);
     uiSettings.Read();
     stackedContent          = new StackedContent <IStackedContentChild>(margin: new Thickness(6));
     this.documentTabService = documentTabService;
     statusBar              = new AppStatusBar();
     this.appToolBar        = appToolBar;
     this.mainWindowControl = mainWindowControl;
     this.wpfCommandService = wpfCommandService;
     mainWindowCommands     = wpfCommandService.GetCommands(ControlConstants.GUID_MAINWINDOW);
     mainWindowClosing      = new WeakEventList <CancelEventArgs>();
     mainWindowClosed       = new WeakEventList <EventArgs>();
 }
Example #4
0
 AppWindow(IThemeManager themeManager, IImageManager imageManager, IAppSettings appSettings, ISettingsManager settingsManager, IFileTabManager fileTabManager, AppToolBar appToolBar, MainWindowControl mainWindowControl, IWpfCommandManager wpfCommandManager, IDecompilerManager decompilerManager)
 {
     this.assemblyInformationalVersion = CalculateAssemblyInformationalVersion(GetType().Assembly);
     this.uiSettings = new UISettings(settingsManager);
     this.uiSettings.Read();
     this.appSettings           = appSettings;
     this.stackedContent        = new StackedContent <IStackedContentChild>(margin: new Thickness(6));
     this.themeManager          = themeManager;
     themeManager.ThemeChanged += ThemeManager_ThemeChanged;
     this.imageManager          = imageManager;
     this.fileTabManager        = fileTabManager;
     this.statusBar             = new AppStatusBar();
     this.appToolBar            = appToolBar;
     this.mainWindowControl     = mainWindowControl;
     this.wpfCommandManager     = wpfCommandManager;
     this.decompilerManager     = decompilerManager;
     this.mainWindowCommands    = wpfCommandManager.GetCommands(ControlConstants.GUID_MAINWINDOW);
     this.mainWindowClosing     = new WeakEventList <CancelEventArgs>();
     this.mainWindowClosed      = new WeakEventList <EventArgs>();
 }
Example #5
0
		AppWindow(ISettingsService settingsService, IDocumentTabService documentTabService, AppToolBar appToolBar, MainWindowControl mainWindowControl, IWpfCommandService wpfCommandService) {
			assemblyInformationalVersion = CalculateAssemblyInformationalVersion(GetType().Assembly);
			uiSettings = new UISettings(settingsService);
			uiSettings.Read();
			stackedContent = new StackedContent<IStackedContentChild>(margin: new Thickness(6));
			this.documentTabService = documentTabService;
			statusBar = new AppStatusBar();
			this.appToolBar = appToolBar;
			this.mainWindowControl = mainWindowControl;
			this.wpfCommandService = wpfCommandService;
			mainWindowCommands = wpfCommandService.GetCommands(ControlConstants.GUID_MAINWINDOW);
			mainWindowClosing = new WeakEventList<CancelEventArgs>();
			mainWindowClosed = new WeakEventList<EventArgs>();
		}
Example #6
0
 AppWindow(IThemeManager themeManager, IImageManager imageManager, IAppSettings appSettings, ISettingsManager settingsManager, IFileTabManager fileTabManager, AppToolBar appToolBar, MainWindowControl mainWindowControl, IWpfCommandManager wpfCommandManager, ILanguageManager languageManager)
 {
     this.assemblyInformationalVersion = CalculateAssemblyInformationalVersion(GetType().Assembly);
     this.uiSettings = new UISettings(settingsManager);
     this.uiSettings.Read();
     this.appSettings = appSettings;
     this.stackedContent = new StackedContent<IStackedContentChild>(margin: new Thickness(6));
     this.themeManager = themeManager;
     themeManager.ThemeChanged += ThemeManager_ThemeChanged;
     this.imageManager = imageManager;
     this.fileTabManager = fileTabManager;
     this.statusBar = new AppStatusBar();
     this.appToolBar = appToolBar;
     this.mainWindowControl = mainWindowControl;
     this.wpfCommandManager = wpfCommandManager;
     this.languageManager = languageManager;
     this.mainWindowCommands = wpfCommandManager.GetCommands(CommandConstants.GUID_MAINWINDOW);
     this.mainWindowClosing = new WeakEventList<CancelEventArgs>();
     this.mainWindowClosed = new WeakEventList<EventArgs>();
     this.appSettings.PropertyChanged += AppSettings_PropertyChanged;
     InitializeTextFormatterProvider();
 }
Example #7
0
        public FileTreeView(bool isGlobal, IFileTreeNodeFilter filter, IThemeManager themeManager, ITreeViewManager treeViewManager, ILanguageManager languageManager, IFileManager fileManager, IFileTreeViewSettings fileTreeViewSettings, IMenuManager menuManager, IDotNetImageManager dotNetImageManager, IWpfCommandManager wpfCommandManager, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable <Lazy <IDnSpyFileNodeCreator, IDnSpyFileNodeCreatorMetadata> > dnSpyFileNodeCreators, [ImportMany] IEnumerable <Lazy <IFileTreeNodeDataFinder, IFileTreeNodeDataFinderMetadata> > mefFinders)
        {
            this.languageManager      = languageManager;
            this.themeManager         = themeManager;
            this.fileTreeViewSettings = fileTreeViewSettings;
            this.appSettings          = appSettings;

            this.context = new FileTreeNodeDataContext(this, resourceNodeFactory, filter ?? FilterNothingFileTreeNodeFilter.Instance)
            {
                SyntaxHighlight            = fileTreeViewSettings.SyntaxHighlight,
                SingleClickExpandsChildren = fileTreeViewSettings.SingleClickExpandsTreeViewChildren,
                ShowAssemblyVersion        = fileTreeViewSettings.ShowAssemblyVersion,
                ShowAssemblyPublicKeyToken = fileTreeViewSettings.ShowAssemblyPublicKeyToken,
                ShowToken            = fileTreeViewSettings.ShowToken,
                Language             = languageManager.SelectedLanguage,
                UseNewRenderer       = appSettings.UseNewRenderer_FileTreeView,
                DeserializeResources = fileTreeViewSettings.DeserializeResources,
                CanDragAndDrop       = isGlobal,
            };

            var options = new TreeViewOptions {
                AllowDrop          = true,
                IsVirtualizing     = true,
                VirtualizationMode = VirtualizationMode.Recycling,
                TreeViewListener   = this,
                RootNode           = new RootNode {
                    DropNodes = OnDropNodes,
                    DropFiles = OnDropFiles,
                },
            };

            this.fileTreeNodeGroups    = new FileTreeNodeGroups();
            this.dnSpyFileNodeCreators = dnSpyFileNodeCreators.OrderBy(a => a.Metadata.Order).ToArray();
            this.treeView           = treeViewManager.Create(new Guid(TVConstants.FILE_TREEVIEW_GUID), options);
            this.fileManager        = fileManager;
            this.dotNetImageManager = dotNetImageManager;
            var dispatcher = Dispatcher.CurrentDispatcher;

            this.fileManager.SetDispatcher(a => {
                if (!dispatcher.HasShutdownFinished && !dispatcher.HasShutdownStarted)
                {
                    bool callInvoke;
                    lock (actionsToCall) {
                        actionsToCall.Add(a);
                        callInvoke = actionsToCall.Count == 1;
                    }
                    if (callInvoke)
                    {
                        // Always notify with a delay because adding stuff to the tree view could
                        // cause some problems with the tree view or the list box it derives from.
                        dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(CallActions));
                    }
                }
            });
            fileManager.CollectionChanged        += FileManager_CollectionChanged;
            languageManager.LanguageChanged      += LanguageManager_LanguageChanged;
            themeManager.ThemeChanged            += ThemeManager_ThemeChanged;
            fileTreeViewSettings.PropertyChanged += FileTreeViewSettings_PropertyChanged;
            appSettings.PropertyChanged          += AppSettings_PropertyChanged;

            this.wpfCommands = wpfCommandManager.GetCommands(CommandConstants.GUID_FILE_TREEVIEW);

            if (isGlobal)
            {
                menuManager.InitializeContextMenu((FrameworkElement)this.treeView.UIObject, new Guid(MenuConstants.GUIDOBJ_FILES_TREEVIEW_GUID), new GuidObjectsCreator(this.treeView));
                wpfCommandManager.Add(CommandConstants.GUID_FILE_TREEVIEW, (UIElement)treeView.UIObject);
            }

            this.nodeFinders = mefFinders.OrderBy(a => a.Metadata.Order).ToArray();
            InitializeFileTreeNodeGroups();
        }