private void AddPhotos(PicasaWebAlbum album) { PicasaWebReader reader = null; WebProxy myProxy = CreateProxy(); var query = from photoRow in ((DataTable)this.mDatabase.Photo).AsEnumerable() where photoRow.Field<ulong>("AlbumId") == album.Id select photoRow; foreach (PhotoDataSet.PhotoRow photoRow in query) { try { photoRow.Keep = false; } catch { } } try { reader = new PicasaWebReader(this.mUserName, "WebAlbum",album.Id.ToString()/* album.AlbumName.Replace(" ", "")*/, myProxy,this.mToken); } catch (Exception e) { this.ev_ExceptionThrown(e, "Collecting photos from: " + album.AlbumName + " " + this.mUserName); if (reader != null) { reader.Dispose(); } reader = null; } string[] tags = this.mTag.Split(" ".ToCharArray()); List<PicasaWebPhoto> photos = null; foreach (string tag in tags) { photos = reader.QueryPhoto(tag); try { foreach (PicasaWebPhoto webphoto in photos) { this.CreatePhotoElement(webphoto, album); webphoto.Dispose(); } } catch (Exception ex) { this.ev_ExceptionThrown(ex, "Adding Photos to the data file"); if (reader != null) { reader.Dispose(); } reader = null; photos.Clear(); photos = null; } } if (reader != null) { reader.Dispose(); } reader = null; photos.Clear(); photos = null; }
private List<PicasaWebAlbum> GetWebAlbums(WebProxy myProxy) { List<PicasaWebAlbum> retval = new List<PicasaWebAlbum>(); var reader = new PicasaWebReader(this.mUserName, "WallpaperReader", myProxy,this.mToken); try { retval.AddRange(reader.QueryAlbums()); } catch (Exception e) { this.ev_ExceptionThrown(e, "Quering Albums. Album Access Error :" + e.Message); } finally { reader.Dispose(); reader = null; } return retval; }