private void GetIDs() { var IDs = System.IO.File.ReadAllLines("IDs.txt"); foreach (var x in IDs) { ListOfIDs.Add(x); } }
private void GetSavedPhotos() { var details = new PhotoGetParams { Extended = true, AlbumId = PhotoAlbumType.Saved, Count = 50, Reversed = true, OwnerId = UserId, Offset = (ulong)_offset }; VkCollection <Photo> collection; try { collection = api.Photo.Get(details); if (ListOfIDs.Contains(UserId.ToString()) == false) { ListOfIDs.Add(UserId.ToString()); System.IO.File.AppendAllText("IDs.txt", _userid + Environment.NewLine); } } catch (Exception exception) { CustomMessageBox.Show("Loading error", exception.Message); return; } foreach (var elm in collection) { bool islike = elm.Likes.UserLikes; photoList.Add(new SavedPhoto(QualityControl(new[] { elm.Photo75, elm.Photo130, elm.Photo604, elm.Photo807, elm.Photo1280, elm.Photo2560 }), (DateTime)elm.CreateTime, elm.Likes.Count, (long)elm.Id, islike)); //photoList.Add(new SavedPhoto(QualityControl(new[] { elm.Photo75, elm.Photo130, elm.Photo604, elm.Photo807, elm.Photo1280, elm.Photo2560 }), Convert.ToString(elm.CreateTime), elm.Likes.Count, (long)elm.Id, islike)); } if (photoList.Count == 0) { CustomMessageBox.Show("Load exception", "This account has no saved photos"); return; } _offset += 50; // changing offset for next loads if (photoList.Count <= 50) { Photo = new BitmapImage(photoList[0].Link); GetAdditionalInfo(_currentPhotoId); } else { CurrentPhoto = $"{_currentPhotoId + 1} / {photoList.Count}"; } DateStart = photoList[photoList.Count - 1].Date; DateEnd = photoList[0].Date; }