예제 #1
0
        public ReplEditorUI(ReplEditorOptions options, IThemeManager themeManager, IWpfCommandManager wpfCommandManager, IMenuManager menuManager, ITextEditorSettings textEditorSettings)
        {
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.options    = (options ?? new ReplEditorOptions()).Clone();
            this.textEditor = new NewTextEditor(themeManager, textEditorSettings);
            this.textEditor.TextArea.Document = new TextDocument();
            this.textEditor.TextArea.Document.UndoStack.SizeLimit = 100;
            this.textEditor.TextArea.LeftMargins.Insert(0, new FrameworkElement {
                Margin = new Thickness(LEFT_MARGIN, 0, 0, 0)
            });
            this.textEditor.TextArea.TextEntering   += TextArea_TextEntering;
            this.textEditor.TextArea.PreviewKeyDown += TextArea_PreviewKeyDown;
            AddBinding(ApplicationCommands.Paste, (s, e) => Paste(), (s, e) => e.CanExecute      = CanPaste && IsAtEditingPosition);
            AddBinding(ApplicationCommands.Cut, (s, e) => CutSelection(), (s, e) => e.CanExecute = CanCutSelection && IsAtEditingPosition);

            if (this.options.TextEditorCommandGuid != null)
            {
                wpfCommandManager.Add(this.options.TextEditorCommandGuid.Value, textEditor);
            }
            if (this.options.TextAreaCommandGuid != null)
            {
                wpfCommandManager.Add(this.options.TextAreaCommandGuid.Value, textEditor.TextArea);
            }
            if (this.options.MenuGuid != null)
            {
                menuManager.InitializeContextMenu(this.textEditor, this.options.MenuGuid.Value, new GuidObjectsCreator(this), new ContextMenuInitializer(textEditor, textEditor));
            }
        }
예제 #2
0
		ExceptionsContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, Lazy<IExceptionsVM> exceptionsVM) {
			this.exceptionsControl = new ExceptionsControl();
			this.vmExceptions = exceptionsVM;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;

			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_EXCEPTIONS_CONTROL, exceptionsControl);
			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_EXCEPTIONS_LISTVIEW, exceptionsControl.ListBox);
		}
예제 #3
0
		LocalsContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, ILocalsVM localsVM) {
			this.localsControl = new LocalsControl();
			this.vmLocals = localsVM;
			this.localsControl.DataContext = this.vmLocals;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;

			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_LOCALS_CONTROL, localsControl);
			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_LOCALS_LISTVIEW, localsControl.ListView);
		}
예제 #4
0
        ExceptionsContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, Lazy <IExceptionsVM> exceptionsVM)
        {
            this.exceptionsControl     = new ExceptionsControl();
            this.vmExceptions          = exceptionsVM;
            themeManager.ThemeChanged += ThemeManager_ThemeChanged;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_EXCEPTIONS_CONTROL, exceptionsControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_EXCEPTIONS_LISTVIEW, exceptionsControl.ListBox);
        }
예제 #5
0
        BreakpointsContent(IWpfCommandManager wpfCommandManager, Lazy <IBreakpointsVM> breakpointsVM, Lazy <IModuleLoader> moduleLoader, IFileTabManager fileTabManager)
        {
            this.breakpointsControl = new BreakpointsControl();
            this.moduleLoader       = moduleLoader;
            this.fileTabManager     = fileTabManager;
            this.vmBreakpoints      = breakpointsVM;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_BREAKPOINTS_CONTROL, breakpointsControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_BREAKPOINTS_LISTVIEW, breakpointsControl.ListView);
        }
예제 #6
0
        LocalsContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, ILocalsVM localsVM)
        {
            this.localsControl             = new LocalsControl();
            this.vmLocals                  = localsVM;
            this.localsControl.DataContext = this.vmLocals;
            themeManager.ThemeChanged     += ThemeManager_ThemeChanged;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_LOCALS_CONTROL, localsControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_LOCALS_LISTVIEW, localsControl.ListView);
        }
