title: Waiting for event to finish
body: <p>Im trying to convert the response from the webclient to Json, but it's trying to create the JSON object before it is done downloaing it from the server.
  Is there a "nice" way to for me to wait for WebOpenReadCompleted to be executed?</p>
  
  <p>Have to mention that this is a WP7 app, so everything is Async</p>
  
  <pre><code>public class Client
  {
  
      public String _url;
      private String _response;
      private WebClient _web;
  
      private JObject jsonsobject;
      private Boolean blockingCall;
  
  
      private Client(String url)
      {
          _web = new WebClient();
          _url = url;
      }
  
      public JObject Login(String username, String password)
      {
          String uriUsername = HttpUtility.UrlEncode(username);
          String uriPassword = HttpUtility.UrlEncode(password);
  
          Connect(_url + "/data.php?req=Login&amp;username=" + uriUsername + "&amp;password=" + uriPassword + "");
          jsonsobject = new JObject(_response); 
          return jsonsobject;
      }
  
      public JObject GetUserInfo()
      {
  
          Connect(_url + "/data.php?req=GetUserInfo");
          jsonsobject = new JObject(_response); 
          return jsonsobject;
      }
  
      public JObject Logout()
      {
  
          Connect(_url + "/data.php?req=Logout");
          jsonsobject = new JObject(_response); 
          return jsonsobject;
      }
  
      private void Connect(String url)
      {
  
          _web.Headers["Accept"] = "application/json";
          _web.OpenReadCompleted += new OpenReadCompletedEventHandler(WebOpenReadCompleted);
          _web.OpenReadAsync(new Uri(url));
      }
  
      private void WebOpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
      {
          if (e.Error != null || e.Cancelled)
          {
              MessageBox.Show("Error:" + e.Error.Message);
              _response = "";
          } 
          else
          {
              using (var reader = new StreamReader(e.Result))
              {
                  _response = reader.ReadToEnd();
              }    
          }
      }
  }
  </code></pre>