public void Delete() { if (CurrentItem == null) { return; } if (DialogDetails == null) { return; } var currentItem = CurrentItem; DialogDetails.DeleteMessageById( currentItem, () => { Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.1), () => { if (CanSlideRight) { var view = GetView() as ImageViewerView; if (view != null) { _items.RemoveAt(_currentIndex--); view.SlideRight(0.0, () => { view.SetControlContent(2, NextItem); GroupedItems.Remove(currentItem); }); } } else if (CanSlideLeft) { var view = GetView() as ImageViewerView; if (view != null) { _items.RemoveAt(_currentIndex); view.SlideLeft(0.0, () => { view.SetControlContent(0, PreviousItem); GroupedItems.Remove(currentItem); }); } } else { Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), CloseViewer); } }); }); }
public void DeletePhoto() { if (_currentContact == null || !_currentContact.IsSelf) { return; } if (CurrentItem == null) { return; } var currentItem = CurrentItem; IsWorking = true; MTProtoService.UpdateProfilePhotoAsync(new TLInputPhotoEmpty(), result => { Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.1), () => { IsWorking = false; if (CanSlideLeft) { var view = GetView() as ProfilePhotoViewerView; if (view != null) { _items.RemoveAt(_currentIndex--); view.SlideLeft(0.0, () => { view.SetControlContent(0, PreviousItem); GroupedItems.Remove(currentItem); }); } } else { Execute.BeginOnUIThread(TimeSpan.FromSeconds(0.25), CloseViewer); } }); }, error => { IsWorking = false; Execute.ShowDebugMessage("photos.updateProfilePhoto error " + error); }); }
private void OnItemRemovedImpl(T item) { (TGroupedItem currentGroupedItem, _) = GetGroupedItemByKey(item); if (currentGroupedItem != null) { if (currentGroupedItem.Contains(item) && currentGroupedItem.Count == 1) { GroupedItems.Remove(currentGroupedItem); } currentGroupedItem.Remove(item); } if (IsPostNotifiable) { (item as INotifyPropertyChanged).PropertyChanged -= CollectionGrouper_PropertyChanged; } }