예제 #7
0
		CallStackContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, ICallStackVM callStackVM, Lazy<IStackFrameManager> stackFrameManager, IFileTabManager fileTabManager, Lazy<IModuleLoader> moduleLoader) {
			this.callStackControl = new CallStackControl();
			this.vmCallStack = callStackVM;
			this.stackFrameManager = stackFrameManager;
			this.fileTabManager = fileTabManager;
			this.moduleLoader = moduleLoader;
			this.callStackControl.DataContext = this.vmCallStack;
			this.callStackControl.CallStackListViewDoubleClick += CallStackControl_CallStackListViewDoubleClick;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;

			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_CALLSTACK_CONTROL, callStackControl);
			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_CALLSTACK_LISTVIEW, callStackControl.ListView);
		}
예제 #8
0
		ThreadsContent(IWpfCommandManager wpfCommandManager, IThreadsVM threadsVM, IThemeManager themeManager, Lazy<IStackFrameManager> stackFrameManager, IFileTabManager fileTabManager, Lazy<IModuleLoader> moduleLoader) {
			this.stackFrameManager = stackFrameManager;
			this.fileTabManager = fileTabManager;
			this.moduleLoader = moduleLoader;
			this.threadsControl = new ThreadsControl();
			this.vmThreads = threadsVM;
			this.threadsControl.DataContext = this.vmThreads;
			this.threadsControl.ThreadsListViewDoubleClick += ThreadsControl_ThreadsListViewDoubleClick;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;

			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_THREADS_CONTROL, threadsControl);
			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_THREADS_LISTVIEW, threadsControl.ListView);
		}
예제 #9
0
		ModulesContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, IModulesVM modulesVM, IFileTabManager fileTabManager, Lazy<ModuleLoader> moduleLoader, Lazy<IInMemoryModuleManager> inMemoryModuleManager) {
			this.modulesControl = new ModulesControl();
			this.vmModules = modulesVM;
			this.fileTabManager = fileTabManager;
			this.moduleLoader = moduleLoader;
			this.inMemoryModuleManager = inMemoryModuleManager;
			this.modulesControl.DataContext = this.vmModules;
			this.modulesControl.ModulesListViewDoubleClick += ModulesControl_ModulesListViewDoubleClick;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;

			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MODULES_CONTROL, modulesControl);
			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MODULES_LISTVIEW, modulesControl.ListView);
		}
예제 #10
0
        CallStackContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, ICallStackVM callStackVM, Lazy <IStackFrameManager> stackFrameManager, IFileTabManager fileTabManager, Lazy <IModuleLoader> moduleLoader)
        {
            this.callStackControl             = new CallStackControl();
            this.vmCallStack                  = callStackVM;
            this.stackFrameManager            = stackFrameManager;
            this.fileTabManager               = fileTabManager;
            this.moduleLoader                 = moduleLoader;
            this.callStackControl.DataContext = this.vmCallStack;
            this.callStackControl.CallStackListViewDoubleClick += CallStackControl_CallStackListViewDoubleClick;
            themeManager.ThemeChanged += ThemeManager_ThemeChanged;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_CALLSTACK_CONTROL, callStackControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_CALLSTACK_LISTVIEW, callStackControl.ListView);
        }
예제 #11
0
        ThreadsContent(IWpfCommandManager wpfCommandManager, IThreadsVM threadsVM, IThemeManager themeManager, Lazy <IStackFrameManager> stackFrameManager, IFileTabManager fileTabManager, Lazy <IModuleLoader> moduleLoader)
        {
            this.stackFrameManager          = stackFrameManager;
            this.fileTabManager             = fileTabManager;
            this.moduleLoader               = moduleLoader;
            this.threadsControl             = new ThreadsControl();
            this.vmThreads                  = threadsVM;
            this.threadsControl.DataContext = this.vmThreads;
            this.threadsControl.ThreadsListViewDoubleClick += ThreadsControl_ThreadsListViewDoubleClick;
            themeManager.ThemeChanged += ThemeManager_ThemeChanged;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_THREADS_CONTROL, threadsControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_THREADS_LISTVIEW, threadsControl.ListView);
        }
