コード例 #1
0
        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);
        }
コード例 #2
0
        private int Update(DateTime lastUpdated)
        {
            PicasaWebReader reader  = null;
            WebProxy        myProxy = CreateProxy();
            var             albums  = GetWebAlbums(myProxy);

            GetWebAlbumPhotos(albums, lastUpdated);

            TidyUp();

            if (reader != null)
            {
                reader.Dispose();
            }
            reader = null;

            int numberOfPhotos = this.mDatabase.Photo.Count;

            //database.LoadXml(photoDoc.OuterXml);

            return(numberOfPhotos);
        }
コード例 #3
0
        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;
        }