Exemple #1
0
 private static void refreshFeeds(User user)
 {
     foreach (PodcastRssFeedXmlSurrogate.rss rssFeed in user.Subscriptions)
     {
         HttpClient client = new HttpClient();
         var response = client.GetAsync(new Uri(rssFeed.channel.link));
     }
 }
Exemple #2
0
        private static async void getTask()
        {
            var outFile = await DownloadsFolder.CreateFileAsync("Subscriptions.xml");
            using (var outStream = await outFile.OpenAsync(FileAccessMode.ReadWrite))
            {
                var inFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/sn.xml"));
                var inStream = await inFile.OpenAsync(FileAccessMode.Read);
                var rssFeed = (PodcastRssFeedXmlSurrogate.rss)PodcastRssFeedXmlSurrogate.rss.Serializer.Deserialize(inStream.AsStream());

                var user = new User();
                user.Subscriptions.Add(rssFeed);

                User.Serializer.Serialize(outStream.AsStream(), user);    
            }
        }
Exemple #3
0
        public async static void create_user_with_security_now_sub()
        {
            var appData = ApplicationData.Current.LocalFolder;
            var outFile = await appData.CreateFileAsync("Subscriptions.xml");
            var outStream = await outFile.OpenAsync(FileAccessMode.ReadWrite);

            var inFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/sn.xml"));
            var inStream = await inFile.OpenAsync(FileAccessMode.Read);
            var rssFeed = (PodcastSurrogate.rss)PodcastSurrogate.rss.Serializer.Deserialize(inStream.AsStream());

            var user = new User();
            user.Subscriptions.Add(rssFeed);

            User.Serializer.Serialize(outStream.AsStream(), user);

        }
        public static async Task<User> GetUser()
        {
            if (_user != null)
            {
                return _user;
            }

            var appData = ApplicationData.Current.LocalFolder;
            var availableFiles = await appData.GetFilesAsync(CommonFileQuery.DefaultQuery);

            if ( ! availableFiles.Any(file => file.Name.Equals("Subscriptions.xml")))
            {
                _user = new User();
                return _user;
            }

            var settingsFile = await appData.GetFileAsync("Subscriptions.xml");
            using (var stream = await settingsFile.OpenAsync(FileAccessMode.Read))
            {
                _user = (User) User.Serializer.Deserialize(stream.AsStream());
                return _user;
            }
        }