public async Task CheckMissedEventsAsync()
 {
     while (_IsSleeping == false)
     {
         string json;
         using (var client = new WebClient())
         {
             string uri = $"https://census.daybreakgames.com/get/ps2:v2/world_event/?world_id=17&after={(int)_timeOfPause}&c:limit=500";
             //if(globalWorldId!=null) uri = $"https://census.daybreakgames.com/get/ps2:v2/world_event/?world_id={globalWorldId}&after={(int)_timeOfPause}&c:limit=500";
             json = await client.DownloadStringTaskAsync(uri);
         }
         Events.WorldEventListResult missedEvents = Newtonsoft.Json.JsonConvert.DeserializeObject <Events.WorldEventListResult>(json);
         // check if any of the downloaded event types are continent events
         //foreach (Events.World_Event item in missedEvents.world_event_list)
         for (int i = 0; i < missedEvents.world_event_list.Count; i++)
         {
             if (missedEvents.world_event_list[i].event_type == "MetagameEvent")
             {
                 var d = MatchEvents(missedEvents.world_event_list[i]);
                 if (d != null)
                 {
                     //make a notification to the user
                     DateTime epoch     = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                     var      notifServ = Xamarin.Forms.DependencyService.Resolve <INotificationService>();
                     double   stamp     = (double)(missedEvents.world_event_list[i].timestamp);
                     notifServ.NotifyOld("Planetside Event", $"{d.event_name} on {d.continent} {missedEvents.world_event_list[i].metagame_event_state_name} at " +
                                         epoch.AddSeconds(stamp).ToLocalTime().ToShortTimeString());
                 }
             }
         }
     }
 }
        /// <summary>
        /// Download up to 1000 latest events of type METAGAME from the Historic Events collection
        /// </summary>
        /// <returns>Task-wrapped List of type CompactWorldEvent</returns>
        public async Task <List <CompactWorldEvent> > GetMetagameEventsAsync()
        {
            EventsHelper eventsHelper = new EventsHelper();
            string       pref         = Preferences.Get("globalWorldId", "100", "theWorld");
            int          time         = ((int)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds) - 28800; //28800 is last 8 hours
            string       json;

            using (var client = new WebClient())
            {
                string uri = $"https://census.daybreakgames.com/s:trashpanda/get/ps2:v2/world_event/?world_id={pref}&after={time}&type=METAGAME&c:limit=200";
                if (pref == "100") //if we're debugging
                {
                    uri = $"https://census.daybreakgames.com/s:trashpanda/get/ps2:v2/world_event/?after={time}&type=METAGAME&c:limit=200";
                }

                json = await client.DownloadStringTaskAsync(uri);
            }
            Events.WorldEventListResult recentList = Newtonsoft.Json.JsonConvert.DeserializeObject <Events.WorldEventListResult>(json);


            var compactEventList = new List <CompactWorldEvent>();

            foreach (Events.World_Event item in recentList.world_event_list)
            {
                compactEventList.Add(new CompactWorldEvent()
                {
                    eventName         = eventsHelper.MatchEvents(item).event_name,
                    event_type        = item.event_type,
                    metagame_event_id = item.metagame_event_id,
                    timestamp         = item.timestamp,
                    world_id_int      = int.Parse(item.world_id)
                });
            }

            return(compactEventList);
        }