示例#1
1
		public MemberPickerDlg(IFileTreeView globalFileTreeView, IFileTreeView newFileTreeView, IImageManager imageManager) {
			InitializeComponent();
			DataContextChanged += (s, e) => {
				var data = DataContext as MemberPickerVM;
				if (data != null) {
					data.OpenAssembly = new OpenAssembly(globalFileTreeView.FileManager);
					data.PropertyChanged += MemberPickerVM_PropertyChanged;
				}
			};
			openImage.Source = imageManager.GetImage(GetType().Assembly, "Open", BackgroundType.DialogWindow);

			var treeView = (Control)newFileTreeView.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("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));
		}
示例#2
0
 public MetroWindow()
 {
     SetValue(winChrome_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));
 }
示例#3
0
		void Add(SearchLocation loc, Key key) {
			var command = new RelayCommand(a => {
				this.vmSearch.SearchLocationVM.SelectedItem = loc;
				if (!this.searchControl.SearchTextBox.IsKeyboardFocusWithin)
					this.searchControl.SearchTextBox.SelectAll();
				this.searchControl.SearchTextBox.Focus();
			});
			this.searchControl.InputBindings.Add(new KeyBinding(command, new KeyGesture(key, ModifierKeys.Control)));
		}
示例#4
0
		void Add(SearchType searchType, Key key) {
			var command = new RelayCommand(a => {
				this.vmSearch.SelectedSearchTypeVM = this.vmSearch.SearchTypeVMs.First(b => b.SearchType == searchType);
				if (!this.searchControl.SearchTextBox.IsKeyboardFocusWithin)
					this.searchControl.SearchTextBox.SelectAll();
				this.searchControl.SearchTextBox.Focus();
			});
			this.searchControl.InputBindings.Add(new KeyBinding(command, new KeyGesture(key, ModifierKeys.Control)));
		}
示例#5
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);
		}
示例#6
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);
		}