Beispiel #1
0
        public void CreateAlbum(PicasaAlbum album, StringResultCallback callback)
        {
            album.User = ACCOUNT;

            XmlSerializer serializer = new XmlSerializer(typeof(PicasaAlbum));
            MemoryStream  stream     = new MemoryStream();

            serializer.Serialize(stream, album);
            stream.Position = 0;
            StreamReader reader       = new StreamReader(stream);
            var          albumXMLbody = reader.ReadToEnd();

            WebClient client = new WebClient();
            string    url    = String.Format(ALBUM_CREATE_FEED, ACCOUNT);

            SetAuthHeaders(client);
            client.Headers[HttpRequestHeader.ContentType] = "application/atom+xml";

            client.UploadStringCompleted += (o, args) =>
            {
                if (args.Error == null)
                {
                    callback("200");
                }
                else
                {
                    callback("500");
                }
            };

            client.UploadStringAsync(new Uri(url), albumXMLbody);
        }
        public void HandleAlbumOptionMenuChanged(object sender, System.EventArgs args)
        {
            if (albums == null || albums.Count == 0)
            {
                return;
            }

            PicasaAlbum a = albums [album_optionmenu.Active];

            export_button.Sensitive = a.PicturesRemaining >= items.Length;
            if (album_status_label.Visible = !export_button.Sensitive)
            {
                StringBuilder sb = new StringBuilder("<small>");
                sb.Append(String.Format(Catalog.GetString("The selected album has a limit of {0} pictures,\n" +
                                                          "which would be passed with the current selection of {1} images"),
                                        a.PicturesCount + a.PicturesRemaining, items.Length));
                sb.Append("</small>");
                album_status_label.Text      = String.Format(sb.ToString());
                album_status_label.UseMarkup = true;
            }
            else
            {
                album_status_label.Text = String.Empty;
            }
        }
Beispiel #3
0
 public void OnSelectAlbum(PicasaAlbumListViewModel model)
 {
     if (model.SelectedAlbum != null)
     {
         PicasaAlbum album = model.SelectedAlbum;
         _navigationService.Navigate(UrlHelper.PicasaPhotoList(album.Id, album.Title));
     }
 }
Beispiel #4
0
        public PicasaAlbumCreateViewModel(INavigationService navigationService,
                                          IPhotoService <PicasaAlbum, PicasaMediaGroup> photoService)
        {
            _navigationService = navigationService;
            _photoService      = photoService;

            NewAlbum = new PicasaAlbum()
            {
                Access = "public"
            };                                                  //TODO: bind access from UI
        }
Beispiel #5
0
        private void get_album_thumbs_from_local(Object data)
        {
            StupidContainer stupid             = (StupidContainer)data;
            PicasaAlbum     album_to_upload_to = stupid.album;

            string[] filenames = stupid.filenames;

            /*string next_page = "";
             * next_page += "<html><head><title>";
             * next_page += "Photos to Upload";
             * next_page += "</title></head><body>";
             * next_page += "Photos to Upload"; ;
             * next_page += "</br>";*/
            foreach (string filename in filenames)
            {
                album_to_upload_to.UploadPicture(filename);

                //next_page += "<img width=\"100px\" src=\"";
                //next_page += filename;
                //next_page += "\"/>";
            }

            //albumPhotoBrowser.DocumentText = next_page;
            System.Console.WriteLine("Done uploading");

            string next_page = "";

            next_page += "<html><head><title>";
            next_page += "Upload results";
            next_page += "</title></head><body>";
            next_page += "Finished Uploading.";
            next_page += "</br>";
            next_page += "Album Name: " + album_to_upload_to.Title;
            next_page += "</br>";
            next_page += "Photos: ";
            next_page += "</br>";
            foreach (PicasaPicture pic in album_to_upload_to.GetPictures().AllValues)
            {
                next_page += "<img src=\"";
                next_page += pic.ThumbnailURL;
                next_page += "\"/>";
            }


            next_page += "</body></html>";

            albumPhotoBrowser.DocumentText = next_page;
        }
