private void OnGoToBookmarkCommand(object sender, ExecutedRoutedEventArgs e) { int key = Convert.ToInt32(e.Parameter); CodeFile.Bookmark bookmark = CurrentCodeFile.Bookmarks.Find(b => b.Key == key); if (bookmark != null) { // Если команда выполнилась, то фокус уже в редакторе, все нормально SetCaretTo(CurrentCodeFile, bookmark.Offset); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { CodeFile.Bookmark b = value as CodeFile.Bookmark; if (b != null && b.Key < 10) { return("Alt+" + b.Key); } else { return(""); } }
private void Item_Selected(object sender, RoutedEventArgs e) { ListViewItem item = sender as ListViewItem; if (item.DataContext != null) { CodeFile.Bookmark b = item.DataContext as CodeFile.Bookmark; _codeEditor.SetCaretTo(_codeEditor.CurrentCodeFile, b.Offset); } ParentButton.IsOpen = false; e.Handled = true; }
private void Item_MouseClick(object sender, MouseButtonEventArgs e) { FrameworkElement item = sender as FrameworkElement; if (item.DataContext != null) { CodeFile.Bookmark b = item.DataContext as CodeFile.Bookmark; _codeEditor.SetCaretTo(_codeEditor.CurrentCodeFile, b.Offset); } ParentButton.IsOpen = false; e.Handled = true; }
private void Item_Delete(object sender, RoutedEventArgs e) { Button item = sender as Button; if (item.DataContext != null) { CodeFile.Bookmark b = item.DataContext as CodeFile.Bookmark; _codeEditor.CurrentCodeFile.DeleteBookmark(b.Line); _codeEditor.UpdateBookmarks(); } ParentButton.IsOpen = false; e.Handled = true; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { CodeFile.Bookmark b = value as CodeFile.Bookmark; if (b != null) { DocumentLine line = _codeEditor.CurrentCodeFile.Document.GetLineByNumber(b.Line); string str = _codeEditor.CurrentCodeFile.Text.Substring(line.Offset, line.Length); return(str); } else { return(""); } }