public Task<int> DeleteShoppingItem(ShoppingItem item) { return Task.Factory.StartNew(() => { var id = DeleteItem(item); return id; }); }
public Task<ShoppingItem> SaveShoppingItem(ShoppingItem item) { return Task.Factory.StartNew(() => { SaveItem(item); return item; }); }
public LongPressElement(ShoppingItem item, MonoTouch.Foundation.NSAction tappedAction,MonoTouch.Foundation.NSAction longPressAction) : base(item.Item,tappedAction) { this.item = item; this.longPressAction = longPressAction; gester = new UILongPressGestureRecognizer (); gester.Delegate = new LongPressGestureDelegate (); gester.MinimumPressDuration = .5; gester.AddTarget (x => { if ((x as UILongPressGestureRecognizer).State == UIGestureRecognizerState.Began) { longPressAction(); } }); }
private ShoppingItem SaveItem(ShoppingItem item) { if (item.Id == 0) { conn.Insert(item); Console.WriteLine ("New item ID: {0} inserted", item.Id); } else { conn.Update(item); Console.WriteLine ("Item ID: {0} updated", item.Id); } return item; }
public ShoppingItemView(ShoppingItem item):base(null,true) { this.presenter = new ShoppingItemViewPresenter(item); // var tap = new UITapGestureRecognizer (); // tap.AddTarget (() =>{ // View.EndEditing (true); // }); // View.AddGestureRecognizer (tap); presenter.IsBusyChanged = (busy) => { if(busy) UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; else UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; }
public async void DeleteItem(ShoppingItem item) { try { IsBusy = true; var id = await shoppingService.DeleteShoppingItem(item); Refresh(); IsBusy = false; } catch (Exception exception) { Console.WriteLine("Unable to delete item"); } finally { IsBusy = false; } }
public async void MarkAsComplete(ShoppingItem item) { try { IsBusy = true; item.Completed = !item.Completed; // Toggle Complete for now. var result = await shoppingService.SaveShoppingItem(item); Console.WriteLine("{0} marked as {1}",item.Item,item.Completed ? "Completed" : "Not Complete"); Refresh(); IsBusy = false; } catch (Exception exception) { Console.WriteLine("Unable to mark as complete"); } finally { IsBusy = false; } }
private int DeleteItem(ShoppingItem item) { var id = conn.Delete(item); Console.WriteLine ("Item ID: {0} deleted", item.Id); return id; }
public ShoppingItemViewPresenter(ShoppingItem item) { this.item = item; this.service = new ShoppingService(); }
public void ShowItemView(ShoppingItem item) { view.ShowItemView (item); }
public ShoppingItemWrapper(ShoppingItem item) { this.item = item; }
/// <summary> /// copy constructor, creates an object with values from different object by making a complete copy of the internal reference /// </summary> /// <param name="theOtherShoppingItem"></param> public ShoppingItem(ShoppingItem theOtherShoppingItem) { description = theOtherShoppingItem.description; amount = theOtherShoppingItem.amount; unit = theOtherShoppingItem.unit; }
public void ShowItemView(ShoppingItem item) { NavigationController.PushViewController(new ShoppingItemView(item),true); }