public void GeneratePagesForStickers(Sticker[] stickers) { stickers.ToLinkedList().ForEach(x => x.DetachParent()); if (Pages != null) { Pages.ToLinkedList().ForEach(x => x.Clear()); } var pagesList = new LinkedList <AlbumPage>(); var pagesCount = Math.Ceiling(stickers.Length / 6d); var stickersList = stickers.ToLinkedList(); for (var i = 0; i < pagesCount; i++) { pagesList.Add(new AlbumPage( stickersList.Skip(i * 6).Take(6).ToArray() )); } this.Pages = pagesList.ToArray(); this.AlbumArea.Children.Clear(); this.CurrentPage = null; if (Pages.Length > 0) { this.CurrentPage = Pages[0]; this.AlbumArea.Children.Add(this.CurrentPage); } }
public Boolean SetPage(AlbumPage page) { if (page == null) { return(false); } this.CurrentPage = page; this.AlbumArea.Children.Clear(); this.AlbumArea.Children.Add(page); SoundPlayer.Instance.Play(SoundTrack.Get("sfx_pageturn")); return(true); }