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()); }
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); } }
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(); }
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); }
public override void SynchronizeImplementation(FlickrAlive alive) { _a?.Invoke(); }
public virtual void SynchronizeImplementation(FlickrAlive alive) { }
public void Synchronize(FlickrAlive alive) { CurrentAttempt++; SynchronizeImplementation(alive); IsDone = true; }
public MainViewModel(FlickrAlive flickrAlive) { this.flickrAlive = flickrAlive; this.flickrAlive.Initialize(); this.flickrAlive.PropertyChanged += OnAliveOnPropertyChanged; }
public override void SynchronizeImplementation(FlickrAlive alive) { var orderedSets = alive.FlickrData.Sets.OrderByDescending(s => s.Title); alive.FlickrInstance.PhotosetsOrderSets(orderedSets.Select(s => s.PhotosetId).ToArray()); }