Beispiel #1
0
        public static List<PhotoAlbumInfo> ParseFacebookPhotoAlbumsResponse(string responseStr)
        {
            List<PhotoAlbumInfo> toReturn = new List<PhotoAlbumInfo>();

            if (!string.IsNullOrEmpty(responseStr))
            {

                JsonValue responseJson = JsonValue.Parse(responseStr);
                if (responseJson.ContainsKey("data"))
                {

                    JsonArray albumArr = (JsonArray)responseJson ["data"];
                    if (albumArr.Count > 0)
                    {

                        for (int i = 0; i < albumArr.Count; i++)
                        {

                            string id = albumArr [i].ContainsKey("id") ? (string)albumArr [i] ["id"] : string.Empty;
                            string name = albumArr [i].ContainsKey("name") ? (string)albumArr [i] ["name"] : string.Empty;

                            int itemCount = 0;
                            if (albumArr [i].ContainsKey("count"))
                            {

                                try
                                {

                                    itemCount = (int)albumArr [i] ["count"];

                                } catch (Exception ex)
                                {
            #if(DEBUG)
                                    Console.WriteLine("Could not get item count for album: {0} Message: {1}--{2}", name, ex.Message, ex.StackTrace);
            #endif
                                }//end try catch

                            }//end if

                            PhotoAlbumInfo albumInfoItem = new PhotoAlbumInfo(id, name, itemCount);
                            toReturn.Add(albumInfoItem);

                        }//end for

                    }//end if
                }//end if
            }//end if

            return toReturn;
        }
 private void handleClick(PhotoAlbumInfo photoAlbum)
 {
     /*RunOnUiThread (delegate {
         PhotoPicker picker = new PhotoPicker (photoAlbum, Provider, context);
     });*/
     PhotoPickerUtil.albumInfo = photoAlbum;
     PhotoPickerUtil.Provider = Provider;
     Intent i = new Intent (this, typeof(PhotoPickerActivity));
     StartActivityForResult (i, PHOTO_PICK);
     #if DEBUG
     System.Diagnostics.Debug.WriteLine ("moooooo!");
     #endif
 }