public override async void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { var r = GetCheckins (); var ci = r.ElementAt (indexPath.Row); if (editingStyle == UITableViewCellEditingStyle.Delete) { // clear existing - bit of a hack to prevent deleted // object from complaining later // _parent.OnCheckinsUpdate (new CheckinItem[0]); // do we have a photo? // if (ci.Checkin.Tag != null) { var p = new Picture (ci.Checkin.Tag); await p.DeleteAsync (); } // delete the checkin await ci.Checkin.DeleteAsync (); // reload the list // this.Clear (); _parent.checkinTable.ReloadData (); } }
public async Task<BuddyResult<Picture>> AddProfilePictureAsync(string caption, Stream pictureData, string contentType, BuddyGeoLocation location = null, BuddyPermissions readPermissions = BuddyPermissions.Default, BuddyPermissions writePermissions = BuddyPermissions.Default) { var result = await PictureCollection.AddAsync(this.Client, caption, pictureData, contentType, location, readPermissions, writePermissions); if (result.IsSuccess) { ProfilePicture = result.Value; } return result; }
private async void LoadPhoto(string id, NSIndexPath path, UIImageView target) { UIImage photoData = null; WeakReference wr; if (_photos.TryGetValue (id, out wr)) { if (wr.IsAlive) { photoData = (UIImage)wr.Target; } else { _photos.Remove (id); } } if (photoData == null) { var photo = new Picture (id); // get the photo bits, resized to fit 200x200 var loadTask = await photo.GetFileAsync (200); if (loadTask.IsSuccess && loadTask.Value != null) { NSData d = NSData.FromStream (loadTask.Value); photoData = UIImage.LoadFromData (d); _photos [id] = new WeakReference(photoData); // update the row after the load completes. _parent.OnCheckinsUpdate (null, path); } } target.Image = photoData; }