Beispiel #1
0
        public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
        {
            GroceryListClass toRemove = AppData.currentLists[indexPath.Row];

            AppData.currentLists.Remove(toRemove);
            ReadWrite.WriteData();
            tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
        }
Beispiel #2
0
        private void NewListSave(string inpListName)
        {
            GroceryListClass newList = new GroceryListClass
            {
                Name  = inpListName,
                Items = new List <ItemClass>(),
                Owner = AppData.curUser
            };

            AppData.currentLists.Add(newList);
            groceryAdapter.NotifyDataSetChanged();
        }
Beispiel #3
0
        void NewListSave(string inpListName)
        {
            GroceryListClass newList = new GroceryListClass()
            {
                Name  = inpListName,
                Owner = AppData.curUser,
                Items = new List <ItemClass>()
            };

            AppData.currentLists.Add(newList);
            ReadWrite.WriteData();
            groceryAdapter.NotifyDataSetChanged();
        }
        void SaveAction(string inpListName)
        {
            GroceryListClass newList = new GroceryListClass()
            {
                Name  = inpListName,
                Owner = AppData.curUser,
                Items = new List <ItemClass>()
            };

            AppData.currentLists.Add(newList);
            ReadWrite.WriteData();

            groceryListTableView.ReloadData();
        }
Beispiel #5
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = tableView.DequeueReusableCell("listsCell");

            GroceryListClass thisList = AppData.currentLists[indexPath.Row];

            cell.TextLabel.Text = thisList.Name;
            string sub = thisList.Items.Count.ToString() + " items for " +
                         thisList.Owner.Name;

            cell.DetailTextLabel.Text = sub;

            return(cell);
        }
Beispiel #6
0
        void DeleteList(GroceryListClass inputList, AdapterView.ItemClickEventArgs e)
        {
            e.View.Animate()
            .SetDuration(750)
            .Alpha(0)
            .WithEndAction(new Runnable(() =>
            {
                AppData.currentLists.Remove(inputList);
                ReadWrite.WriteData();
                groceryAdapter.NotifyDataSetChanged();

                e.View.Alpha = 1;
            }));
        }
Beispiel #7
0
        void DeleteListAlert(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            GroceryListClass toRemove = AppData.currentLists[e.Position];

            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle("Confirm Delete?");
            alert.SetMessage("Are you sure you want to delete this list?");
            alert.SetPositiveButton("Delete", (senderAlert, eAlert) => DeleteList(toRemove, e));
            alert.SetNegativeButton("Cancel", (senderAlert, eAlert) => { });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
Beispiel #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ItemsLayout);

            InterfaceBuilder();

            AppData.GetInstance();

            int row = this.Intent.Extras.GetInt("row");

            curList = AppData.currentLists[row];
            curListNameTextView.Text = curList.Name;

            itemsAdapter          = new ItemRowListAdapter(this, curList);
            itemsListView.Adapter = itemsAdapter;
        }
Beispiel #9
0
 public ItemsDataSource(GroceryListClass inpList)
 {
     thisList = inpList;
 }
Beispiel #10
0
 public ItemRowListAdapter(Activity context, GroceryListClass inpList) : base()
 {
     this.myContext = context;
     this.thisList  = inpList;
 }