private void RefreshSingleBatchStatistics() { //// Get the last marked and unmarked batches //BindingList<CurrentCaptureFile> lastBatchIds = new BindingList<CurrentCaptureFile>(); //ProcessCapturePackets pcp = new ProcessCapturePackets(); //lastBatchIds = pcp.GetLastCaptureBatchIds(); //// Get the batch intervals //BindingList<BatchIntervalMarked> unmarkedBatchIntervals = new BindingList<BatchIntervalMarked>(); //BindingList<BatchIntervalMarked> markedBatchIntervals = new BindingList<BatchIntervalMarked>(); //foreach (CurrentCaptureFile file in lastBatchIds) //{ // if (file.CaptureState == CaptureState.Marked) // { // markedBatchIntervals = pcp.GetMarkedBatchIntervals(file.CaptureBatchId); // } // else if(file.CaptureState == CaptureState.Unmarked) // { // unmarkedBatchIntervals = pcp.GetMarkedBatchIntervals(file.CaptureBatchId); // } // else // { // MessageBox.Show("Error retrieving batch intervals: capture state is unknown!", "GetMarkedBatchIntervals by CaptureBatchId", MessageBoxButtons.OK, MessageBoxIcon.Error); // } //} //BatchStatistics markedSingleStats = new BatchStatistics(); //BatchStatistics unmarkedSingleStats = new BatchStatistics(); //// Get this data from DisplayStatistics table; except on refresh... ////AnalysisEngine ae = new AnalysisEngine(); ////markedSingleStats = ae.GetBatchStatistics(markedBatchIntervals, CaptureState.Marked, BatchType.Single); ////unmarkedSingleStats = ae.GetBatchStatistics(unmarkedBatchIntervals, CaptureState.Unmarked, BatchType.Single); // Get the display statistics from the database ProcessCapturePackets pcp = new ProcessCapturePackets(); DisplayStatistic unmarkedSingleStats = new DisplayStatistic(); unmarkedSingleStats = pcp.GetLastSingleUnmarkedDisplayStatistics(); // Load up the table // Single unmarked column int row = 0; _AnalysisDataGridView.Rows[row++].Cells[1].Value = unmarkedSingleStats.IntervalCount; _AnalysisDataGridView.Rows[row++].Cells[1].Value = TrimIntervals == true ? unmarkedSingleStats.TrimmedIntervalCount.ToString() : "N/A"; _AnalysisDataGridView.Rows[row++].Cells[1].Value = string.Format("{0:N2}", unmarkedSingleStats.MeanPacketsPerInterval); _AnalysisDataGridView.Rows[row++].Cells[1].Value = string.Format("{0:N2}", unmarkedSingleStats.StandardDeviation); _AnalysisDataGridView.Rows[row++].Cells[1].Value = unmarkedSingleStats.MinPacketsPerInterval; _AnalysisDataGridView.Rows[row++].Cells[1].Value = unmarkedSingleStats.MaxPacketsPerInterval; _AnalysisDataGridView.Rows[row++].Cells[1].Value = "N/A"; _AnalysisDataGridView.Rows[row++].Cells[1].Value = "N/A"; _AnalysisDataGridView.Rows[row++].Cells[1].Value = "N/A"; DisplayStatistic markedSingleStats = new DisplayStatistic(); markedSingleStats = pcp.GetLastSingleMarkedDisplayStatistics(); // Single marked column row = 0; _AnalysisDataGridView.Rows[row++].Cells[2].Value = markedSingleStats.IntervalCount; _AnalysisDataGridView.Rows[row++].Cells[2].Value = TrimIntervals == true ? markedSingleStats.TrimmedIntervalCount.ToString() : "N/A"; _AnalysisDataGridView.Rows[row++].Cells[2].Value = string.Format("{0:N2}", markedSingleStats.MeanPacketsPerInterval); _AnalysisDataGridView.Rows[row++].Cells[2].Value = string.Format("{0:N2}", markedSingleStats.StandardDeviation); _AnalysisDataGridView.Rows[row++].Cells[2].Value = markedSingleStats.MinPacketsPerInterval; _AnalysisDataGridView.Rows[row++].Cells[2].Value = markedSingleStats.MaxPacketsPerInterval; _AnalysisDataGridView.Rows[row++].Cells[2].Value = "N/A"; _AnalysisDataGridView.Rows[row++].Cells[2].Value = "N/A"; _AnalysisDataGridView.Rows[row++].Cells[2].Value = "N/A"; // Single variance column row = 0; _AnalysisDataGridView.Rows[row++].Cells[3].Value = unmarkedSingleStats.IntervalCount - markedSingleStats.IntervalCount; _AnalysisDataGridView.Rows[row++].Cells[3].Value = TrimIntervals == true ? (unmarkedSingleStats.TrimmedIntervalCount - markedSingleStats.TrimmedIntervalCount).ToString() : "N/A"; _AnalysisDataGridView.Rows[row++].Cells[3].Value = string.Format("{0:N2}", (unmarkedSingleStats.MeanPacketsPerInterval - markedSingleStats.MeanPacketsPerInterval)); _AnalysisDataGridView.Rows[row++].Cells[3].Value = string.Format("{0:N2}",(unmarkedSingleStats.StandardDeviation - markedSingleStats.StandardDeviation)); _AnalysisDataGridView.Rows[row++].Cells[3].Value = unmarkedSingleStats.MinPacketsPerInterval - markedSingleStats.MinPacketsPerInterval; _AnalysisDataGridView.Rows[row++].Cells[3].Value = unmarkedSingleStats.MaxPacketsPerInterval - markedSingleStats.MaxPacketsPerInterval; _AnalysisDataGridView.Rows[row++].Cells[3].Value = "N/A"; _AnalysisDataGridView.Rows[row++].Cells[3].Value = "N/A"; _AnalysisDataGridView.Rows[row++].Cells[3].Value = "N/A"; }