Esempio n. 1
0
 private void addLoggedInUser(user user)
 {
     if (user != null)
     {
         _users.Add(user);
     }
 }
Esempio n. 2
0
        private static void GetResponseCallback(IAsyncResult asynchronousResult)
        {
            RequestState state = (RequestState)asynchronousResult.AsyncState;

            WebRequest request = (WebRequest)state.request;

            reddit caller = (reddit)state.caller;

            using (HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult))
            {
                using (Stream s = (Stream)response.GetResponseStream())
                {
                    using (StreamReader readStream = new StreamReader(s))
                    {
                        var json = JsonObject.Load (readStream);

                        try
                        {
                            user user = new user(json);
                            caller.addLoggedInUser(user);
                        }
                        catch (Exception e)
                        {
                            //handle bad password???
                        }
                    }
                }
            }
        }