Exemplo n.º 1
0
        void HandleActivatedDiagnostic(EditCodeVM vm, CompilerDiagnosticVM diag)
        {
            if (string.IsNullOrEmpty(diag.FullPath))
            {
                return;
            }

            var doc = vm.Documents.FirstOrDefault(a => a.Name == diag.FullPath);

            Debug.Assert(doc != null);
            if (doc == null)
            {
                return;
            }
            vm.SelectedDocument = doc;

            if (diag.LineLocationSpan != null)
            {
                UIUtilities.Focus(doc.TextView.VisualElement, () => {
                    // The caret isn't always moved unless we wait a little
                    Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => {
                        if (doc == vm.SelectedDocument)
                        {
                            doc.TextView.MoveCaretTo(diag.LineLocationSpan.Value.StartLinePosition.Line, diag.LineLocationSpan.Value.StartLinePosition.Character);
                            doc.TextView.Caret.EnsureVisible();
                            doc.TextView.Selection.Clear();
                        }
                    }));
                });
            }
        }
Exemplo n.º 2
0
        void EditCodeVM_PropertyChanged(object?sender, PropertyChangedEventArgs e)
        {
            var vm = (EditCodeVM)sender !;

            if (e.PropertyName == nameof(vm.SelectedDocument))
            {
                UIUtilities.Focus(vm.SelectedDocument?.TextView.VisualElement);
            }
        }
Exemplo n.º 3
0
		void FocusReplaceStringTextBox() {
			Action action = null;
			// If it hasn't been loaded yet, it has no binding and we must select it in its Loaded event
			if (searchControl.replaceStringTextBox.Text.Length == 0 && ReplaceString.Length != 0)
				action = () => searchControl.replaceStringTextBox.SelectAll();
			else
				searchControl.replaceStringTextBox.SelectAll();
			UIUtilities.Focus(searchControl.replaceStringTextBox, action);
		}