private void txtDrillDown_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F5) { if (this.idQueryCTS != null) { this.idQueryCTS.Cancel(); } this.idQueryCTS = new CancellationTokenSource(); string query = this.txtDrillDown.Text; QueryWindowHelpers.ExecuteQueryAsync(this.Model, query, this.Model.GetPlayback(), this.idQueryCTS, (type, result) => { this.gridDetails.ItemsSource = result; return(null); }); this.Show(); } }
private void ExecuteRunQuery(object param) { ResetQuery(); this.ResultPanel.Children.Clear(); this.ResultPanel.RowDefinitions.Clear(); this.ChartPane.Children.Clear(); this.ChartPane.RowDefinitions.Clear(); Playback scope = this.View.QueryModel.GetPlayback(); StringWriter errors = new StringWriter(); StringWriter output = new StringWriter(); this.View.QueryModel.Status = "Executing Query"; QueryWindowHelpers.ExecuteQueryAsync(this.View.QueryModel, this.View.EditorModel.QueryString, scope, this.queryCancelationToken, (type, result) => { return(this.OnStartQuery(type, result)); }); }
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); }
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(); } }