예제 #12
0
        ModulesContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, IModulesVM modulesVM, IFileTabManager fileTabManager, Lazy <ModuleLoader> moduleLoader, Lazy <IInMemoryModuleManager> inMemoryModuleManager)
        {
            this.modulesControl             = new ModulesControl();
            this.vmModules                  = modulesVM;
            this.fileTabManager             = fileTabManager;
            this.moduleLoader               = moduleLoader;
            this.inMemoryModuleManager      = inMemoryModuleManager;
            this.modulesControl.DataContext = this.vmModules;
            this.modulesControl.ModulesListViewDoubleClick += ModulesControl_ModulesListViewDoubleClick;
            themeManager.ThemeChanged += ThemeManager_ThemeChanged;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MODULES_CONTROL, modulesControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MODULES_LISTVIEW, modulesControl.ListView);
        }
예제 #13
0
 public DocumentViewer(IWpfCommandManager wpfCommandManager, IDocumentViewerServiceImpl documentViewerServiceImpl, IMenuManager menuManager, DocumentViewerControl documentViewerControl)
 {
     if (wpfCommandManager == null)
     {
         throw new ArgumentNullException(nameof(wpfCommandManager));
     }
     if (documentViewerServiceImpl == null)
     {
         throw new ArgumentNullException(nameof(documentViewerServiceImpl));
     }
     if (menuManager == null)
     {
         throw new ArgumentNullException(nameof(menuManager));
     }
     if (documentViewerControl == null)
     {
         throw new ArgumentNullException(nameof(documentViewerControl));
     }
     this.wpfCommandManager         = wpfCommandManager;
     this.documentViewerServiceImpl = documentViewerServiceImpl;
     this.documentViewerControl     = documentViewerControl;
     menuManager.InitializeContextMenu(documentViewerControl.TextView.VisualElement, MenuConstants.GUIDOBJ_DOCUMENTVIEWERCONTROL_GUID, new GuidObjectsProvider(this), new ContextMenuInitializer(documentViewerControl.TextView));
     // Prevent the tab control's context menu from popping up when right-clicking in the textview host margin
     menuManager.InitializeContextMenu(documentViewerControl, Guid.NewGuid());
     wpfCommandManager.Add(ControlConstants.GUID_DOCUMENTVIEWER_UICONTEXT, documentViewerControl);
     documentViewerControl.TextView.Properties.AddProperty(typeof(DocumentViewer), this);
     documentViewerControl.TextView.TextBuffer.Properties.AddProperty(DocumentViewerExtensions.DocumentViewerTextBufferKey, this);
 }
예제 #14
0
        SearchManager(IImageManager imageManager, ILanguageManager languageManager, IThemeManager themeManager, ISearchSettings searchSettings, IFileSearcherCreator fileSearcherCreator, IMenuManager menuManager, IWpfCommandManager wpfCommandManager, IFileTabManager fileTabManager)
        {
            this.fileTabManager = fileTabManager;
            this.searchControl  = new SearchControl();
            this.vmSearch       = new SearchControlVM(imageManager, fileSearcherCreator, fileTabManager.FileTreeView, searchSettings)
            {
                Language       = languageManager.Language,
                BackgroundType = BackgroundType.Search,
            };
            this.searchControl.DataContext = this.vmSearch;

            menuManager.InitializeContextMenu(this.searchControl.ListBox, MenuConstants.GUIDOBJ_SEARCH_GUID, new GuidObjectsCreator());
            wpfCommandManager.Add(CommandConstants.GUID_SEARCH_CONTROL, this.searchControl);
            wpfCommandManager.Add(CommandConstants.GUID_SEARCH_LISTBOX, this.searchControl.ListBox);
            languageManager.LanguageChanged += LanguageManager_LanguageChanged;
            themeManager.ThemeChanged       += ThemeManager_ThemeChanged;
            searchSettings.PropertyChanged  += SearchSettings_PropertyChanged;
            fileTabManager.FileTreeView.FileManager.CollectionChanged += FileManager_CollectionChanged;

            this.searchControl.SearchListBoxDoubleClick += (s, e) => FollowSelectedReference();
            var cmds    = wpfCommandManager.GetCommands(CommandConstants.GUID_SEARCH_LISTBOX);
            var command = new RelayCommand(a => FollowSelectedReference());

            cmds.Add(command, ModifierKeys.None, Key.Enter);
            cmds.Add(command, ModifierKeys.Control, Key.Enter);
            cmds.Add(command, ModifierKeys.Shift, Key.Enter);

            Add(SearchType.TypeDef, Key.T);
            Add(SearchType.FieldDef, Key.F);
            Add(SearchType.MethodDef, Key.M);
            Add(SearchType.PropertyDef, Key.P);
            Add(SearchType.EventDef, Key.E);
            Add(SearchType.ParamDef, Key.J);
            Add(SearchType.Local, Key.I);
            Add(SearchType.ParamLocal, Key.N);
            Add(SearchType.Resource, Key.R);
            Add(SearchType.Member, Key.U);
            Add(SearchType.Any, Key.B);
            Add(SearchType.Literal, Key.L);

            Add(SearchLocation.AllFiles, Key.G);
            Add(SearchLocation.SelectedFiles, Key.S);
            Add(SearchLocation.AllFilesInSameDir, Key.D);
            Add(SearchLocation.SelectedType, Key.Q);
        }
