Пример #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);
        }
Пример #2
0
        public PicasaAlbumCreateViewModel(INavigationService navigationService,
                                          IPhotoService<PicasaAlbum, PicasaMediaGroup> photoService)
        {
            _navigationService = navigationService;
            _photoService = photoService;

            NewAlbum = new PicasaAlbum() { Access = "public" }; //TODO: bind access from UI
        }