Ejemplo n.º 1
0
        void DeleteList(GroceryListClass inputList, AdapterView.ItemLongClickEventArgs e)
        {
            e.View.Animate()
            .SetDuration(750)
            .Alpha(0)
            .WithEndAction(new Runnable(() =>
            {
                //local list delete
                AppData.currentLists.Remove(inputList);

                if (inputList.Owner.Uid == AppData.currentUser.Uid)
                {
                    //deleting list from cloud
                    DeleteListFromCloud.Delete(inputList);
                    ReadWrite.WriteData();
                }
                else    // if its not the current users list
                {
                    InvitationClass thisInvite = new InvitationClass()
                    {
                        Name  = inputList.Name,
                        Owner = inputList.Owner
                    };
                    RemoveInvitation.Remove(thisInvite);
                }

                groceryAdapter.NotifyDataSetChanged();

                e.View.Alpha = 1;
            }));
        }
Ejemplo n.º 2
0
        public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
        {
            ChatListClass toRemove = AppData.currentLST[indexPath.Row];

            AppData.currentLST.Remove(toRemove);

            if (toRemove.ChatOwner.Uid == AppData.curUser.Uid)
            {
                ReadWriteDisk.WriteData();
                DeleteListFromCloud.Delete(toRemove);
            }
            else
            {
                InvitationClass thisInvitation = new InvitationClass
                {
                    ChatName  = toRemove.ChatName,
                    ChatOwner = toRemove.ChatOwner
                };
                RemoveInvitation.Remove(thisInvitation);
            }

            tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
        }