예제 #15
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();
        }
예제 #16
0
파일: ReplEditorUI.cs 프로젝트: n017/dnSpy
        public ReplEditorUI(ReplEditorOptions options, IThemeManager themeManager, IWpfCommandManager wpfCommandManager, IMenuManager menuManager, ITextEditorSettings textEditorSettings)
        {
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.options = (options ?? new ReplEditorOptions()).Clone();
            this.textEditor = new NewTextEditor(themeManager, textEditorSettings);
            this.textEditor.TextArea.Document = new TextDocument();
            this.textEditor.TextArea.Document.UndoStack.SizeLimit = 100;
            this.textEditor.TextArea.LeftMargins.Insert(0, new FrameworkElement { Margin = new Thickness(LEFT_MARGIN, 0, 0, 0) });
            this.textEditor.TextArea.TextEntering += TextArea_TextEntering;
            this.textEditor.TextArea.PreviewKeyDown += TextArea_PreviewKeyDown;
            AddBinding(ApplicationCommands.Paste, (s, e) => Paste(), (s, e) => e.CanExecute = CanPaste && IsAtEditingPosition);
            AddBinding(ApplicationCommands.Cut, (s, e) => CutSelection(), (s, e) => e.CanExecute = CanCutSelection && IsAtEditingPosition);

            if (this.options.TextEditorCommandGuid != null)
                wpfCommandManager.Add(this.options.TextEditorCommandGuid.Value, textEditor);
            if (this.options.TextAreaCommandGuid != null)
                wpfCommandManager.Add(this.options.TextAreaCommandGuid.Value, textEditor.TextArea);
            if (this.options.MenuGuid != null)
                menuManager.InitializeContextMenu(this.textEditor, this.options.MenuGuid.Value, new GuidObjectsCreator(this), new ContextMenuInitializer(textEditor, textEditor));
        }
예제 #17
0
		public MemoryContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, IMenuManager menuManager, IHexEditorSettings hexEditorSettings, IMemoryVM memoryVM, IAppSettings appSettings) {
			this.memoryControl = new MemoryControl();
			this.vmMemory = memoryVM;
			this.vmMemory.SetRefreshLines(() => this.memoryControl.DnHexBox.RedrawModifiedLines());
			this.memoryControl.DataContext = this.vmMemory;
			var dnHexBox = new DnHexBox(menuManager, hexEditorSettings) {
				CacheLineBytes = true,
				IsMemory = true,
			};
			dnHexBox.SetBinding(HexBox.DocumentProperty, "HexDocument");
			this.memoryControl.DnHexBox = dnHexBox;
			dnHexBox.StartOffset = 0;
			dnHexBox.EndOffset = IntPtr.Size == 4 ? uint.MaxValue : ulong.MaxValue;

			appSettings.PropertyChanged += AppSettings_PropertyChanged;
			UpdateHexBoxRenderer(appSettings.UseNewRenderer_HexEditor);

			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_CONTROL, memoryControl);
			wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_HEXBOX, memoryControl.DnHexBox);
		}
