Пример #1
0
        public async virtual Task<List<Feed>> GetFeedsAsync(string link) {
            List<Feed> feeds = new List<Feed>();

            try {
                // http://stackoverflow.com/questions/21500336/how-to-get-file-in-winrt-from-project-path
                var uri = new System.Uri(link);
                var feedsJsonFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);
                var feedsJsonData = await Windows.Storage.FileIO.ReadTextAsync(feedsJsonFile);

                JsonObject jsonObject = JsonObject.Parse(feedsJsonData);
                JsonArray jsonArray = jsonObject["Feeds"].GetArray();

                Feed feed;
                foreach (JsonValue feedValue in jsonArray) {
                    JsonObject feedObject = feedValue.GetObject();
                    feed = new Feed {
                        FeedName = feedObject["Name"].GetString(),
                        Link = feedObject["Link"].GetString(),
                        LastUpdated = feedObject["LastUpdated"].GetString()
                    };
                    feeds.Add(feed);
                }
            }
            catch (Exception x) {
                string msg = x.Message;
            }

            return feeds.OrderBy(f => f.FeedName).ToList();
        }
Пример #2
0
 partial void UpdateFeed(Feed instance);
Пример #3
0
 partial void DeleteFeed(Feed instance);
Пример #4
0
 partial void InsertFeed(Feed instance);