private void DataGridRow_DoubleClick(object sender, MouseButtonEventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); if (e.ChangedButton != MouseButton.Left) { return; } DataGridRow row = (sender as DataGridRow); if (row == null) { return; } CompileValue value = (row.Item as CompileValue); if (value == null) { return; } Timeline.CompilerTimeline.Instance.DisplayTimeline(value.MaxUnit, value); }
public void DisplayTimeline(UnitValue unit, CompileValue value = null) { ThreadHelper.ThrowIfNotOnUIThread(); TimelineWindow window = FocusTimelineWindow(); window.SetTimeline(unit, value); }
private TimelineNode LoadNode(BinaryReader reader) { uint start = reader.ReadUInt32(); uint duration = reader.ReadUInt32(); uint eventId = reader.ReadUInt32(); CompilerData.CompileCategory category = (CompilerData.CompileCategory)reader.ReadByte(); CompileValue value = CompilerData.Instance.GetValue(category, (int)eventId); string label = value != null ? value.Name : Common.UIConverters.ToSentenceCase(category.ToString()); label += " ( " + Common.UIConverters.GetTimeStr(duration) + " )"; return(new TimelineNode(label, start, duration, category, value)); }
private void DataGridRow_ContextMenu(object sender, MouseEventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); var dataGrid = (DataGrid)sender; HitTestResult hitTestResult = VisualTreeHelper.HitTest(dataGrid, Mouse.GetPosition(dataGrid)); DataGridRow row = hitTestResult.VisualHit.GetParentOfType <DataGridRow>(); dataGrid.SelectedItem = row.Item; CompileValue value = (row.Item as CompileValue); if (value == null) { return; } System.Windows.Forms.ContextMenuStrip contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); bool isVisualStudio = EditorContext.IsEnvironment(EditorContext.ExecutionEnvironment.VisualStudio); contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Locate Max Timeline", (a, b) => Timeline.CompilerTimeline.Instance.DisplayTimeline(value.MaxUnit, value))); if (isVisualStudio && Category == CompilerData.CompileCategory.Include) { contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Open Location (Experimental)", (a, b) => EditorUtils.OpenFile(value.Name))); } if (value.Name.Length > 0) { contextMenuStrip.Items.Add(Common.UIHelpers.CreateContextItem("Copy Name", (a, b) => Clipboard.SetText(value.Name))); } //TODO ~ add more options contextMenuStrip.Show(System.Windows.Forms.Control.MousePosition); }
private void OnNode() { if (node != null) { headerText.Text = Common.UIConverters.ToSentenceCase(node.Category.ToString()); durationText.Text = Common.UIConverters.GetTimeStr(node.Duration); if (node.Value is CompileValue) { descriptionText.Visibility = Visibility.Visible; detailsBorder.Visibility = Visibility.Visible; detailsPanel.Visibility = Visibility.Visible; CompileValue val = (node.Value as CompileValue); descriptionText.Text = val.Name; detailsText.Text = "Max: " + Common.UIConverters.GetTimeStr(val.Max) + " Min: " + Common.UIConverters.GetTimeStr(val.Min) + " Avg: " + Common.UIConverters.GetTimeStr(val.Mean) + " Count: " + val.Count; } else if (node.Value is UnitValue) { descriptionText.Visibility = Visibility.Visible; detailsBorder.Visibility = Visibility.Collapsed; detailsPanel.Visibility = Visibility.Collapsed; descriptionText.Text = (node.Value as UnitValue).Name; } else { descriptionText.Visibility = Visibility.Collapsed; detailsBorder.Visibility = Visibility.Collapsed; detailsPanel.Visibility = Visibility.Collapsed; } } }
public void SetTimeline(UnitValue unit, CompileValue value = null) { ThreadHelper.ThrowIfNotOnUIThread(); (this.Content as TimelineWindowControl).SetTimeline(unit, value); }
private static bool FilterCompileValue(CompileValue value, string tokens) { //TODO ~ ramonv ~ handle tokens return(value.Name.Contains(tokens)); }
private static bool FilterCompileValue(CompileValue value, string filterText) { return(value.Name.Contains(filterText)); }
public void FocusNode(CompileValue value) { FocusPending = FindNodeByValue(value); FocusNode(FocusPending); }
public void SetTimeline(UnitValue unit, CompileValue value = null) { ThreadHelper.ThrowIfNotOnUIThread(); timeline.SetUnit(unit); timeline.FocusNode(value); }