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); }