Exemplo n.º 1
0
 private void LoadInBackground()
 {
     List<Framework.Data.Log> logs = new List<Framework.Data.Log>();
     List<Framework.Data.Waypoint> wps = new List<Framework.Data.Waypoint>();
     List<Framework.Data.UserWaypoint> usrwps = new List<Framework.Data.UserWaypoint>();
     List<Framework.Data.LogImage> logimgs = new List<Framework.Data.LogImage>();
     List<Framework.Data.GeocacheImage> geocacheimgs = new List<Framework.Data.GeocacheImage>();
     try
     {
         LoadLogs(logs);
         foreach (Framework.Data.Log lg in logs)
         {
             lg.FullDataLoaded = false;
         }
         Core.Logs.Add(logs);
         LoadWaypoints(wps, usrwps);
         Core.Waypoints.Add(wps);
         Core.UserWaypoints.Add(usrwps);
         LoadLogImages(logimgs);
         Core.LogImages.Add(logimgs);
         LoadGeocacheImages(geocacheimgs);
         Core.GeocacheImages.Add(geocacheimgs);
     }
     catch
     {
         DatabaseError = true;
     }
     _context.Post(new SendOrPostCallback(delegate(object state)
     {
         Core.GeocacheImages.EndUpdate();
         Core.LogImages.EndUpdate();
         Core.Waypoints.EndUpdate();
         Core.UserWaypoints.EndUpdate();
         Core.Logs.EndUpdate();
         _loadingInBackgroundActive = false;
         _notificationMessage.Visible = false;
         _notificationMessage = null;
     }), null);
 }
Exemplo n.º 2
0
 private void StartLoadingInBackground()
 {
     _context.Send(new SendOrPostCallback(delegate(object state)
     {
         _notificationMessage = new BaseInternalStorageBackgroundMessage();
         OnNotification(_notificationMessage);
         _notificationMessage.label1.Text = LanguageSupport.Instance.GetTranslation(STR_LOADING_LOGS_BG);
         Core.Logs.BeginUpdate();
         Core.UserWaypoints.BeginUpdate();
         Core.Waypoints.BeginUpdate();
         Core.LogImages.BeginUpdate();
         Core.GeocacheImages.BeginUpdate();
         _loadingInBackgroundActive = true;
     }), null);
     Thread thrd = new Thread(LoadInBackground);
     thrd.IsBackground = true;
     thrd.Start();
 }