예제 #18
0
        public MemoryContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, IMenuManager menuManager, IHexEditorSettings hexEditorSettings, IMemoryVM memoryVM, IAppSettings appSettings)
        {
            this.memoryControl = new MemoryControl();
            this.vmMemory      = memoryVM;
            this.vmMemory.SetRefreshLines(() => this.memoryControl.DnHexBox.RedrawModifiedLines());
            this.memoryControl.DataContext = this.vmMemory;
            var dnHexBox = new DnHexBox(menuManager, hexEditorSettings)
            {
                CacheLineBytes = true,
                IsMemory       = true,
            };

            dnHexBox.SetBinding(HexBox.DocumentProperty, nameof(vmMemory.HexDocument));
            this.memoryControl.DnHexBox = dnHexBox;
            dnHexBox.StartOffset        = 0;
            dnHexBox.EndOffset          = IntPtr.Size == 4 ? uint.MaxValue : ulong.MaxValue;

            appSettings.PropertyChanged += AppSettings_PropertyChanged;
            UpdateHexBoxRenderer(appSettings.UseNewRenderer_HexEditor);

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_CONTROL, memoryControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_MEMORY_HEXBOX, memoryControl.DnHexBox);
        }
예제 #19
0
        public Window InitializeMainWindow()
        {
            var sc = new StackedContent <IStackedContentChild>(false);

            sc.AddChild(appToolBar, StackedContentChildInfo.CreateVertical(new GridLength(0, GridUnitType.Auto)));
            sc.AddChild(stackedContent, StackedContentChildInfo.CreateVertical(new GridLength(1, GridUnitType.Star)));
            sc.AddChild(statusBar, StackedContentChildInfo.CreateVertical(new GridLength(0, GridUnitType.Auto)));
            mainWindow = new MainWindow(themeManager, imageManager, sc.UIObject);
            AddTitleInfo(IntPtr.Size == 4 ? "x86" : "x64");
            wpfCommandManager.Add(ControlConstants.GUID_MAINWINDOW, mainWindow);
            new SavedWindowStateRestorer(mainWindow, uiSettings.SavedWindowState, DefaultWindowLocation);
            mainWindow.Closing          += MainWindow_Closing;
            mainWindow.Closed           += MainWindow_Closed;
            mainWindow.GotKeyboardFocus += MainWindow_GotKeyboardFocus;
            RefreshToolBar();
            return(mainWindow);
        }
예제 #20
0
        OutputContent(IWpfCommandManager wpfCommandManager, IThemeManager themeManager, Lazy <IOutputManagerInternal> outputVM)
        {
            this.outputControl         = new OutputControl();
            this.vmOutput              = outputVM;
            themeManager.ThemeChanged += ThemeManager_ThemeChanged;

            wpfCommandManager.Add(CommandConstants.GUID_OUTPUT_CONTROL, outputControl);
            var cmds = wpfCommandManager.GetCommands(CommandConstants.GUID_OUTPUT_CONTROL);

            cmds.Add(ApplicationCommands.Save,
                     (s, e) => OutputManager.SaveText(),
                     (s, e) => e.CanExecute = OutputManager.CanSaveText);
            cmds.Add(OutputCommands.CopyCommand,
                     (s, e) => OutputManager.Copy(),
                     (s, e) => e.CanExecute = OutputManager.CanCopy);
            cmds.Add(OutputCommands.CopyCommand, ModifierKeys.Control, Key.C);
            cmds.Add(OutputCommands.ClearAllCommand,
                     (s, e) => OutputManager.ClearAll(),
                     (s, e) => e.CanExecute = OutputManager.CanClearAll);
            cmds.Add(OutputCommands.ClearAllCommand, ModifierKeys.Control, Key.L);
            cmds.Add(OutputCommands.ToggleWordWrapCommand,
                     (s, e) => OutputManager.WordWrap = !OutputManager.WordWrap,
                     (s, e) => e.CanExecute           = true);
            cmds.Add(OutputCommands.ToggleShowLineNumbersCommand,
                     (s, e) => OutputManager.ShowLineNumbers = !OutputManager.ShowLineNumbers,
                     (s, e) => e.CanExecute = true);
            cmds.Add(OutputCommands.ToggleShowTimestampsCommand,
                     (s, e) => OutputManager.ShowTimestamps = !OutputManager.ShowTimestamps,
                     (s, e) => e.CanExecute = true);
            for (int i = 0; i < OutputCommands.SelectLogWindowCommands.Length; i++)
            {
                int tmpIndex = i;
                cmds.Add(OutputCommands.SelectLogWindowCommands[i],
                         (s, e) => SelectLog(tmpIndex),
                         (s, e) => e.CanExecute = OutputManager.CanSelectLog(tmpIndex));
            }

            outputControl.PreviewKeyDown += OutputControl_PreviewKeyDown;
        }
