示例#1
0
 private static void RenderDiagram(SequenceDiagram model, Controls.SequenceDiagram diagram)
 {
     diagram.Reset();
     diagram.Title           = model.Title;
     diagram.SequenceObjects = new System.Collections.ObjectModel.ObservableCollection <SequenceItem>();
     foreach (var item in model.SequenceSteps)
     {
         diagram.SequenceObjects.Add(item.Value);
     }
     //Diagram needs these to build connectors.
     diagram.UpdateLayout();
     foreach (var item in model.Connectors)
     {
         diagram.AddConnector(item.Item1, item.Item2, item.Item3);
     }
     diagram.UpdateLayout();
 }
示例#2
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);
        }