Beispiel #6
0
        public void DeleteAlbum(PicasaAlbum album)
        {
            var message = String.Format("Are you sure want to delete \"{0}\"?", album.Title);
            var confirm = MessageBox.Show(message, "Confirmation", MessageBoxButton.OKCancel);


            if (confirm == MessageBoxResult.OK)
            {
                //TODO: handle error
                _photoService.DeleteAlbum(album.Id, (result) =>
                {
                    AlbumList = new List <PicasaAlbum>(AlbumList);
                    AlbumList.Remove(album);
                    NotifyOfPropertyChange(() => AlbumList);
                });
            }
        }
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                Dialog.Destroy();
                return;
            }

            if (scale_check != null)
            {
                scale = scale_check.Active;
                size  = size_spin.ValueAsInt;
            }
            else
            {
                scale = false;
            }

            browser = browser_check.Active;
            rotate  = rotate_check.Active;
//			meta = meta_check.Active;
            export_tag = tag_check.Active;

            if (account != null)
            {
                //System.Console.WriteLine ("history = {0}", album_optionmenu.History);
                album       = (PicasaAlbum)account.Picasa.GetAlbums() [Math.Max(0, album_optionmenu.History)];
                photo_index = 0;

                Dialog.Destroy();

                command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(this.Upload));
                command_thread.Name = Catalog.GetString("Uploading Pictures");

                progress_dialog = new FSpot.ThreadProgressDialog(command_thread, items.Length);
                progress_dialog.Start();

                // Save these settings for next time
                Preferences.Set(SCALE_KEY, scale);
                Preferences.Set(SIZE_KEY, size);
                Preferences.Set(ROTATE_KEY, rotate);
                Preferences.Set(BROWSER_KEY, browser);
//				Preferences.Set (Preferences.EXPORT_GALLERY_META, meta);
                Preferences.Set(TAG_KEY, export_tag);
            }
        }
Beispiel #8
0
        private void populateDetails(PicasaAlbum album)
        {
            this.lblName.Text           = album.Title;
            this.txtBoxDescription.Text = album.Description;
            this.lblNumPictures.Text    = album.PicturesCount.ToString();

            if (AlbumAccess.Public == album.Access)
            {
                this.permissionData.Text = "Public";
            }
            else
            {
                this.permissionData.Text = "Private";
            }



            this.lblBytesUsed.Text = album.BytesUsed.ToString();
        }
Beispiel #9
0
        private void createNewAlbumToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == pam || false == pam.LoggedIn)
            {
                NotifyDialog please_login = new NotifyDialog();
                please_login.NotificationMessage = "Please login, then proceed to create new albums.";
                please_login.ShowDialog();
            }
            else
            {
                NewAlbumDialog nad = new NewAlbumDialog();

                nad.ShowDialog();

                if (nad.DialogResult == DialogResult.OK)
                {
                    PicasaWeb   picasa    = pam.getWeb();
                    PicasaAlbum unique_id = picasa.CreateAlbum(nad.AlbumTitle, nad.AlbumDescription, nad.AlbumAcessMode, nad.AlbumDate);
                }
            }
        }
Beispiel #10
0
        private void get_album_thumbs_from_picasa(Object data)
        {
            PicasaAlbum selected_album = (PicasaAlbum)data;

            PicasaPicture[] album_pics = selected_album.GetPictures().AllValues;
            string          next_page  = "";

            next_page += "<html><head><STYLE type=\"text/css\"><!--A { text-decoration:none }--></STYLE><title>";
            next_page += selected_album.Title;
            next_page += "</title></head><body>";
            next_page += selected_album.Title;
            next_page += "</br>";
            foreach (PicasaPicture pic in album_pics)
            {
                next_page += "<a href=\"" + pic.ImageURL + "\"> <img src=\"";
                next_page += pic.ThumbnailURL;
                next_page += "\"/></a>&nbsp;&nbsp;&nbsp;";
            }
            next_page += "</body></html>";
            albumPhotoBrowser.DocumentText = next_page;
        }
Beispiel #11
0
 public ActionResult Index()
 {
     return View(PicasaAlbum.GetAlbums());
 }