public static int GetLineNumber(IBookmark b, DecompilerTextView textView) { var bm = b as BookmarkBase; if (bm != null) return bm.GetLineNumber(textView); return b.LineNumber; }
public IPresentation Presentate(IBookmark bookmark) { return new BookmarkPresentation { //OnlineImageUrl = _onlineImageProvider.GetOnlineImageUrl(bookmark.User.UserName), DisplayName = bookmark.User.GetDisplayName(), ProfileUrl = bookmark.User.GetProfileUrl(), BookmarkedUser = (IUser)bookmark.User }; }
public void Execute(IBookmark[] marks) { foreach (var mark in marks) { if (!(mark is MemberBookmark)) continue; var member = (mark as MemberBookmark).Member; AnalyzeContextMenuEntry.Analyze(member); } }
public IBookmark Fill(IBookmark bookmark) { if (bookmark == null) { return(null); } try { bookmark.Id = new Guid(Id); } catch (Exception ex) { log.Error("Node Guid stored in db is not valid, creating new one", ex); bookmark.Id = new Guid(); } try { bookmark.RelatedItemId = new Guid(RelatedItemId); } catch (Exception ex) { log.Error("RelatedItemId Guid stored in db is not valid, creating new one", ex); bookmark.RelatedItemId = new Guid(); } bookmark.Name = Name; bookmark.Type = (BookmarkTypes)Type; bookmark.Version = Version; bookmark.ModifiedOn = ModifiedOn; bookmark.ModifiedBy = ModifiedBy; bookmark.Deleted = Deleted; bookmark.CreatedBy = CreatedBy; bookmark.CreatedOn = CreatedOn; if (!string.IsNullOrEmpty(Address)) { bookmark.Address = Address; } return(bookmark); }
protected override void OnMouseDown(MouseButtonEventArgs e) { base.OnMouseDown(e); int line = GetLineFromMousePosition(e); if (!e.Handled && line > 0) { IBookmark bm = GetBookmarkFromLine(line); if (bm != null) { bm.MouseDown(e); } } // don't allow selecting text through the IconBarMargin if (e.ChangedButton == MouseButton.Left) { e.Handled = true; } }
public static void Extract(string sourceFile, string destFile, IEnumerable <IBookmark> allBookMarks) { List <IBookmark> selectedBookmarks = allBookMarks.ToList().FindAll(x => x.IsSelected); HashSet <int> pages = new HashSet <int>(); foreach (IBookmark mark in selectedBookmarks) { for (int i = mark.StartPage; i <= mark.EndPage; i++) { pages.Add(i); } } string range = GetRangeString(pages.ToList()); List <IBookmark> AddMarks = new List <IBookmark>(); for (int i = 0; i < selectedBookmarks.Count; i++) { int startpage; IBookmark current = selectedBookmarks[i]; startpage = 1 + pages.ToList().FindAll(x => x < current.StartPage).Count; Bookmarks.Bookmark addition = new Bookmarks.Bookmark(current.Title, startpage, current.Id); addition.ParentId = FindClosestParent(allBookMarks.ToList(), selectedBookmarks, current.ParentId); AddMarks.Add(addition); } var doc = new PdfDocument(new PdfReader(sourceFile)); var split = new ExtSplitter(doc, pageRange => new PdfWriter(destFile)); var result = split.ExtractPageRange(new PageRange(range)); result.GetOutlines(true).RemoveOutline(); result.InitializeOutlines(); AddRecursively(AddMarks, result, result.GetOutlines(true)); doc.Close(); result.Close(); }
/// <summary> /// 结束节点 /// </summary> /// <param name="dto"></param> public void EndRouing(TransInfoDto dto) { IBookmark bookmarkInfo = BookmarkFactory.GetBookmark(dto.ActivityType); // 结束并发 if (dto.SubmitType == SubmitTypeEnum._SP) { XElement parallelStart = null; // 获取对应的并发等待节点 var doc = XElement.Parse(dto.TemplateXml); XmlHelper.GetFirstParalle(doc, dto.InstanceNodeId, ref parallelStart); if (parallelStart == null) { throw new Exception("没有找到并发起始节点"); } if (XmlHelper.HasValue(parallelStart, "GroupName")) { HashSet <Guid> parallelNodes = new HashSet <Guid>(); Dictionary <string, int> parallelCount = new Dictionary <string, int>(); var copyInfo = dto.GetCopyInfo(); copyInfo.InstanceNodeId = Guid.Parse(XmlHelper.GetSafeValue(parallelStart, ActivityConst.ID)); parallelCount.Add(copyInfo.TaskId + XmlHelper.GetSafeValue(parallelStart, "GroupName"), 1); XmlHelper.TraversingGraphParallel(doc, parallelStart.ParseById(), null); StopAll(parallelStart.Element("GroupName").Value, copyInfo, parallelNodes, ref parallelCount); dto.Persistence.FinishActivityByNodeIds(copyInfo.InstanceId, parallelNodes.ToList(), RunStateConst.STOP); } return; } bookmarkInfo.Ending += (s, r) => { var args = r as WFArgs; if (args.Parameter.NextActivities != null) { RoutingFactory(args.Parameter.NextActivities, dto); } }; bookmarkInfo.End(dto); }
IBookmark ToggleBookmarkInternal(IBookmark bmk) { if (bmk.Thread == null) { throw new ArgumentException("can not trigger bookmark not linked to a thread"); } int idx = items.BinarySearch(bmk, cmp); if (idx >= 0) { items.RemoveAt(idx); FireOnBookmarksChanged(new BookmarksChangedEventArgs(BookmarksChangedEventArgs.ChangeType.Removed, new IBookmark[] { bmk })); return(null); } items.Insert(~idx, bmk); FireOnBookmarksChanged(new BookmarksChangedEventArgs(BookmarksChangedEventArgs.ChangeType.Added, new IBookmark[] { bmk })); return(bmk); }
private void DoBookmarkAction(bool?targetState) { IBookmark l = (searchResultPresenter != null && searchResultPresenter.LogViewerPresenter.HasInputFocus) ? searchResultPresenter.FocusedMessageBookmark : viewerPresenter.FocusedMessageBookmark; if (l == null) { return; } var bmks = bookmarks; if (targetState != null) { var pos = bmks.FindBookmark(l); if (targetState.Value == (pos.Item1 != pos.Item2)) { return; } } bmks.ToggleBookmark(l); }
protected override void OnMouseUp(MouseButtonEventArgs e) { base.OnMouseUp(e); int line = GetLineFromMousePosition(e); if (!e.Handled && dragDropBookmark != null) { if (dragStarted) { if (line != 0) { dragDropBookmark.Drop(line); } e.Handled = true; } CancelDragDrop(); } if (!e.Handled && line != 0) { IBookmark bm = GetBookmarkFromLine(line); if (bm != null) { bm.MouseUp(e); if (e.Handled) { return; } } if (e.ChangedButton == MouseButton.Left && TextView != null) { // no bookmark on the line: create a new breakpoint ITextEditor textEditor = TextView.GetService(typeof(ITextEditor)) as ITextEditor; if (textEditor != null) { SD.Debugger.ToggleBreakpointAt(textEditor, line); return; } } } }
/// <summary> /// Function Bookmark to the database /// </summary> /// <returns>true when success</returns> public bool SaveBookmark(IBookmark bookmark) { try { using (var transaction = context.Database.BeginTransaction()) { var bkm = context.Bookmarks .Where(b => !b.Deleted) .Where(b => b.Id == bookmark.Id.ToString()) .FirstOrDefault(); if (bkm != null) { bkm.Update(bookmark); bkm.ModifiedOn = DateTime.UtcNow; } else { var bk = new Models.BookmarkEntity(); bk.Update(bookmark); bk.CreatedOn = DateTime.UtcNow; bk.CreatedBy = "admin"; bk.ModifiedBy = "admin"; context.Bookmarks.Add(bk); } context.SaveChanges(); transaction.Commit(); } return(true); } catch (Exception ex) { log.Error("Cannot save Bookmark to Db", ex); return(false); } }
private static void AddRecursively(List <IBookmark> addedMarks, PdfDocument doc, PdfOutline outlineParent, IBookmark bookmarkParent = null) { if (bookmarkParent != null) { foreach (IBookmark current in addedMarks.FindAll(x => x.ParentId == bookmarkParent.Id)) { var subParent = outlineParent.AddOutline(current.Title); subParent.AddDestination(PdfExplicitDestination.CreateFit(doc.GetPage(current.StartPage))); AddRecursively(addedMarks, doc, subParent, current); } } else { foreach (IBookmark current in addedMarks.FindAll(x => x.ParentId == Guid.Empty)) { var subParent = outlineParent.AddOutline(current.Title); subParent.AddDestination(PdfExplicitDestination.CreateFit(doc.GetPage(current.StartPage))); AddRecursively(addedMarks, doc, subParent, current); } } }
public void SetSubItemBookmark(int subItemIdx, IBookmark bmk) { var i = lvi.SubItems[subItemIdx]; i.Tag = bmk; string newTxt; bool newIsLink; if (bmk != null) { newTxt = bmk.Time.ToUserFrendlyString(false); newIsLink = true; } else { newTxt = "-"; newIsLink = false; } if (i.Text != newTxt) { i.Text = newTxt; } bool isLink = (i.Font.Style & FontStyle.Underline) != 0; if (isLink != newIsLink) { if (newIsLink) { i.Font = new Font(lvi.ListView.Font, FontStyle.Underline); i.ForeColor = Color.Blue; } else { i.Font = lvi.ListView.Font; i.ForeColor = lvi.ListView.ForeColor; } } }
string GetBackgroundColorAsHtml(IBookmark b) { var coloring = loadedMessagesPresenter.LogViewerPresenter.Coloring; var cl = "white"; if (coloring == Settings.Appearance.ColoringMode.Threads) { var t = b.GetSafeThread(); if (t != null) { cl = colorTheme.ThreadColors.GetByIndex(t.ThreadColorIndex).ToHtmlColor(); } } else if (coloring == Settings.Appearance.ColoringMode.Sources) { var ls = b.GetSafeLogSource(); if (ls != null) { cl = colorTheme.ThreadColors.GetByIndex(ls.ColorIndex).ToHtmlColor(); } } return(cl); }
void ExecuteSaveFileCommand() { SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Title = "Valitse tallennettavan tiedoston polku"; saveDialog.Filter = "PDF (.pdf)|*.pdf"; saveDialog.InitialDirectory = Path.GetDirectoryName(FilePath); if (saveDialog.ShowDialog() != true) { return; } Extraction.Extract(FilePath, saveDialog.FileName, FileBookmarks); SelectedBookmark = null; var p = new Process(); p.StartInfo = new ProcessStartInfo(@saveDialog.FileName) { UseShellExecute = true }; p.Start(); }
protected override void OnMouseUp(MouseButtonEventArgs e) { base.OnMouseUp(e); int line = GetLineFromMousePosition(e); if (!e.Handled && dragDropBookmark != null) { if (dragStarted) { if (line != 0) { dragDropBookmark.Drop(line); } e.Handled = true; } CancelDragDrop(); } if (!e.Handled && line != 0) { IBookmark bm = GetBookmarkFromLine(line); if (bm != null) { bm.MouseUp(e); if (e.Handled) { return; } } if (e.ChangedButton == MouseButton.Left && TextView != null) { // no bookmark on the line: create a new breakpoint manager.AddBreakpoint(line); } } }
private void DeleteSelectedBookmarks() { var selectedBmks = GetValidSelectedBookmarks().ToLookup(b => b); if (selectedBmks.Count == 0) { return; } IBookmark newSelectionCandidate2 = null; IBookmark newSelectionCandidate1 = null; bool passedSelection = false; foreach (var b in bookmarks.Items) { if (selectedBmks.Contains(b)) { passedSelection = true; } else if (!passedSelection) { newSelectionCandidate2 = b; } else if (newSelectionCandidate1 == null) { newSelectionCandidate1 = b; } } foreach (var bmk in selectedBmks.SelectMany(g => g)) { bookmarks.ToggleBookmark(bmk); } selectedBookmarks = ImmutableHashSet.CreateRange( new[] { newSelectionCandidate1 ?? newSelectionCandidate2 }.Where(c => c != null) ); changeNotification.Post(); }
public void Execute(IBookmark[] bookmarks) { throw new NotImplementedException(); }
void StartDragDrop(IBookmark bm, MouseEventArgs e) { dragDropBookmark = bm; dragDropStartPoint = dragDropCurrentPoint = e.GetPosition(this).Y; if (TextView != null) { TextArea area = TextView.Services.GetService(typeof(TextArea)) as TextArea; if (area != null) area.PreviewKeyDown += TextArea_PreviewKeyDown; } }
void OnFocusedMessageBookmarkChanged() { focusedMessageBookmark = null; FocusedMessageBookmarkChanged?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Validates the specified bookmark. /// </summary> /// <param name="bookmark">The bookmark.</param> /// <returns><c>True</c> if the given bookmark is valid; otherwise <c>false</c>.</returns> public virtual Boolean Validate( IBookmark bookmark ) { Ensure.That( bookmark ).Named( "bookmark" ).IsNotNull(); return bookmark.Owner == this && ( bookmark.Position == null || this.backwardChangesStack.Contains( bookmark.Position ) ); }
public string Serialize(IBookmark bookmark) => JsonConvert.SerializeObject(bookmark, _serializerSettings);
public bool IsEnabled(IBookmark bookmark) { return(IsVisible(bookmark)); }
public void Initialize(IBookmark bookmark, MenuItem menuItem) { var bpm = bookmark as BreakpointBookmark; if (bpm != null) InitializeMenuItem(new[] { bpm }, menuItem, BackgroundType.ContextMenuItem); }
/// <summary> /// Reverts the status of this IChangeTrackingService /// to the specified bookmark. /// </summary> /// <param name="bookmark">The bookmark.</param> /// <exception cref="ArgumentOutOfRangeException">The specified /// bookmark has not been created by this service.</exception> public void Revert( IBookmark bookmark ) { this.EnsureNotSuspended(); Ensure.That( bookmark ) .Named( "bookmark" ) .IsNotNull() .If( bmk => !this.Validate( bmk ) ) .Then( ( bmk, n ) => { throw new ArgumentOutOfRangeException( n ); } ); if ( this.CanRevertTo( bookmark ) ) { this.OnRevert( bookmark ); this.OnTrackingServiceStateChanged(); } }
Boolean CanRevertTo( IBookmark bookmark ) { /* * Siamo in grado di fare la revert: * - se il bookmark è valido e...; * * se la posizione del bookmark è diversa dall'ultima modifica nel backwardChangesStack * * oppure se nel bookmark ci sono delle entity registrate transient dopo la creazione del bookmark stesso */ lock ( SyncRoot ) { var last = this.backwardChangesStack.LastOrDefault(); return /*this.EnsureIsDefined( bookmark ) &&*/ ( bookmark.Position != last || this.transientEntities .Where( kvp => kvp.Value && !bookmark.TransientEntities.Contains( kvp.Key ) ) .Any() ); } }
public bool IsEnabled(IBookmark[] marks) { return true; }
public bool IsVisible(IBookmark[] marks) { return true; }
public bool IsVisible(IBookmark[] bookmarks) { return bookmarks.Any(b => b is BreakpointBookmark && (b as BreakpointBookmark).IsEnabled); }
public bool IsVisible(IBookmark bookmark) { return bookmark is BreakpointBookmark; }
int IComparer <IBookmark> .Compare(IBookmark b1, IBookmark b2) { return(Compare(b1, b2, ignoreConnectionIds)); }
public void Execute(IBookmark bookmark) { var bpm = bookmark as BreakpointBookmark; if (bpm != null) bpm.IsEnabled = !bpm.IsEnabled; }
private void ItemClickHandler(object sender, ItemClickEventArgs e) { SelectedBookmark = (IBookmark)e.ClickedItem; Hide(); }
public bool IsVisible(IBookmark bookmark) { return(bookmark is BreakpointBookmark); }
private void StartDragDrop(IBookmark bm, MouseEventArgs e) { _dragDropBookmark = bm; _dragDropStartPoint = (_dragDropCurrentPoint = e.GetPosition(this).Y); if (TextView != null) { var textArea = TextView.Services.GetService(typeof (TextArea)) as TextArea; if (textArea != null) { textArea.PreviewKeyDown += TextAreaPreviewKeyDown; } } }
public BookmarkFinderResult(string workflowInstanceId, string activityId, IBookmark bookmark) { WorkflowInstanceId = workflowInstanceId; ActivityId = activityId; Bookmark = bookmark; }
public void Add(IBookmark bookmark) { bookmarks.Add(bookmark.Id, bookmark); }
public WorkflowTrigger(IWorkflowBlueprint workflowBlueprint, string activityId, string activityType, string bookmarkHash, IBookmark bookmark) { WorkflowBlueprint = workflowBlueprint; ActivityId = activityId; ActivityType = activityType; BookmarkHash = bookmarkHash; Bookmark = bookmark; }
/// <summary> /// Called in order to reverts the status of this <see cref="IChangeTrackingService"/> /// to the specified bookmark. /// </summary> /// <param name="bookmark">The bookmark.</param> protected virtual void OnRevert( IBookmark bookmark ) { lock ( SyncRoot ) { IChange last = this.backwardChangesStack.LastOrDefault(); while ( last != bookmark.Position ) { last.Reject( RejectReason.Revert ); last.GetChangedEntities().ForEach( entity => tryUnregisterTransient( entity, bookmark ) ); last = this.backwardChangesStack.LastOrDefault(); } } this.transientEntities.Keys .AsReadOnly() .ForEach( entity => tryUnregisterTransient( entity, bookmark ) ); }
public TextLogEventTrigger(IBookmark bmk) { StreamPosition = bmk.Position; Timestamp = new MessageTimestamp(bmk.Time.Adjust(bmk.GetLogSource().TimeOffsets.Inverse()).ToUnspecifiedTime()); }
private void CancelDragDrop() { if (_dragDropBookmark != null) { _dragDropBookmark = null; _dragStarted = false; if (TextView != null) { var textArea = TextView.Services.GetService(typeof (TextArea)) as TextArea; if (textArea != null) { textArea.PreviewKeyDown -= TextAreaPreviewKeyDown; } } ReleaseMouseCapture(); InvalidateVisual(); } }
/// <summary> /// 路由工厂 /// </summary> /// <param name="dto"></param> public void RoutingFactory(TransInfoDto dto) { IBookmark bookmarkInfo = BookmarkFactory.GetBookmark(dto.ActivityType); bookmarkInfo.Start(dto); }
void MouseHover(object sender, MouseEventArgs e) { Debug.Assert(sender == this); if (!TryCloseExistingPopup(false)) { return; } int line = GetLineFromMousePosition(e); if (line < 1) { return; } IBookmark bm = GetBookmarkFromLine(line); if (bm == null) { return; } object content = bm.CreateTooltipContent(); popupToolTip = content as Popup; if (popupToolTip != null) { var popupPosition = GetPopupPosition(line); popupToolTip.Closed += ToolTipClosed; popupToolTip.HorizontalOffset = popupPosition.X; popupToolTip.VerticalOffset = popupPosition.Y; popupToolTip.StaysOpen = true; // We will close it ourselves e.Handled = true; popupToolTip.IsOpen = true; distanceToPopupLimit = double.PositiveInfinity; // reset limit; we'll re-calculate it on the next mouse movement } else { if (toolTip == null) { toolTip = new ToolTip(); toolTip.Closed += ToolTipClosed; } toolTip.PlacementTarget = this; // required for property inheritance if (content is string) { toolTip.Content = new TextBlock { Text = content as string, TextWrapping = TextWrapping.Wrap }; } else { toolTip.Content = content; } e.Handled = true; toolTip.IsOpen = true; } }
public static TimeSpan GetTimelineTime(this IBookmark bmk, ITimelineVisualizerModel model) { return(bmk.Time.ToUnspecifiedTime() - model.Origin); }
public bool?Compare(IBookmark bookmark) => bookmark is FileSystemEventBookmark other &&
public void Update(IBookmark bookmark) { bookmarks[bookmark.Id] = bookmark; }
static bool IsClassMemberBookmark(IBookmark b) { return(b is ClassMemberBookmark || b is ClassBookmark); }
static bool IsClassMemberBookmark(IBookmark b) { return b is ClassMemberBookmark || b is ClassBookmark; }
public void Execute(IBookmark bookmark) { var bpm = bookmark as BreakpointBookmark; if (bpm != null) BookmarkManager.RemoveMark(bpm); }
void CancelDragDrop() { if (dragDropBookmark != null) { dragDropBookmark = null; dragStarted = false; if (TextView != null) { TextArea area = TextView.Services.GetService(typeof(TextArea)) as TextArea; if (area != null) area.PreviewKeyDown -= TextArea_PreviewKeyDown; } ReleaseMouseCapture(); InvalidateVisual(); } }
public bool IsEnabled(IBookmark bookmark) { return IsVisible(bookmark); }