Beispiel #1
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();
        }
Beispiel #2
0
        ITreeView CreateTreeView(AppSettingsPageVM rootVM)
        {
            var options = new TreeViewOptions {
                CanDragAndDrop             = false,
                SelectionMode              = SelectionMode.Single,
                ForegroundBrushResourceKey = "AppSettingsTreeViewForeground",
                RootNode = rootVM,
            };
            var treeView = treeViewService.Create(new Guid("99334011-E467-456F-A0DF-BD4DBD0F0519"), options);

            treeView.UIObject.Padding         = new Thickness(0, 2, 0, 2);
            treeView.UIObject.BorderThickness = new Thickness(1);
            treeView.UIObject.SetResourceReference(Control.BorderBrushProperty, "AppSettingsTreeViewBorder");
            treeView.UIObject.SetResourceReference(Control.ForegroundProperty, "AppSettingsTreeViewForeground");
            treeView.UIObject.SetResourceReference(Control.BackgroundProperty, "AppSettingsTreeViewBackground");

            return(treeView);
        }
Beispiel #3
0
        AnalyzerService(IWpfCommandService wpfCommandService, IDocumentTabService documentTabService, ITreeViewService treeViewService, IMenuService menuService, IAnalyzerSettings analyzerSettings, IDotNetImageService dotNetImageService, IDecompilerService decompilerService, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider)
        {
            this.documentTabService = documentTabService;

            context = new AnalyzerTreeNodeDataContext {
                DotNetImageService = dotNetImageService,
                Decompiler         = decompilerService.Decompiler,
                TreeViewNodeTextElementProvider = treeViewNodeTextElementProvider,
                DocumentService            = documentTabService.DocumentTreeView.DocumentService,
                ShowToken                  = analyzerSettings.ShowToken,
                SingleClickExpandsChildren = analyzerSettings.SingleClickExpandsChildren,
                SyntaxHighlight            = analyzerSettings.SyntaxHighlight,
                UseNewRenderer             = analyzerSettings.UseNewRenderer,
                AnalyzerService            = this,
            };

            var options = new TreeViewOptions {
                CanDragAndDrop   = false,
                TreeViewListener = this,
            };

            TreeView         = treeViewService.Create(ANALYZER_TREEVIEW_GUID, options);
            context.TreeView = TreeView;

            documentTabService.DocumentTreeView.DocumentService.CollectionChanged += DocumentService_CollectionChanged;
            documentTabService.DocumentModified += DocumentTabService_FileModified;
            decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged;
            analyzerSettings.PropertyChanged    += AnalyzerSettings_PropertyChanged;

            menuService.InitializeContextMenu(TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_ANALYZER_TREEVIEW_GUID), new GuidObjectsProvider(TreeView));
            wpfCommandService.Add(ControlConstants.GUID_ANALYZER_TREEVIEW, TreeView.UIObject);
            var cmds    = wpfCommandService.GetCommands(ControlConstants.GUID_ANALYZER_TREEVIEW);
            var command = new RelayCommand(a => ActivateNode());

            cmds.Add(command, ModifierKeys.Control, Key.Enter);
            cmds.Add(command, ModifierKeys.Shift, Key.Enter);
        }
Beispiel #4
0
		AnalyzerService(IWpfCommandService wpfCommandService, IDocumentTabService documentTabService, ITreeViewService treeViewService, IMenuService menuService, IAnalyzerSettings analyzerSettings, IDotNetImageService dotNetImageService, IDecompilerService decompilerService, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider) {
			this.documentTabService = documentTabService;

			context = new AnalyzerTreeNodeDataContext {
				DotNetImageService = dotNetImageService,
				Decompiler = decompilerService.Decompiler,
				TreeViewNodeTextElementProvider = treeViewNodeTextElementProvider,
				DocumentService = documentTabService.DocumentTreeView.DocumentService,
				ShowToken = analyzerSettings.ShowToken,
				SingleClickExpandsChildren = analyzerSettings.SingleClickExpandsChildren,
				SyntaxHighlight = analyzerSettings.SyntaxHighlight,
				UseNewRenderer = analyzerSettings.UseNewRenderer,
				AnalyzerService = this,
			};

			var options = new TreeViewOptions {
				CanDragAndDrop = false,
				TreeViewListener = this,
			};
			TreeView = treeViewService.Create(ANALYZER_TREEVIEW_GUID, options);
			context.TreeView = TreeView;

			documentTabService.DocumentTreeView.DocumentService.CollectionChanged += DocumentService_CollectionChanged;
			documentTabService.DocumentModified += DocumentTabService_FileModified;
			decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged;
			analyzerSettings.PropertyChanged += AnalyzerSettings_PropertyChanged;

			menuService.InitializeContextMenu(TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_ANALYZER_TREEVIEW_GUID), new GuidObjectsProvider(TreeView));
			wpfCommandService.Add(ControlConstants.GUID_ANALYZER_TREEVIEW, TreeView.UIObject);
			var cmds = wpfCommandService.GetCommands(ControlConstants.GUID_ANALYZER_TREEVIEW);
			var command = new RelayCommand(a => ActivateNode());
			cmds.Add(command, ModifierKeys.Control, Key.Enter);
			cmds.Add(command, ModifierKeys.Shift, Key.Enter);
		}