public ProcessInfo Duplicate() { ProcessInfo duplicate = new ProcessInfo(); Frames.ForEach(item => duplicate.Frames.Add(item.Duplicate())); return duplicate; }
public ProcessSnapshotControl(ProcessInfo processInfo) { InitializeComponent(); if (processInfo == null || processInfo.Frames.Count == 0) return; this.DataContext = this; this.processInfo = processInfo; this.Loaded += OnLoaded; timebar.BeforeTicksRender += new CustomRenderRoutedEventHandler(timebar_Layer0CustomRender); CreateTreeView(); }
private void RaiseLastFrameRenderEvent(ProcessInfo processData, FrameInfo frameData) { RaiseEvent(new FrameRenderRoutedEventArgs { ProcessData = processData, FrameData = frameData }); }
private void RaiseRenderEvent(ProcessInfo processData) { RaiseEvent(new RenderRoutedEventArgs { ProcessData = processData }); }
/// <summary> /// Clears any previous render and perform a new one from scratch. /// </summary> /// <param name="processInfo">Instance that stores the whole micro threading process data.</param> public void RenderAllFrames(ProcessInfo processInfo) { if (processInfo == null) throw new ArgumentNullException("processInfo"); if (processInfo.Frames.Count == 0) return; Children.Clear(); double offset = processInfo.Frames[0].BeginTime; foreach (FrameInfo frame in processInfo.Frames) { UIElement frameControl = CreateFrameElement(frame); if (frameControl != null) { frameControl.SetValue(Canvas.LeftProperty, (frame.BeginTime - offset) * PixelsPerSecond); Children.Add(frameControl); } } RaiseRenderEvent(processInfo); }
/// <summary> /// This method moves the previously rendered frame and only renders the newly added one. /// It automatically removes the first frame when the maximum frame count is reached. /// </summary> /// <param name="processInfo">Instance that stores the whole micro threading process data.</param> /// <param name="alignRight">Indicates whether render is right aligned or left aligned. /// <remarks>Right align produces more realistic time-related render.</remarks> /// </param> public void RenderLastFrame(ProcessInfo processInfo, bool alignRight = true) { if (processInfo == null) throw new ArgumentNullException("processInfo"); if (processInfo.Frames.Count == 0) return; if (Children.Count >= MicroThreadMonitoringManager.MaximumCapturedFrames) Children.RemoveAt(0); FrameInfo lastFrame = processInfo.Frames.Last(); SetValue(LastFrameTimePropertyKey, lastFrame.EndTime); double offset = processInfo.Frames[0].BeginTime; if (alignRight) offset = lastFrame.EndTime - (ActualWidth / PixelsPerSecond); for (int i = 0; i < Children.Count; i++) Children[i].SetValue(Canvas.LeftProperty, (processInfo.Frames[i].BeginTime - offset) * PixelsPerSecond); UIElement frameControl = CreateFrameElement(lastFrame); if (frameControl != null) { frameControl.SetValue(Canvas.LeftProperty, (lastFrame.BeginTime - offset) * PixelsPerSecond); Children.Add(frameControl); } RaiseLastFrameRenderEvent(processInfo, lastFrame); }