private void SetToLast(IAlbumPicture ial) { if (ial == null) return; int Index = Images.IndexOf(ial); if (Index == -1) return; Images.Move(Index, Images.Count - 1); }
private void SetToFront(IAlbumPicture ial) { if (ial == null) return; int Index = Images.IndexOf(ial); if (Index == -1) return; Images.Move(Index, 0); }
private void DoDeleteImage(IAlbumPicture ifal) { foreach (IAlbumPicture ial in GetImages(ifal)) { int Index = Images.IndexOf(ial); if (Index == -1) return; _IModifiableAlbum.Images.RemoveAt(Index); int count = _IModifiableAlbum.Images.Count; if (count > 0) { int imaindex = Math.Min(Math.Max(Index--, 0), count - 1); SelectedImage = _IModifiableAlbum.Images[imaindex]; } } }
private void DoRotateImage(IAlbumPicture ifal,bool irigth) { Images.CollectionChanged -= Images_CollectionChanged; foreach (IAlbumPicture ial in GetImages(ifal)) { int Index = Images.IndexOf(ial); if (Index == -1) return; SelectedImages.Add(_IModifiableAlbum.RotateImage(Index, irigth)); } Images.CollectionChanged += Images_CollectionChanged; }
private void DoSplitImage(IAlbumPicture ifal) { Images.CollectionChanged -= Images_CollectionChanged; foreach(IAlbumPicture ial in GetImages(ifal)) { int Index = Images.IndexOf(ial); if (Index == -1) continue; SelectedImages.AddCollection(_IModifiableAlbum.SplitImage(Index).Where(el=>!SelectedImages.Contains(el))); } Images.CollectionChanged += Images_CollectionChanged; }
private IEnumerable<IAlbumPicture> GetImages(IAlbumPicture icontext) { if (icontext == null) return Enumerable.Empty<IAlbumPicture>(); return SelectedImages.Contains(icontext) ? SelectedImages.ToList() : icontext.SingleItemCollection(); }