public void NumPhotosRemainingTest()
 {
     PicasaEntry entry = new AlbumEntry(); 
     AlbumAccessor target = new AlbumAccessor(entry); 
     uint expected = 4; // TODO: Initialize to an appropriate value
     uint actual;
     target.NumPhotosRemaining = expected;
     actual = target.NumPhotosRemaining;
     Assert.AreEqual(expected, actual);
 }
Example #2
0
        public string CreateAlbum(string name, bool isBackup = false)
        {
            PicasaService service = InitPicasaService();

            AlbumEntry newEntry = new AlbumEntry();

            newEntry.Title.Text = name + (isBackup ? "B" : "");
            newEntry.Summary.Text = newEntry.Title.Text;

            Uri feedUri = new Uri(PicasaQuery.CreatePicasaUri(OAMSSetting.GoogleUsername));

            PicasaEntry createdEntry = (PicasaEntry)service.Insert(feedUri, newEntry);

            //5507469898148065681
            return createdEntry.EditUri.Content;
            //return createdEntry.Id.AbsoluteUri;
        }
        private void Ok_Click(object sender, System.EventArgs e)
        {
            AlbumEntry entry = new AlbumEntry();
            AlbumAccessor acc = new AlbumAccessor(entry);
            entry.Title.Text = this.AlbumName.Text;
            entry.Summary.Text = this.AlbumDescription.Text;
            if (this.AlbumLocation.Text.Length > 0) 
            {
                acc.Location = this.AlbumLocation.Text;
            }
            if (this.AlbumKeywords.Text.Length > 0) 
            {
                entry.Media = new MediaGroup();
                MediaKeywords keywords = new MediaKeywords(this.AlbumKeywords.Text);
                entry.Media.Keywords = keywords;
            }
            acc.Access = this.AlbumPublic.Checked ? "public" : "private";
            acc.CommentingEnabled = this.AllowComments.Checked;

            this.newEntry = this.service.Insert(this.feed, entry); 
            this.Close();

        }
Example #4
0
 public void AlbumEntryConstructorTest()
 {
     AlbumEntry target = new AlbumEntry();
     Assert.IsNotNull(target);
 }
        private Album CreateAlbum(PicasaService session, PicasaFeed albumFeed, string targetAlbumName, AlbumAccessEnum albumAccess)
        {
            //create album (doesn't exist)
            WriteOutput(string.Concat("Creating Album: ", targetAlbumName), true);
            AlbumEntry newAlbumEntry = new AlbumEntry();
            newAlbumEntry.Title.Text = targetAlbumName;
            newAlbumEntry.Summary.Text = targetAlbumName;
            newAlbumEntry.Published = DateTime.Now;

            Album newAlbum = new Album();
            newAlbum.AtomEntry = newAlbumEntry;
            newAlbum.Access = albumAccess.ToString().ToLower();

            Uri insertAlbumFeedUri = new Uri(PicasaQuery.CreatePicasaUri(this.PicasaUsername));
            newAlbum.AtomEntry = (PicasaEntry)session.Insert(insertAlbumFeedUri, newAlbumEntry);
            m_albumCreateCount++;

            return newAlbum;
        }
 public void AlbumAccessorConstructorTest()
 {
     PicasaEntry entry = new AlbumEntry();
     AlbumAccessor target = new AlbumAccessor(entry);
     Assert.IsNotNull(target);
 }
 public void AccessTest()
 {
     PicasaEntry entry = new AlbumEntry();
     AlbumAccessor target = new AlbumAccessor(entry);
     string expected = "TestValue"; 
     string actual;
     target.Access = expected;
     actual = target.Access;
     Assert.AreEqual(expected, actual);
 }
 public void BytesUsedTest()
 {
     PicasaEntry entry = new AlbumEntry();
     AlbumAccessor target = new AlbumAccessor(entry);
     uint expected = 12; // TODO: Initialize to an appropriate value
     uint actual;
     target.BytesUsed = expected;
     actual = target.BytesUsed;
     Assert.AreEqual(expected, actual);
 }
 public void CommentingEnabledTest()
 {
     PicasaEntry entry = new AlbumEntry();
     AlbumAccessor target = new AlbumAccessor(entry);
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     target.CommentingEnabled = expected;
     actual = target.CommentingEnabled;
     Assert.AreEqual(expected, actual);
 }
 public void LatitudeTest()
 {
     PicasaEntry entry = new AlbumEntry();
     AlbumAccessor target = new AlbumAccessor(entry);
     double expected = 0F; // TODO: Initialize to an appropriate value
     double actual;
     target.Latitude = expected;
     actual = target.Latitude;
     Assert.AreEqual(expected, actual);
 }
Example #11
0
 private bool createNewAlbum(string albumName, string desc, DateTime albumDate)
 {
     if(!checkAlbumExists(albumName))
     {
         try
         {
             Uri feedUri = new Uri(this.picasaFeed.Post);
             AlbumEntry newEntry = new AlbumEntry();
             newEntry.Title.Text = albumName;
             newEntry.Summary.Text = desc;
             double timestamp = ConvertToUnixTimestamp(albumDate.ToUniversalTime());
             newEntry.setPhotoExtension("timestamp", timestamp.ToString());
             PicasaEntry createdEntry = (PicasaEntry)picasaService.Insert(feedUri, newEntry);
             return false;
         }
         catch (Exception)
         {
             return true;
         }
     }
     return false;
 }
        protected void lbtnThemAlbum_Click(object sender, EventArgs e)
        {
            AlbumEntry newEntry = new AlbumEntry();

            currentAlbum = new AlbumAccessor(newEntry);
            switch (DropDownListAccess.SelectedIndex)
            {
                case 0:
                    currentAlbum.Access = "public";
                    break;
                case 1:
                    currentAlbum.Access = "private";
                    break;
                case 2:
                    currentAlbum.Access = "protected";
                    break;
            }
            newEntry.Title.Text = txtalbumtitle.Text;
            newEntry.Summary.Text = txtmieuta.Text;
            currentAlbum.AlbumAuthor = listAlbum[0].AlbumAuthor;
            currentAlbum.AlbumAuthorNickname = listAlbum[0].AlbumAuthorNickname;

            Uri feedUri = new Uri(PicasaQuery.CreatePicasaUri("*****@*****.**"));
            PicasaEntry createdEntry = (PicasaEntry)service.Insert(feedUri, newEntry);

            Response.Redirect("Album.aspx");
        }
        public AlbumAccessor CreateAlbum(string title, string description = null, bool isPublic = false)
        {
            var service = GetPicasaService();

            AlbumEntry newEntry = new AlbumEntry();
            newEntry.Title.Text = title;
            if (description!=null)
                newEntry.Summary.Text = description;
            AlbumAccessor ac = new AlbumAccessor(newEntry);

            //set to "private" for a private album
            if (isPublic)
                ac.Access = "public";
            else
                ac.Access = "unlisted";

            Uri feedUri = new Uri(PicasaQuery.CreatePicasaUri("default"));

            PicasaEntry createdEntry;
            try
            {
                createdEntry = (PicasaEntry)service.Insert(feedUri, newEntry);
            }
            catch
            {
                //If a first error. Try recreate service 
                service = GetPicasaService(true);
                createdEntry = (PicasaEntry)service.Insert(feedUri, newEntry);
            }
            return new AlbumAccessor(createdEntry); 
        }