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(); }
AnalyzerManager(IWpfCommandManager wpfCommandManager, IFileTabManager fileTabManager, ITreeViewManager treeViewManager, IMenuManager menuManager, IThemeManager themeManager, IAnalyzerSettings analyzerSettings, IDotNetImageManager dotNetImageManager, ILanguageManager languageManager) { this.fileTabManager = fileTabManager; this.context = new AnalyzerTreeNodeDataContext { DotNetImageManager = dotNetImageManager, Language = languageManager.Language, FileManager = fileTabManager.FileTreeView.FileManager, ShowToken = analyzerSettings.ShowToken, SingleClickExpandsChildren = analyzerSettings.SingleClickExpandsChildren, SyntaxHighlight = analyzerSettings.SyntaxHighlight, UseNewRenderer = analyzerSettings.UseNewRenderer, AnalyzerManager = this, }; var options = new TreeViewOptions { CanDragAndDrop = false, TreeViewListener = this, }; this.TreeView = treeViewManager.Create(ANALYZER_TREEVIEW_GUID, options); fileTabManager.FileTreeView.FileManager.CollectionChanged += FileManager_CollectionChanged; fileTabManager.FileModified += FileTabManager_FileModified; languageManager.LanguageChanged += LanguageManager_LanguageChanged; themeManager.ThemeChanged += ThemeManager_ThemeChanged; analyzerSettings.PropertyChanged += AnalyzerSettings_PropertyChanged; menuManager.InitializeContextMenu((FrameworkElement)this.TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_ANALYZER_TREEVIEW_GUID), new GuidObjectsProvider(this.TreeView)); wpfCommandManager.Add(CommandConstants.GUID_ANALYZER_TREEVIEW, (UIElement)this.TreeView.UIObject); var cmds = wpfCommandManager.GetCommands(CommandConstants.GUID_ANALYZER_TREEVIEW); var command = new RelayCommand(a => ActivateNode()); cmds.Add(command, ModifierKeys.Control, Key.Enter); cmds.Add(command, ModifierKeys.Shift, Key.Enter); }
AnalyzerManager(IWpfCommandManager wpfCommandManager, IFileTabManager fileTabManager, ITreeViewManager treeViewManager, IMenuManager menuManager, IThemeManager themeManager, IAnalyzerSettings analyzerSettings, IDotNetImageManager dotNetImageManager, ILanguageManager languageManager, IFileManager fileManager) { this.fileTabManager = fileTabManager; this.context = new AnalyzerTreeNodeDataContext { DotNetImageManager = dotNetImageManager, Language = languageManager.SelectedLanguage, FileManager = fileManager, ShowToken = analyzerSettings.ShowToken, SingleClickExpandsChildren = analyzerSettings.SingleClickExpandsChildren, SyntaxHighlight = analyzerSettings.SyntaxHighlight, UseNewRenderer = analyzerSettings.UseNewRenderer, AnalyzerManager = this, }; var options = new TreeViewOptions { CanDragAndDrop = false, TreeViewListener = this, }; this.treeView = treeViewManager.Create(ANALYZER_TREEVIEW_GUID, options); fileManager.CollectionChanged += FileManager_CollectionChanged; fileTabManager.FileModified += FileTabManager_FileModified; languageManager.LanguageChanged += LanguageManager_LanguageChanged; themeManager.ThemeChanged += ThemeManager_ThemeChanged; analyzerSettings.PropertyChanged += AnalyzerSettings_PropertyChanged; menuManager.InitializeContextMenu((FrameworkElement)this.treeView.UIObject, new Guid(MenuConstants.GUIDOBJ_ANALYZER_TREEVIEW_GUID), new GuidObjectsCreator(this.treeView)); wpfCommandManager.Add(CommandConstants.GUID_ANALYZER_TREEVIEW, (UIElement)this.treeView.UIObject); var cmds = wpfCommandManager.GetCommands(CommandConstants.GUID_ANALYZER_TREEVIEW); var command = new RelayCommand(a => ActivateNode()); cmds.Add(command, ModifierKeys.Control, Key.Enter); cmds.Add(command, ModifierKeys.Shift, Key.Enter); }
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(); }