예제 #21
0
        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);
        }
예제 #22
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();
        }
예제 #23
0
		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);
		}
예제 #24
0
        BreakpointsContent(IWpfCommandManager wpfCommandManager, Lazy<IBreakpointsVM> breakpointsVM, Lazy<IModuleLoader> moduleLoader, IFileTabManager fileTabManager)
        {
            this.breakpointsControl = new BreakpointsControl();
            this.moduleLoader = moduleLoader;
            this.fileTabManager = fileTabManager;
            this.vmBreakpoints = breakpointsVM;

            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_BREAKPOINTS_CONTROL, breakpointsControl);
            wpfCommandManager.Add(CommandConstants.GUID_DEBUGGER_BREAKPOINTS_LISTVIEW, breakpointsControl.ListView);
        }
예제 #25
0
		SearchManager(IImageManager imageManager, ILanguageManager languageManager, IThemeManager themeManager, ISearchSettings searchSettings, IFileSearcherCreator fileSearcherCreator, IMenuManager menuManager, IWpfCommandManager wpfCommandManager, IFileTabManager fileTabManager) {
			this.fileTabManager = fileTabManager;
			this.searchControl = new SearchControl();
			this.vmSearch = new SearchControlVM(imageManager, fileSearcherCreator, fileTabManager.FileTreeView, searchSettings) {
				Language = languageManager.Language,
				BackgroundType = BackgroundType.Search,
			};
			this.searchControl.DataContext = this.vmSearch;

			menuManager.InitializeContextMenu(this.searchControl.ListBox, MenuConstants.GUIDOBJ_SEARCH_GUID, new GuidObjectsCreator());
			wpfCommandManager.Add(CommandConstants.GUID_SEARCH_CONTROL, this.searchControl);
			wpfCommandManager.Add(CommandConstants.GUID_SEARCH_LISTBOX, this.searchControl.ListBox);
			languageManager.LanguageChanged += LanguageManager_LanguageChanged;
			themeManager.ThemeChanged += ThemeManager_ThemeChanged;
			searchSettings.PropertyChanged += SearchSettings_PropertyChanged;
			fileTabManager.FileTreeView.FileManager.CollectionChanged += FileManager_CollectionChanged;

			this.searchControl.SearchListBoxDoubleClick += (s, e) => FollowSelectedReference();
			var cmds = wpfCommandManager.GetCommands(CommandConstants.GUID_SEARCH_LISTBOX);
			var command = new RelayCommand(a => FollowSelectedReference());
			cmds.Add(command, ModifierKeys.None, Key.Enter);
			cmds.Add(command, ModifierKeys.Control, Key.Enter);
			cmds.Add(command, ModifierKeys.Shift, Key.Enter);

			Add(SearchType.TypeDef, Key.T);
			Add(SearchType.FieldDef, Key.F);
			Add(SearchType.MethodDef, Key.M);
			Add(SearchType.PropertyDef, Key.P);
			Add(SearchType.EventDef, Key.E);
			Add(SearchType.ParamDef, Key.J);
			Add(SearchType.Local, Key.I);
			Add(SearchType.ParamLocal, Key.N);
			Add(SearchType.Resource, Key.R);
			Add(SearchType.Member, Key.U);
			Add(SearchType.Any, Key.B);
			Add(SearchType.Literal, Key.L);

			Add(SearchLocation.AllFiles, Key.G);
			Add(SearchLocation.SelectedFiles, Key.S);
			Add(SearchLocation.AllFilesInSameDir, Key.D);
			Add(SearchLocation.SelectedType, Key.Q);
		}