public void RunTests() { byte[] imageData; using (Image srcImage = Image.FromFile(@"D:\Bill\Code\XamarinEvolve2013Project\TestSSAPI\testavatar.jpg")) { using (MemoryStream m = new MemoryStream()) { srcImage.Save(m, ImageFormat.Jpeg); imageData = m.ToArray(); //buffers } } JsonServiceClient client = new JsonServiceClient(SystemConstants.WebServiceBaseURL); UserAvatar userAvatar = new UserAvatar() { UserName = "******", Data = imageData, }; UserAvatarResponse response = client.Post<UserAvatarResponse>("UserAvatar", userAvatar); //response = client.Delete<UserAvatarResponse>("UserAvatar/billholmes"); return; }
protected override void PostNewAvatar(byte[] data) { User currentUser = Engine.Instance.UserAccess.GetCurrentUser (); UserAvatar userAvatar = new UserAvatar() { UserName = currentUser.UserName, Data = data, Size = 200, }; lock (_clientWrapper.ClientLock) { _clientWrapper.Client.Post<UserAvatarResponse>("UserAvatar", userAvatar); } }