private static List <Common.Statistics> GetStatisticList(string statisticFileName, string delimiter)
        {
            List <Common.Statistics> statistic_list = new List <Common.Statistics>();

            try
            {
                StreamReader reader = new StreamReader(statisticFileName + ".csv");
                reader.ReadLine();

                while (reader.Peek() != -1)
                {
                    var line            = reader.ReadLine();
                    var values          = line.Split(delimiter[0]);
                    Common.Statistics s = new Common.Statistics();
                    s.Circuit      = values[0];
                    s.ErrorCount   = Int32.Parse(values[1]);
                    s.WarningCount = Int32.Parse(values[2]);
                    s.State        = values[3];
                    s.Date         = DateTime.Parse(values[4]);
                    s.LogDirectory = values[5];

                    statistic_list.Add(s);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Could not read file from disk. Original error: " + ex.Message);
            }
            return(statistic_list);
        }
 public void PopulateStats(Statistics stats)
 {
     revenue.Text = Convert.ToString(stats.TotalRevenue);
     expenditure.Text = Convert.ToString(stats.TotalExpenditure);
     events.Text = Convert.ToString(stats.TotalEvents);
     triples.Items.Clear();
     foreach (var triple in stats.Triples)
     {
         triples.Items.Add(triple);
     }
     criticalRoutes.Items.Clear();
     foreach (var criticalRoute in stats.CriticalRoutes)
     {
         criticalRoutes.Items.Add(criticalRoute);
     }
 }
        /// <summary>
        /// Returns the statistics for the given point in time.
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public Statistics GetStatisticsFromPoint(DateTime dt)
        {
            var time = new DateTime(dt.Year, dt.Month, dt.Day, 23, 59, 59);
            var routes = routeDataHelper.LoadAll(time);
            var prices = priceDataHelper.LoadAll(time);
            var routeNodes = routeNodeDataHelper.LoadAll(time);
            var countries = countryDataHelper.LoadAll(time);
            var companies = companyDataHelper.LoadAll(time);
            var deliveries = deliveryDataHelper.LoadAll(time);
            var events = eventDataHelper.GetNumberOfEvents(time);

            var stateSnapshot = new StateSnapshot(time, routes, prices, deliveries, routeNodes, companies, countries, events);

            var statistics = new Statistics(stateSnapshot);

            return statistics;
        }
 public void Stats_Recieved(Statistics stats)
 {
     try
     {
         revenue.Dispatcher.VerifyAccess();
         PopulateStats(stats);
     }
     catch (InvalidOperationException e)
     {
         if (statsDelegate == null)
             statsDelegate = new StatsDelegate(PopulateStats);
         revenue.Dispatcher.Invoke(statsDelegate, System.Windows.Threading.DispatcherPriority.Normal, stats);
     }
 }