public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { var row = dataSource.RowAtIndexPath(indexPath); var doc = row.Document; // Toggle the document's 'checked' property var docContent = doc.Properties; object checkedVal; docContent.TryGetValue(RootViewController.CheckboxPropertyName, out checkedVal); var wasChecked = (bool)checkedVal; docContent[RootViewController.CheckboxPropertyName] = !wasChecked; SavedRevision newRevision = null; try { newRevision = doc.CurrentRevision.CreateRevision(docContent); } catch (Exception ex) { if (newRevision == null) { parent.ShowErrorAlert("Failed to update item", ex, false); } } }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { var row = dataSource.RowAtIndexPath(indexPath); var doc = row.Document; // Toggle the document's 'checked' property var docContent = doc.Properties.MutableCopy() as NSMutableDictionary; var checkedVal = (NSNumber)docContent.ValueForKey((NSString)RootViewController.CheckboxPropertyName); var wasChecked = checkedVal.BoolValue; docContent.SetValueForKey(new NSNumber(!wasChecked), (NSString)RootViewController.CheckboxPropertyName); NSError error; var newRevision = doc.CurrentRevision.PutProperties(docContent, out error); if (newRevision == null) { parent.ShowErrorAlert("Failed to update item", error, false); } }