Skip to content
Browse files

Android Delete Fix

  • Loading branch information...
1 parent b081614 commit c7f3172e3e63be53587f0e1bf13b5fa00cfb07b4 @Redth committed Nov 28, 2012
View
4 WshLst.Core/ViewModels/WishListsViewModel.cs
@@ -78,9 +78,9 @@ public void Delete(WishList item)
}
else
{
- this.InvokeOnMainThread(() => _lists.Remove(item));
+ InvokeOnMainThread(() => _lists.Remove(item));
- RaisePropertyChanged("Lists");
+ RaisePropertyChanged(() => Lists);
}
});
}
View
2 WshLst.MonoForAndroid/Views/EditWishListView.cs
@@ -24,6 +24,8 @@ protected override void OnViewModelSet()
break;
}
};
+
+ ViewModel.LoadList();
}
}
}
View
8 WshLst.MonoForAndroid/Views/WishListView.cs
@@ -33,9 +33,7 @@ protected override void OnViewModelSet()
ViewModel.PropertyChanged += (s, e) =>
{
if (e.PropertyName.Equals("WishList"))
- {
Title = ViewModel.WishList.Name;
- }
};
ViewModel.LoadListAndItems();
@@ -65,11 +63,7 @@ public override bool OnContextItemSelected(IMenuItem menuItem)
var item = (MvxJavaContainer) _list.Adapter.GetItem(cmi.Position);
this.ShowQuestion("Delete?", "Are you sure you want to delete this item?", "Yes", "No",
- () =>
- {
- ViewModel.Delete((Entry) item.Object);
- ViewModel.LoadItems();
- }, null);
+ () => ViewModel.Delete((Entry) item.Object), null);
}
return true;
View
6 WshLst.MonoForAndroid/Views/WishListsView.cs
@@ -47,11 +47,7 @@ public override bool OnContextItemSelected(IMenuItem menuItem)
if (menuItem.TitleFormatted.ToString().Equals("Delete Wish List"))
{
this.ShowQuestion("Delete?", "Are you sure you want to delete this Wish List and all the items on it?", "Yes", "No",
- () =>
- {
- ViewModel.Delete((WishList) item.Object);
- ViewModel.LoadLists();
- }, null);
+ () => ViewModel.Delete((WishList) item.Object), null);
}
else
{
View
2 WshLst.MonoTouch/Views/EditWishListView.cs
@@ -40,6 +40,8 @@ public override void ViewDidLoad()
new EntryElement("Description", "Description").Bind(this, "{'Value':{'Path':'Description'}}")
}
};
+
+ ViewModel.LoadList();
}
}
}
View
4 WshLst.MonoTouch/Views/WishListView.cs
@@ -18,6 +18,7 @@ public WishListView(MvxShowViewModelRequest request) : base (request)
{
}
+ UIBarButtonItem buttonEdit = new UIBarButtonItem(UIBarButtonSystemItem.Edit);
UIBarButtonItem buttonAdd = new UIBarButtonItem(UIBarButtonSystemItem.Add);
UIBarButtonItem buttonShare;
@@ -50,9 +51,12 @@ public override void ViewDidLoad()
ViewModel.Delete(entry);
};
+ buttonEdit.Clicked += (sender, e) => ViewModel.EditWishList();
buttonAdd.Clicked += (sender, e) => ViewModel.Add();
buttonShare = new UIBarButtonItem("Share", UIBarButtonItemStyle.Bordered, (s, e) => ViewModel.Share());
+ NavigationItem.RightBarButtonItem = buttonEdit;
+
SetToolbarItems(new UIBarButtonItem[]
{
buttonShare,

0 comments on commit c7f3172

Please sign in to comment.
Something went wrong with that request. Please try again.