コード例 #1
0
 public override bool ShouldHideUtilityButtonsOnSwipe(SWTableViewCell cell)
 {
     return true;
 }
コード例 #2
0
        public override async void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index)
        {
            //make sure the first button is tapped.  We only have one, but you never know
            if (index == 0)
            {
                var filePath = ((PicturePreviewCell)cell).FilePath;
                //validate that the filePath isn't empty
                if (!string.IsNullOrEmpty(filePath))
                {
                    //confirm via UIAlert to delete
                    var isDelete = await Helper.Utility.ShowAlert(_lookupService.GetLocalizedString("Confirm"),  _lookupService.GetLocalizedString("DeleteFileMessage"), _lookupService.GetLocalizedString("Delete"), _lookupService.GetLocalizedString("Cancel"));
                    if (isDelete)
                    {
                        //delete the file and reload the table
                        _fileHelper.Delete(filePath);
                        _controller.Files.Remove(filePath);

                        //reload the table data without the file in it
                        _tableView.ReloadData();
                    }
                    else
                    {
                        cell.HideUtilityButtons(true);
                    }
                }
               
            }
        }