public List <string> QueryTag(PicasaWebPhoto photo)
        {
            List <string> retval = new List <string>();

            this.m_tagQuery   = new TagQuery(TagQuery.CreatePicasaUri(this.m_userName, this.m_albumName, photo.AccessId));
            this.m_tagService = new PicasaService("Tags");
            //this.m_tagService.setUserCredentials(this.m_userName, this.m_password);
            this.m_tagService.SetAuthenticationToken(this.mUserToken);
            CreateTagProxy();
            try
            {
                this.m_tagFeed = this.m_tagService.Query(this.m_tagQuery);

                foreach (PicasaEntry entry in m_tagFeed.Entries)
                {
                    retval.Add(entry.Title.Text);
                }
            }
            catch (Exception e)
            {
                this.m_tagQuery = null;
                this.m_tagService.RequestFactory = null;
                this.m_tagService = null;
                this.m_tagFeed    = null;
                throw new Exception("Query Tag Exception", e);
            }


            this.m_tagQuery = null;
            this.m_tagService.RequestFactory = null;
            this.m_tagService = null;
            this.m_tagFeed    = null;
            return(retval);
        }
        public List <string> QueryTag(PicasaWebPhoto photo, BackgroundWorker worker, int overallJobPercent)
        {
            List <string> retval = new List <string>();

            this.m_tagQuery   = new TagQuery(TagQuery.CreatePicasaUri(this.m_userName, this.m_albumName, photo.AccessId));
            this.m_tagService = new PicasaService("Tags");
            //this.m_tagService.setUserCredentials(this.m_userName, this.m_password);
            this.m_tagService.SetAuthenticationToken(this.mUserToken);
            decimal count      = ((decimal)overallJobPercent / 100) * 10;
            int     smallCount = (int)count;

            worker.ReportProgress(0, (object)"Creating proxy");
            CreateTagProxy();
            try
            {
                worker.ReportProgress(smallCount, (object)"Proxy created");
                worker.ReportProgress(0, (object)"Querying google");
                this.m_tagFeed = this.m_tagService.Query(this.m_tagQuery);
                worker.ReportProgress(smallCount, (object)"Done");
                if (this.m_tagFeed.Entries.Count > 0)
                {
                    int percent = (int)Math.Round((decimal)((overallJobPercent - (smallCount * 2)) / this.m_tagFeed.Entries.Count), 0);
                    worker.ReportProgress(0, (object)"Processing tag data");
                    foreach (PicasaEntry entry in m_tagFeed.Entries)
                    {
                        retval.Add(entry.Title.Text);
                        worker.ReportProgress(percent, null);
                    }
                }
            }
            catch (Exception e)
            {
                this.m_tagQuery = null;
                this.m_tagService.RequestFactory = null;
                this.m_tagService = null;
                this.m_tagFeed    = null;
                throw new Exception("Query Tag Exception", e);
            }


            this.m_tagQuery = null;
            this.m_tagService.RequestFactory = null;
            this.m_tagService = null;
            this.m_tagFeed    = null;
            return(retval);
        }
        public List<string> QueryTag(PicasaWebPhoto photo)
        {
            List<string> retval = new List<string>();
            this.m_tagQuery = new TagQuery(TagQuery.CreatePicasaUri(this.m_userName, this.m_albumName, photo.AccessId));
            this.m_tagService = new PicasaService("Tags");
            //this.m_tagService.setUserCredentials(this.m_userName, this.m_password);
            this.m_tagService.SetAuthenticationToken(this.mUserToken);
            CreateTagProxy();
            try
            {
                this.m_tagFeed = this.m_tagService.Query(this.m_tagQuery);

                foreach (PicasaEntry entry in m_tagFeed.Entries)
                {
                    retval.Add(entry.Title.Text);
                }
            }
            catch (Exception e)
            {
                this.m_tagQuery = null;
                this.m_tagService.RequestFactory = null;
                this.m_tagService = null;
                this.m_tagFeed = null;
                throw new Exception("Query Tag Exception", e);

            }


            this.m_tagQuery = null;
            this.m_tagService.RequestFactory = null;
            this.m_tagService = null;
            this.m_tagFeed = null;
            return retval;

        }
        public List<string> QueryTag(PicasaWebPhoto photo, BackgroundWorker worker, int overallJobPercent)
        {
            List<string> retval = new List<string>();
            this.m_tagQuery = new TagQuery(TagQuery.CreatePicasaUri(this.m_userName, this.m_albumName, photo.AccessId));
            this.m_tagService = new PicasaService("Tags");
            //this.m_tagService.setUserCredentials(this.m_userName, this.m_password);
            this.m_tagService.SetAuthenticationToken(this.mUserToken);
            decimal count = ((decimal)overallJobPercent / 100) * 10;
            int smallCount = (int)count;
            worker.ReportProgress(0, (object)"Creating proxy");
            CreateTagProxy();
            try
            {
                worker.ReportProgress(smallCount, (object)"Proxy created");
                worker.ReportProgress(0, (object)"Querying google");
                this.m_tagFeed = this.m_tagService.Query(this.m_tagQuery);
                worker.ReportProgress(smallCount, (object)"Done");
                if (this.m_tagFeed.Entries.Count > 0)
                {
                    int percent = (int)Math.Round((decimal)((overallJobPercent - (smallCount * 2)) / this.m_tagFeed.Entries.Count), 0);
                    worker.ReportProgress(0, (object)"Processing tag data");
                    foreach (PicasaEntry entry in m_tagFeed.Entries)
                    {
                        retval.Add(entry.Title.Text);
                        worker.ReportProgress(percent, null);
                    }
                }
            }
            catch (Exception e)
            {
                this.m_tagQuery = null;
                this.m_tagService.RequestFactory = null;
                this.m_tagService = null;
                this.m_tagFeed = null;
                throw new Exception("Query Tag Exception", e);

            }


            this.m_tagQuery = null;
            this.m_tagService.RequestFactory = null;
            this.m_tagService = null;
            this.m_tagFeed = null;
            return retval;
        }
