public async void LoadSubreddits()
        {
            string jsonString = await RoamingDataHelper.GetText(subredditsFileName);

            var subredditsList = JArray.Parse(jsonString).ToObject <List <SubredditItem> >();

            if (subredditsList.Count == 0)
            {
                subredditsList = new List <SubredditItem>()
                {
                    new SubredditItem {
                        Title = "Funny", Url = "funny"
                    },
                    new SubredditItem {
                        Title = "Pictures", Url = "pics"
                    },
                    new SubredditItem {
                        Title = "WTF?!", Url = "funny"
                    },
                    new SubredditItem {
                        Title = "The cutest things on the internet", Url = "aww"
                    },
                    new SubredditItem {
                        Title = "Cats", Url = "cats"
                    },
                    new SubredditItem {
                        Title = "EarthPorn", Url = "earthporn"
                    },
                    new SubredditItem {
                        Title = "Dank Memes", Url = "adviceanimals"
                    }
                };
            }
            Subreddits = new ObservableCollection <SubredditItem>(subredditsList);
        }
Example #2
0
        public async void LoadSubreddits()
        {
            string jsonString = await RoamingDataHelper.GetText(subredditsFileName);

            var subredditsList = JArray.Parse(jsonString).ToObject <List <SubredditItem> >();

            if (subredditsList.Count == 0)
            {
                subredditsList = new List <SubredditItem>()
                {
                    //new Subreddit("earthporn", "EarthPorn"),
                    //new Subreddit("funny", "Funny"),
                    //new Subreddit("pics", "Pics"),
                    //new Subreddit("gifs", "GIFs"),
                    //new Subreddit("aww", "AWW")
                };
            }
            Subreddits = new ObservableCollection <SubredditItem>(subredditsList);
        }
Example #3
0
 internal async void SaveSubreddits()
 {
     string text = JsonConvert.SerializeObject(Subreddits);
     await RoamingDataHelper.StoreText(text, subredditsFileName);
 }