示例#1
0
        private Action OnStartQuery(Type type, IEnumerable result)
        {
            Controls.SequenceDiagram diagram = null;
            if (type == typeof(SequenceDiagram))
            {
                diagram = new Controls.SequenceDiagram();
                this.ResultPanel.RowDefinitions.Add(new RowDefinition());
                diagram.SetValue(Grid.RowProperty, this.ResultPanel.RowDefinitions.Count - 1);
                this.ResultPanel.Children.Add(diagram);
            }
            else
            {
                this.AddResultGrid(result);
            }

            bool   hasX, hasY;
            Action completion = () =>
            {
                if (type == typeof(SequenceDiagram))
                {
                    foreach (var item in result)
                    {
                        RenderDiagram(item as SequenceDiagram, diagram);
                        break;
                    }
                }
                else
                {
                    if (QueryWindowHelpers.CanShowChart(type, out hasX, out hasY))
                    {
                        var chart = this.AddChart();
                        QueryWindowHelpers.PopulateChart(chart, hasX, type, result);
                    }
                }
            };

            return(completion);
        }
示例#2
0
        private void txtDurationQuery_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.F5)
            {
                if (this.drillDownCTS != null)
                {
                    drillDownCTS.Cancel();
                }

                drillDownCTS = new CancellationTokenSource();

                string query = this.txtDurationQuery.Text;
                QueryWindowHelpers.ExecuteQueryAsync(this.Model,
                                                     query,
                                                     this.Model.GetPlayback(),
                                                     drillDownCTS,
                                                     (type, result) =>
                {
                    this.gridDuration.ItemsSource = result;
                    Action completion             = () =>
                    {
                        bool hasX, hasY;
                        if (QueryWindowHelpers.CanShowChart(type, out hasX, out hasY))
                        {
                            QueryWindowHelpers.PopulateChart(this.histogramChart, hasX, type, result);
                        }
                        else
                        {
                            this.histogramChart.Visibility = Visibility.Collapsed;
                        }
                    };

                    return(completion);
                });
                this.Show();
            }
        }