public TreeViewImpl(ITreeViewManager treeViewManager, IThemeManager themeManager, IImageManager imageManager, Guid guid, TreeViewOptions options) { this.guid = guid; this.treeViewManager = treeViewManager; this.imageManager = imageManager; this.treeViewListener = options.TreeViewListener; this.sharpTreeView = new SharpTreeView(); this.sharpTreeView.SelectionChanged += SharpTreeView_SelectionChanged; this.sharpTreeView.CanDragAndDrop = options.CanDragAndDrop; this.sharpTreeView.AllowDrop = options.AllowDrop; this.sharpTreeView.AllowDropOrder = options.AllowDrop; VirtualizingStackPanel.SetIsVirtualizing(this.sharpTreeView, options.IsVirtualizing); VirtualizingStackPanel.SetVirtualizationMode(this.sharpTreeView, options.VirtualizationMode); this.sharpTreeView.SelectionMode = options.SelectionMode; this.sharpTreeView.BorderThickness = new Thickness(0); this.sharpTreeView.ShowRoot = false; this.sharpTreeView.ShowLines = false; if (options.IsGridView) { this.sharpTreeView.ItemContainerStyle = (Style)Application.Current.FindResource(SharpGridView.ItemContainerStyleKey); this.sharpTreeView.Style = (Style)Application.Current.FindResource("SharpTreeViewGridViewStyle"); } else { // Clear the value set by the constructor. This is required or our style won't be used. this.sharpTreeView.ClearValue(ItemsControl.ItemContainerStyleProperty); this.sharpTreeView.Style = (Style)Application.Current.FindResource(typeof(SharpTreeView)); } this.sharpTreeView.GetPreviewInsideTextBackground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlight).Background; this.sharpTreeView.GetPreviewInsideForeground = () => themeManager.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground; // Add the root at the end since Create() requires some stuff to have been initialized this.root = Create(options.RootNode ?? new TreeNodeDataImpl(new Guid(FileTVConstants.ROOT_NODE_GUID))); this.sharpTreeView.Root = this.root.Node; }
public TreeViewImpl(ITreeViewServiceImpl treeViewService, IThemeService themeService, IClassificationFormatMapService classificationFormatMapService, Guid guid, TreeViewOptions options) { Guid = guid; this.treeViewService = treeViewService; treeViewListener = options.TreeViewListener; classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged; foregroundBrushResourceKey = options.ForegroundBrushResourceKey ?? "TreeViewForeground"; sharpTreeView = new SharpTreeView(); sharpTreeView.SelectionChanged += SharpTreeView_SelectionChanged; sharpTreeView.CanDragAndDrop = options.CanDragAndDrop; sharpTreeView.AllowDrop = options.AllowDrop; sharpTreeView.AllowDropOrder = options.AllowDrop; VirtualizingStackPanel.SetIsVirtualizing(sharpTreeView, options.IsVirtualizing); VirtualizingStackPanel.SetVirtualizationMode(sharpTreeView, options.VirtualizationMode); sharpTreeView.SelectionMode = options.SelectionMode; sharpTreeView.BorderThickness = new Thickness(0); sharpTreeView.ShowRoot = false; sharpTreeView.ShowLines = false; if (options.IsGridView) { sharpTreeView.SetResourceReference(ItemsControl.ItemContainerStyleProperty, SharpGridView.ItemContainerStyleKey); sharpTreeView.SetResourceReference(FrameworkElement.StyleProperty, "SharpTreeViewGridViewStyle"); } else { // Clear the value set by the constructor. This is required or our style won't be used. sharpTreeView.ClearValue(ItemsControl.ItemContainerStyleProperty); sharpTreeView.SetResourceReference(FrameworkElement.StyleProperty, typeof(SharpTreeView)); } sharpTreeView.GetPreviewInsideTextBackground = () => themeService.Theme.GetColor(ColorType.SystemColorsHighlight).Background; sharpTreeView.GetPreviewInsideForeground = () => themeService.Theme.GetColor(ColorType.SystemColorsHighlightText).Foreground; // Add the root at the end since Create() requires some stuff to have been initialized root = Create(options.RootNode ?? new TreeNodeDataImpl(new Guid(DocumentTreeViewConstants.ROOT_NODE_GUID))); sharpTreeView.Root = root.Node; }
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); }
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 ITreeView Create(Guid guid, TreeViewOptions options) => new TreeViewImpl(this, themeService, classificationFormatMapService, guid, options);
public ITreeView Create(Guid guid, TreeViewOptions options) { return new TreeViewImpl(this, themeManager, imageManager, guid, options); }