/// <summary>
        /// Called when the cache does not contain the requested route length.
        /// Attempt to get length from the database, if it's not there then calculate it and
        /// store the result in the database.
        /// </summary>
        /// <param name="myObject"></param>
        /// <param name="args"></param>
        static void _cache_DataUpdateNeeded(object myObject, DataUpdateNeededArgs<RouteKey, int> args)
        {
            int jumps = int.MaxValue;
            int startSystemID = args.Key.StartSystem;
            int endSystemID = args.Key.EndSystem;

            if (_hitLevel.ContainsKey(args.Key))
            {
                _hitLevel.Remove(args.Key);
            }

            EveDataSet.SolarSystemDistancesDataTable distances = new EveDataSet.SolarSystemDistancesDataTable();

            // try the database...
            LoadDistanceData(startSystemID, endSystemID, distances);
            EveDataSet.SolarSystemDistancesRow distanceData =
                distances.FindByFromSolarSystemIDToSolarSystemID(startSystemID, endSystemID);

            if (distanceData != null)
            {
                jumps = distanceData.Distance;
                _hitLevel.Add(args.Key, 2);
            }
            else
            {
                LoadDistanceData(endSystemID, startSystemID, distances);
                distanceData = distances.FindByFromSolarSystemIDToSolarSystemID(endSystemID, startSystemID);
                if (distanceData != null)
                {
                    jumps = distanceData.Distance;
                    SetDistance(startSystemID, endSystemID, jumps);
                    _hitLevel.Add(args.Key, 2);
                }
                else
                {
                    // If it's not in the database then we need to calculate it.
                    Map.SetCosts(1, 1, 1);
                    jumps = Map.CalcRouteLength(startSystemID, endSystemID);
                    SetDistance(startSystemID, endSystemID, jumps);
                    _hitLevel.Add(args.Key, 3);
                }
            }

            args.Data = jumps;
        }
        /// <summary>
        /// Set distance data for the specified route
        /// </summary>
        /// <param name="startSystemID"></param>
        /// <param name="endSystemID"></param>
        /// <returns></returns>
        public static void SetDistance(int startSystemID, int endSystemID, int numJumps)
        {
            EveDataSet.SolarSystemDistancesDataTable distances = new EveDataSet.SolarSystemDistancesDataTable();
            LoadDistanceData(startSystemID, endSystemID, distances);
            EveDataSet.SolarSystemDistancesRow newRow = distances.FindByFromSolarSystemIDToSolarSystemID(
                startSystemID, endSystemID);

            if (newRow == null)
            {
                newRow = distances.NewSolarSystemDistancesRow();
                newRow.FromSolarSystemID = startSystemID;
                newRow.ToSolarSystemID = endSystemID;
                newRow.Distance = numJumps;
                distances.AddSolarSystemDistancesRow(newRow);
                lock (tableAdapter)
                {
                    tableAdapter.Update(distances);
                }
                distances.AcceptChanges();
            }
            else
            {
                newRow.Distance = numJumps;
                lock (tableAdapter)
                {
                    tableAdapter.Update(newRow);
                }
                distances.AcceptChanges();
            }
        }