Exemple #1
0
 public void SetUp()
 {
     this.user = new User(name, sid);
     this.json = new DynamicJson();
     this.json["Name"] = this.name;
     this.json["Sid"] = this.sid;
     this.json["LoginTime"] = user.LoginTime;
 }
 public void AttendSid(IClient client)
 {
     User user = new User()
     {
         Sid = UserVM.Sid
     };
     user = client.AttendSid(user);
     UserVM.Name = user.Name;
     UserVM.Sid = user.Sid;
 }
 public User AttendBase(string url)
 {
     using (var client = new WebClient())
     {
         client.Headers[HttpRequestHeader.ContentType] = "application/json";
         client.Headers[HttpRequestHeader.ContentEncoding] = "utf-8";
         try
         {
             User user = new User();
             string response = client.UploadString(url, "POST", "");
             var result = DynamicJson.Parse(response);
             user.Sid = result["sid"];
             user.Name = result["name"];
             return user;
         }
         catch (WebException e)
         {
             Log.Write(e.Status.ToString());
             Console.WriteLine(e.Source);
             throw new NullReferenceException();
         }
     }
 }
 public User AttendSid(User user)
 {
     string url = settings.Url + "/users/" + user.Sid
                               + "/attend_sid?token=" + settings.Token;
     return AttendBase(url);
 }