private void ReadPhotosOrDocuments(List <PhotoOrDocument> photosOrDocuments)
 {
     ((Collection <PhotoViewModel>) this._photosCollection).Clear();
     List <PhotoOrDocument> .Enumerator enumerator = photosOrDocuments.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             PhotoOrDocument current        = enumerator.Current;
             PhotoViewModel  photoViewModel = null;
             if (current.photo != null)
             {
                 photoViewModel = new PhotoViewModel(current.photo, null);
             }
             else if (current.document != null)
             {
                 photoViewModel = new PhotoViewModel(current.document);
             }
             if (photoViewModel != null)
             {
                 ((Collection <PhotoViewModel>) this._photosCollection).Add(photoViewModel);
             }
         }
     }
     finally
     {
         enumerator.Dispose();
     }
 }
 public void LoadPhotosFromFeed(Action <bool> callback)
 {
     if (this._isLoading)
     {
         return;
     }
     this._isLoading = true;
     PhotosService.Current.GetPhotos(this._userOrGroupId, this._isGroup, this._aid, null, (long)this._date, this._mode == ViewerMode.Photos ? "photo" : "photo_tag", (Action <BackendResult <List <Photo>, ResultCode> >)(res =>
     {
         this._isLoading = false;
         if (res.ResultCode == ResultCode.Succeeded)
         {
             Execute.ExecuteOnUIThread((Action)(() =>
             {
                 int num;
                 for (int i = 0; i < res.ResultData.Count; i = num + 1)
                 {
                     PhotoViewModel photoViewModel = (PhotoViewModel)Enumerable.FirstOrDefault <PhotoViewModel>(this.PhotosCollection, (Func <PhotoViewModel, bool>)(p =>
                     {
                         if (p.Photo != null)
                         {
                             return(p.Photo.pid == res.ResultData[i].pid);
                         }
                         return(false);
                     }));
                     if (photoViewModel != null)
                     {
                         ((Collection <PhotoViewModel>) this.PhotosCollection)[((Collection <PhotoViewModel>) this.PhotosCollection).IndexOf(photoViewModel)].Photo = res.ResultData[i];
                     }
                     else
                     {
                         ((Collection <PhotoViewModel>) this.PhotosCollection).Add(new PhotoViewModel(res.ResultData[i], null));
                     }
                     num = i;
                 }
                 if (this._photosCount < ((Collection <PhotoViewModel>) this.PhotosCollection).Count)
                 {
                     this._photosCount = ((Collection <PhotoViewModel>) this.PhotosCollection).Count;
                 }
                 callback(true);
             }));
         }
         else
         {
             callback(false);
         }
     }));
 }