public static StaticMapService GetSingleton() { if (_StaticMapService == null) { _StaticMapService = new StaticMapService(); } return(_StaticMapService); }
private static void UpdateDbInBackground() { Thread DBUpdater = new Thread(() => { // wait for DB updates while (!UpdateTeslalogger.Done) { Thread.Sleep(5000); } Thread.Sleep(30000); DateTime start = DateTime.Now; Logfile.Log("UpdateDbInBackground started"); DBHelper.UpdateElevationForAllPoints(); WebHelper.UpdateAllPOIAddresses(); foreach (Car c in Car.Allcars) { c.DbHelper.CombineChangingStates(); c.webhelper.UpdateAllEmptyAddresses(); c.DbHelper.UpdateEmptyChargeEnergy(); c.DbHelper.UpdateEmptyUnplugDate(); c.DbHelper.AnalyzeChargingStates(); c.DbHelper.UpdateAllDriveHeightStatistics(); } DBHelper.UpdateAllNullAmpereCharging(); DBHelper.UpdateIncompleteTrips(); DBHelper.UpdateAllChargingMaxPower(); foreach (Car c in Car.Allcars) { ShareData sd = new ShareData(c); sd.SendAllChargingData(); sd.SendDegradationData(); } DBHelper.UpdateCarIDNull(); StaticMapService.CreateAllTripMaps(); StaticMapService.CreateAllChargingMaps(); StaticMapService.CreateAllParkingMaps(); Logfile.Log("UpdateDbInBackground finished, took " + (DateTime.Now - start).TotalMilliseconds + "ms"); RunHousekeepingInBackground(); }) { Priority = ThreadPriority.BelowNormal }; DBUpdater.Start(); }
private static void InitStaticMapService() { try { Thread threadStaticMapService = new Thread(() => { StaticMapService.GetSingleton().Run(); }) { Name = "StaticMapServiceThread" }; threadStaticMapService.Start(); } catch (Exception ex) { Logfile.Log(ex.ToString()); } }
private static void UpdateDbInBackground() { Thread DBUpdater = new Thread(() => { try { // wait for DB updates while (!UpdateTeslalogger.Done) { Thread.Sleep(5000); } Thread.Sleep(30000); DateTime start = DateTime.Now; Logfile.Log("UpdateDbInBackground started"); DBHelper.UpdateElevationForAllPoints(); WebHelper.UpdateAllPOIAddresses(); DBHelper.DeleteDuplicateTrips(); foreach (Car c in Car.Allcars) { c.DbHelper.CombineChangingStates(); c.webhelper.UpdateAllEmptyAddresses(); c.DbHelper.UpdateEmptyChargeEnergy(); c.DbHelper.UpdateEmptyUnplugDate(); c.DbHelper.AnalyzeChargingStates(); c.DbHelper.UpdateAllDriveHeightStatistics(); } DBHelper.UpdateAllNullAmpereCharging(); DBHelper.UpdateIncompleteTrips(); DBHelper.UpdateAllChargingMaxPower(); for (int x = 0; x < Car.Allcars.Count; x++) { Car c = Car.Allcars[x]; ShareData sd = new ShareData(c); sd.SendAllChargingData(); sd.SendDegradationData(); sd.SendAllDrivingData(); } DBHelper.UpdateCarIDNull(); StaticMapService.CreateAllTripMaps(); StaticMapService.CreateAllChargingMaps(); StaticMapService.CreateAllParkingMaps(); Car.LogActiveCars(); Logfile.Log("UpdateDbInBackground finished, took " + (DateTime.Now - start).TotalMilliseconds + "ms"); RunHousekeepingInBackground(); } catch (Exception ex) { ex.ToExceptionless().FirstCarUserID().Submit(); Logfile.Log(ex.ToString()); } }) { Priority = ThreadPriority.BelowNormal }; DBUpdater.Name = "DBUpdaterThread"; DBUpdater.Start(); }