public override string TitleForDeleteConfirmation(UITableView tableView, NSIndexPath indexPath) { ChatListClass toRemove = AppData.currentLST[indexPath.Row]; if (toRemove.ChatOwner.Uid == AppData.curUser.Uid) { return("Delete"); } else { return("Remove"); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("chatsCell"); ChatListClass thisList = AppData.currentLST[indexPath.Row]; cell.TextLabel.Text = thisList.ChatName; string subText = "Owner: " + thisList.ChatOwner.Name; cell.DetailTextLabel.Text = subText; return(cell); }
void SaveNewChat(string inputNewChatName) { ChatListClass newChat = new ChatListClass { ChatName = inputNewChatName, ChatOwner = AppData.curUser, ChatItems = new List <MessageClass>() }; AppData.currentLST.Add(newChat); ReadWriteDisk.WriteData(); SaveListOnCloud.Save(newChat); chatsTableView.ReloadData(); }
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); }