Exemple #1
0
        public static async void SaveUser(User user)
        {
            StorageFolder localFolder = ApplicationData.Current.LocalFolder;
            StorageFile textFile = await localFolder.CreateFileAsync("user2", CreationCollisionOption.ReplaceExisting);

            using (IRandomAccessStream textStream = await textFile.OpenAsync(FileAccessMode.ReadWrite))
            {
                using (DataWriter textWriter = new DataWriter(textStream))
                {
                    textWriter.WriteString(user.Name + "\n" + user.DisplayName + "\n"
                        + user.Oauth);
                    await textWriter.StoreAsync();
                }
            }
        }
Exemple #2
0
 public static async Task<bool> UnfollowStream(string stream, User user)
 {
     Uri access_token_path = new Uri(string.Format(PathStrings.FOLLOW_USER, user.Name, stream, user.Oauth));
     var request = HttpWebRequest.Create(access_token_path);
     request.Method = "DELETE";
     try
     {
         var response = await HttpRequest(request);
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #3
0
        public static async Task<bool> IsStreamFollowed(string stream, User user)
        {
            Uri access_token_path = new Uri(string.Format(PathStrings.IS_STREAM_FOLLOWED_PATH, user.Name, stream));
            var request = HttpWebRequest.Create(access_token_path);
            request.Method = "GET";
            string response;

            try
            {
                response = await HttpRequest(request);
                return true;
            }
            catch { return false; }
            
        }