/// <summary> /// Constructor /// </summary> public MetroWindow() { SetValue(WindowChrome.WindowChromeProperty, CreateWindowChromeObject()); // Since the system menu had to be disabled, we must add this command var cmd = new RelayCommand(a => ShowSystemMenu(this), a => !IsFullScreen); InputBindings.Add(new KeyBinding(cmd, Key.Space, ModifierKeys.Alt)); MetroWindowCreated?.Invoke(this, new MetroWindowCreatedEventArgs(this)); }
public MemberPickerDlg(IDocumentTreeView globalDocumentTreeView, IDocumentTreeView newDocumentTreeView) { InitializeComponent(); DataContextChanged += (s, e) => { var data = DataContext as MemberPickerVM; if (data != null) { data.OpenAssembly = new OpenAssembly(globalDocumentTreeView.DocumentService); data.PropertyChanged += MemberPickerVM_PropertyChanged; } }; var treeView = newDocumentTreeView.TreeView.UIObject; cpTreeView.Content = treeView; Validation.SetErrorTemplate(treeView, (ControlTemplate)FindResource("noRedBorderOnValidationError")); treeView.AllowDrop = false; treeView.BorderThickness = new Thickness(1); var binding = new Binding { ValidatesOnDataErrors = true, ValidatesOnExceptions = true, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Path = new PropertyPath(nameof(MemberPickerVM.SelectedItem)), Mode = BindingMode.TwoWay, }; treeView.SetBinding(Selector.SelectedItemProperty, binding); var cmd = new RelayCommand(a => { searchTextBox.SelectAll(); searchTextBox.Focus(); }); InputBindings.Add(new KeyBinding(cmd, Key.E, ModifierKeys.Control)); InputBindings.Add(new KeyBinding(cmd, Key.F, ModifierKeys.Control)); }
public OpenFromGACDlg() { InitializeComponent(); var cmd = new RelayCommand(a => { searchBox.Focus(); searchBox.SelectAll(); }); InputBindings.Add(new KeyBinding(cmd, Key.E, ModifierKeys.Control)); InputBindings.Add(new KeyBinding(cmd, Key.F, ModifierKeys.Control)); }
public OpenDocumentListDlg() { InitializeComponent(); listView.SelectionChanged += ListView_SelectionChanged; listView.KeyDown += ListView_KeyDown; var cmd = new RelayCommand(a => { searchBox.Focus(); searchBox.SelectAll(); }); InputBindings.Add(new KeyBinding(cmd, Key.E, ModifierKeys.Control)); InputBindings.Add(new KeyBinding(cmd, Key.F, ModifierKeys.Control)); }
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); }
void Add(SearchLocation loc, Key key) { var command = new RelayCommand(a => { vmSearch.SearchLocationVM.SelectedItem = loc; if (!searchControl.SearchTextBox.IsKeyboardFocusWithin) searchControl.SearchTextBox.SelectAll(); searchControl.SearchTextBox.Focus(); }); searchControl.InputBindings.Add(new KeyBinding(command, new KeyGesture(key, ModifierKeys.Control))); }
void Add(SearchType searchType, Key key) { var command = new RelayCommand(a => { vmSearch.SelectedSearchTypeVM = vmSearch.SearchTypeVMs.First(b => b.SearchType == searchType); if (!searchControl.SearchTextBox.IsKeyboardFocusWithin) searchControl.SearchTextBox.SelectAll(); searchControl.SearchTextBox.Focus(); }); searchControl.InputBindings.Add(new KeyBinding(command, new KeyGesture(key, ModifierKeys.Control))); }
SearchService(IDecompilerService decompilerService, ISearchSettings searchSettings, IDocumentSearcherProvider fileSearcherProvider, IMenuService menuService, IWpfCommandService wpfCommandService, IDocumentTabService documentTabService, IClassificationFormatMapService classificationFormatMapService) { var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc); this.documentTabService = documentTabService; searchControl = new SearchControl(); vmSearch = new SearchControlVM(fileSearcherProvider, documentTabService.DocumentTreeView, searchSettings) { Decompiler = decompilerService.Decompiler, }; searchControl.DataContext = vmSearch; menuService.InitializeContextMenu(searchControl.ListBox, MenuConstants.GUIDOBJ_SEARCH_GUID, new GuidObjectsProvider()); wpfCommandService.Add(ControlConstants.GUID_SEARCH_CONTROL, searchControl); wpfCommandService.Add(ControlConstants.GUID_SEARCH_LISTBOX, searchControl.ListBox); decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged; classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged; searchSettings.PropertyChanged += SearchSettings_PropertyChanged; documentTabService.DocumentTreeView.DocumentService.CollectionChanged += DocumentService_CollectionChanged; searchControl.SearchListBoxDoubleClick += (s, e) => FollowSelectedReference(); var cmds = wpfCommandService.GetCommands(ControlConstants.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); }