/// <summary> /// Обновление списка картинок на вьюхе /// </summary> private void UpdatePictures() { Pictures = _picturesManager.Pictures; OnPropertyChanged("Pictures"); if (Pictures != null) { SelectedItem = Pictures.FirstOrDefault(); } }
private void OnPictureNameChanged(PictureNameChangePayload payload) { var changedPicture = Pictures.FirstOrDefault(pic => pic.Guid == payload.Guid); if (changedPicture != null) { changedPicture.FullFileName = $"{changedPicture.FolderPath}\\{payload.NewPictureName}{changedPicture.FileExtension}"; } _eventAggregator.GetEvent <PictureNameChangedEvent>().Unsubscribe(OnPictureNameChanged); }
public void DetachPicture(Guid pictureId) { var picture = Pictures.FirstOrDefault(x => x.PictureId.Equals(pictureId)); if (picture is null) { throw new NotFoundDomainException("Picture does not exist!"); } Pictures.Remove(picture); var @event = new ProductPictureRemovedDomainEvent(Id, picture.PictureId); AddDomainEvent(@event); }
public void RemovePicture(Guid id) { if (Pictures == null || Pictures.Any()) { throw SheaftException.NotFound("Cet utilisateur ne contient aucune images."); } var existingPicture = Pictures.FirstOrDefault(p => p.Id == id); if (existingPicture == null) { throw SheaftException.NotFound("L'image est introuvable."); } Pictures.Remove(existingPicture); PicturesCount = Pictures?.Count ?? 0; }
public void DeletePictures(ICollection <int> aPictureIdCollection) { if (Pictures != null && Pictures.Count > 0) { if (aPictureIdCollection != null && aPictureIdCollection.Count > 0) { foreach (var item in aPictureIdCollection) { var removeItem = Pictures.FirstOrDefault(p => p.UId == item); if (removeItem != null) { Pictures.Remove(removeItem); } } } } }
public void AddOrUpdatePictures(ICollection <Picture> aPictureCollection) { if (aPictureCollection != null && aPictureCollection.Count > 0) { foreach (var item in aPictureCollection) { var existItem = Pictures.FirstOrDefault(p => p.UId == item.UId); if (existItem == null) { Pictures.Add(item); } else { existItem.Update(item.PictureId, item.UseType); } } } }
Picture FindPicture(PictureId id) => Pictures.FirstOrDefault(x => x.Id == id);
public Picture FindPicture(Guid id) => Pictures.FirstOrDefault(x => x.Id == id);
public Picture GetPict(int IdPict) { return(Pictures.FirstOrDefault(p => p.Id == IdPict)); }