Example #1
0
        public override void SynchronizeImplementation(FlickrAlive alive)
        {
            var set    = alive.FlickrData.Sets.First(s => s.Title == AlbumTitle);
            var photos = alive.GetAllPhotos(set);
            List <PhotoInfo> photoInfos = new List <PhotoInfo>(photos.Count);

            foreach (var photo in photos)
            {
                photoInfos.Add(alive.FlickrInstance.PhotosGetInfo(photo.PhotoId));
            }
            var orderedPhotos = photoInfos.OrderBy(p => p.DateTaken);

            alive.FlickrInstance.PhotosetsReorderPhotos(set.PhotosetId, orderedPhotos.Select(p => p.PhotoId).ToArray());
        }
Example #2
0
        public override void SynchronizeImplementation(FlickrAlive alive)
        {
            var info = alive.FlickrInstance.PhotosGetInfo(photoId);

            using (var wc = new WebClient())
            {
                Action a = new Action(() =>
                {
                    wc.CancelAsync();
                });
                alive.CancelActions.Add(a);
                wc.DownloadFile(info.OriginalUrl, directoryPath + Constants.DelimiterInWindowsPath + info.Title + Constants.DelimiterExtension + info.OriginalFormat);
                alive.CancelActions.Remove(a);
            }
        }
Example #3
0
        public override void SynchronizeImplementation(FlickrAlive alive)
        {
            string photoId;

            using (FileStream fs = new FileStream(primaryPhotoPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                var    photoName = Path.GetFileNameWithoutExtension(primaryPhotoPath);
                Action a         = new Action(() =>
                {
                    fs.Close();
                });
                alive.CancelActions.Add(a);
                photoId = alive.FlickrInstance.UploadPicture(fs, photoName, photoName, null, null, false, false, false, ContentType.None, SafetyLevel.None, HiddenFromSearch.None);
                fs.Close();
                alive.CancelActions.Remove(a);
            }

            var set = alive.FlickrInstance.PhotosetsCreate(AlbumTitle, photoId);

            AlbumId = set.PhotosetId;
            PostAction?.Invoke();
        }
Example #4
0
        public override void SynchronizeImplementation(FlickrAlive alive)
        {
            string photoId;

            using (FileStream fs = new FileStream(photoPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                var    photoName = Path.GetFileNameWithoutExtension(photoPath);
                Action a         = new Action(() =>
                {
                    fs.Close();
                });
                alive.CancelActions.Add(a);
                photoId = alive.FlickrInstance.UploadPicture(fs, photoName, photoName, null, null, false, false, false, ContentType.None, SafetyLevel.None, HiddenFromSearch.None);
                alive.CancelActions.Remove(a);
                fs.Close();
            }

            if (string.IsNullOrEmpty(AlbumId))
            {
                throw new Exception("AlbumId is not specified.");
            }
            alive.FlickrInstance.PhotosetsAddPhoto(AlbumId, photoId);
        }
Example #5
0
 public override void SynchronizeImplementation(FlickrAlive alive)
 {
     _a?.Invoke();
 }
Example #6
0
 public virtual void SynchronizeImplementation(FlickrAlive alive)
 {
 }
Example #7
0
 public void Synchronize(FlickrAlive alive)
 {
     CurrentAttempt++;
     SynchronizeImplementation(alive);
     IsDone = true;
 }
Example #8
0
 public MainViewModel(FlickrAlive flickrAlive)
 {
     this.flickrAlive = flickrAlive;
     this.flickrAlive.Initialize();
     this.flickrAlive.PropertyChanged += OnAliveOnPropertyChanged;
 }
Example #9
0
        public override void SynchronizeImplementation(FlickrAlive alive)
        {
            var orderedSets = alive.FlickrData.Sets.OrderByDescending(s => s.Title);

            alive.FlickrInstance.PhotosetsOrderSets(orderedSets.Select(s => s.PhotosetId).ToArray());
        }