public static async Task DownloadAllXKCD()
        {
            var g = SampleDataSource.GetGroup("XKCD");
            int n = int.Parse(g.Items.Last().UniqueId);

            await addPreviousN(g.Items.Last(), g, n - g.Items.Count());
        }
        public static async Task checkAndAddNewComics()
        {
            string     url    = "http://xkcd.com/info.0.json";
            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Add("user-agent", "XKCD Daily Win8 Reader");
            HttpResponseMessage response = await client.GetAsync(url);

            string responseText = await response.Content.ReadAsStringAsync();

            try
            {
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    SampleDataGroup Comics = SampleDataSource.GetGroup("XKCD");

                    JsonObject json = JsonObject.Parse(responseText);


                    string month = json.GetNamedString("month");
                    int    num   = (int)json.GetNamedNumber("num");

                    if (Comics.Items[0].UniqueId != num.ToString())
                    {
                        string link       = json.GetNamedString("link");
                        string year       = json.GetNamedString("year");
                        string news       = json.GetNamedString("news");
                        string safe_title = json.GetNamedString("safe_title");
                        string transcript = json.GetNamedString("transcript");
                        string alt        = json.GetNamedString("alt");
                        string img        = json.GetNamedString("img");
                        string title      = json.GetNamedString("title");
                        string day        = json.GetNamedString("day");

                        //localize?
                        string fulldate = month + "/" + day + "/" + year;



                        SampleDataItem newcomic = new SampleDataItem(num.ToString(), title, fulldate, img, transcript, alt, Comics, img);
                        if (FavoriteManager.isFavorite(num))
                        {
                            newcomic.isFav = true;
                        }
                        Comics.Items.Insert(0, newcomic);
                        //SampleDataSource._sampleDataSource._allGroups.Clear();
                        //SampleDataSource._sampleDataSource._allGroups.Add(Comics);
                    }
                }
                else if (response.StatusCode == HttpStatusCode.GatewayTimeout)
                {
                    var dia = new Windows.UI.Popups.MessageDialog("It appears xkcd.com is under heavy load. Please try again later.");
                    await dia.ShowAsync();
                }
                response.ToString();
            }
            catch (Exception)
            {
            }
        }
            public async override Task <IEnumerable <SampleDataItem> > PullDataAsync(uint count)
            {
                //return await SampleDataSource.returnPreviousN(SampleDataSource.GetGroup("XKCD").Items.Last(), SampleDataSource.GetGroup("XKCD"), (int)count);
                var l = new List <SampleDataItem>();

                l.Add(await SampleDataSource.getComicByNum(int.Parse(SampleDataSource.GetGroup("XKCD").Items.Last().UniqueId) - 1, SampleDataSource.GetGroup("XKCD")));
                return(l);
            }
            public static void WriteFavs()
            {
                List <string> favs = new List <string>();

                foreach (var x in SampleDataSource.GetGroup("Favorites").Items)
                {
                    favs.Add(x.UniqueId);
                }

                var settings = Windows.Storage.ApplicationData.Current.RoamingSettings;

                settings.Values["favs"] = string.Join(",", favs);
            }