Ejemplo n.º 5
0
 private void CreatePhotoElement(PicasaWebPhoto photo,PicasaWebAlbum album)
 {
     bool update = false;
     var query = from photoRow in ((DataTable)this.mDatabase.Photo).AsEnumerable() 
                 where photoRow.Field<string>("ID") == photo.Id 
                 select photoRow;
     foreach (PhotoDataSet.PhotoRow photoRow in query)
     {
         if(photoRow.PhotoID != Convert.ToUInt64(photo.AccessId))
             photoRow.PhotoID = Convert.ToUInt64(photo.AccessId);
         if(photoRow.Title != photo.Title)
             photoRow.Title = photo.Title;
         if(photoRow.Album != photo.AlbumName)
             photoRow.Album = photo.AlbumName;
         if(photoRow.Height != Convert.ToUInt16(photo.Height))
             photoRow.Height = Convert.ToUInt16(photo.Height);
         if(photoRow.Width != Convert.ToUInt16(photo.Width.ToString()))
             photoRow.Width = Convert.ToUInt16(photo.Width.ToString());
         if(photoRow.Uploaded!= photo.Uploaded)
             photoRow.Uploaded= photo.Uploaded;
         if(photoRow.Location != photo.Location)
             photoRow.Location = photo.Location;
         photoRow.Keep = true;
         update = true;
     }
     if(!update)
         this.mDatabase.Photo.AddPhotoRow(photo.Id, Convert.ToUInt64(photo.AccessId), photo.Title, photo.AlbumName, Convert.ToUInt16(photo.Height), Convert.ToUInt16(photo.Width.ToString()), photo.Uploaded, photo.Location,true,album.Id);
 }