Ejemplo n.º 1
0
        private void LoadQueries_OnClick(object sender, RoutedEventArgs e)
        {
            var timeDurationViewModel = DataContext as TimeDurationViewModel;

            if (timeDurationViewModel == null)
            {
                DataContext = new TimeDurationViewModel();
            }
            (DataContext as TimeDurationViewModel).Queries.Clear();
            var dialog = new OpenFileDialog {
                InitialDirectory = AppDomain.CurrentDomain.BaseDirectory
            };

            if (dialog.ShowDialog() != true)
            {
                return;
            }
            using (var fs = File.OpenRead(dialog.FileName))
            {
                using (TextReader reader = new StreamReader(fs))
                {
                    while (reader.Peek() >= 0)
                    {
                        (DataContext as TimeDurationViewModel).Queries.Add(reader.ReadLine());
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public TimeDurationView()
        {
            InitializeComponent();
            DataContext             = new TimeDurationViewModel();
            _resultRuntimes         = new List <double>();
            _cumulativeRuntimeChart = new Chart();
            _cumulativeRuntimeChart.ChartAreas.Add("chtArea");
            CumulativeGraphControlHost.Child = _cumulativeRuntimeChart;
            _cumulativeRuntimeChart.ChartAreas[0].AxisX.Title     = "Runs";
            _cumulativeRuntimeChart.ChartAreas[0].AxisX.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _cumulativeRuntimeChart.ChartAreas[0].AxisY.Title     = "Runtime (Milliseconds)";
            _cumulativeRuntimeChart.ChartAreas[0].AxisY.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _cumulativeRuntimeChart.BackColor            = Color.White;
            _cumulativeRuntimeChart.BorderSkin.SkinStyle = BorderSkinStyle.None;

            _individualRuntimeChart = new Chart();
            _individualRuntimeChart.ChartAreas.Add("chtArea");
            IndividualGraphControlHost.Child = _individualRuntimeChart;
            _individualRuntimeChart.ChartAreas[0].AxisX.Title     = "Runs";
            _individualRuntimeChart.ChartAreas[0].AxisX.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _individualRuntimeChart.ChartAreas[0].AxisY.Title     = "Runtime (Milliseconds)";
            _individualRuntimeChart.ChartAreas[0].AxisY.TitleFont = new Font(
                System.Drawing.FontFamily.GenericSansSerif, 12);
            _individualRuntimeChart.BackColor            = Color.White;
            _individualRuntimeChart.BorderSkin.SkinStyle = BorderSkinStyle.None;
        }
Ejemplo n.º 3
0
        private void LoadUrls_OnClick(object sender, RoutedEventArgs e)
        {
            var durationViewModel = DataContext as TimeDurationViewModel;

            if (durationViewModel == null)
            {
                DataContext = new TimeDurationViewModel();
            }
            var dialog = new OpenFileDialog {
                InitialDirectory = AppDomain.CurrentDomain.BaseDirectory
            };

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            using (var fs = File.OpenRead(dialog.FileName))
            {
                using (TextReader reader = new StreamReader(fs))
                {
                    while (reader.Peek() >= 0)
                    {
                        (DataContext as TimeDurationViewModel).Urls.Add(reader.ReadLine());
                    }
                }
            }

            //var vms = (from url in (DataContext as TimeDurationViewModel).Urls where (DataContext as TimeDurationViewModel).Summaries.All(x => x.Request != url) select new StatSummaryViewModel(url, new List<TimeSpan>())).ToList();
            var vms = (DataContext as TimeDurationViewModel).Urls.ToList();

            foreach (var item in vms)
            {
                (DataContext as TimeDurationViewModel).Summaries.Add(new StatSummaryViewModel(item, new List <TimeSpan>()));
            }

            var index = 0;

            _cumulativeRuntimeChart.Series.Clear();
            _cumulativeRuntimeChart.Legends.Clear();
            foreach (var url in durationViewModel.Urls)
            {
                _individualRuntimeChart.Legends.Add(url);
                _individualRuntimeChart.Series.Add(url);
                _individualRuntimeChart.Series[index].ChartType    = SeriesChartType.Line;
                _individualRuntimeChart.Legends[index].LegendStyle = LegendStyle.Table;
                _individualRuntimeChart.Legends[index].TableStyle  = LegendTableStyle.Tall;
                _individualRuntimeChart.Legends[index].Docking     = Docking.Bottom;

                _cumulativeRuntimeChart.Legends.Add(url);
                _cumulativeRuntimeChart.Series.Add(url);
                _cumulativeRuntimeChart.Series[index].ChartType    = SeriesChartType.Line;
                _cumulativeRuntimeChart.Legends[index].LegendStyle = LegendStyle.Table;
                _cumulativeRuntimeChart.Legends[index].TableStyle  = LegendTableStyle.Tall;
                _cumulativeRuntimeChart.Legends[index].Docking     = Docking.Bottom;
                index++;
            }
        }