Esempio n. 1
0
        public void AddPermToSynchroSet(SynchroSet synchroSet)
        {
            PermissionTasks.RemoveAll(t => t.AlbumTitle == synchroSet.Title);

            Action preSynchroAction = () =>
            {
                FlickrData.Sets = FlickrInstance.PhotosetsGetList();
            };

            PermissionTasks.Add(new ActionTask(preSynchroAction, synchroSet.Title));

            List <Photo> photos = null;
            Action       changePermissionAction = new Action(() =>
            {
                var set = FlickrData.Sets.First(s => s.Title == synchroSet.Title);
                photos  = GetAllPhotos(set);
                foreach (var photo in photos)
                {
                    FlickrInstance.PhotosSetPerms(photo.PhotoId, synchroSet.IsPublic, photo.IsFriend, synchroSet.IsFamily, PermissionComment.FriendsAndFamily, PermissionAddMeta.Owner);
                }
            });

            PermissionTasks.Add(new ActionTask(changePermissionAction, synchroSet.Title));
            TasksCountChanged();
        }
Esempio n. 2
0
        public void UpdateMeta()
        {
            AllSynchroSets.Clear();
            //clear old
            FlickrData.Sets = FlickrInstance.PhotosetsGetList();
            EnsureDirectoryExist(Root);

            var Directories = Directory.GetDirectories(Root);

            foreach (var directory in Directories)
            {
                var directoryName = Path.GetFileName(directory);

                if (FlickrData.Sets.FirstOrDefault(s => s.Title == directoryName) == null)
                {
                    var setx = new SynchroSet(directoryName, this);
                    setx.Up = Directory.GetFiles(directory).FilterPhotos().Count();
                    AllSynchroSets.Add(setx);
                }
            }

            foreach (var set in FlickrData.Sets)
            {
                var setx = new SynchroSet(set.Title, this);
                var primaryPermission = FlickrInstance.PhotosGetPerms(set.PrimaryPhotoId);
                setx._isPublic = primaryPermission.IsPublic;
                setx._isFamily = primaryPermission.IsFamily;

                var testedDirectory = Root + Constants.DelimiterInWindowsPath + set.Title;
                if (!Directory.Exists(testedDirectory))
                {
                    setx.Down = set.NumberOfPhotos;
                }
                else
                {
                    var photosString = GetAllPhotos(set).Select(p => p.Title);

                    var files = Directory.GetFiles(testedDirectory).FilterPhotos().Select(Path.GetFileNameWithoutExtension);
                    foreach (var file in files)
                    {
                        if (!photosString.Contains(file))
                        {
                            setx.Up++;
                        }
                    }

                    foreach (var photo in photosString)
                    {
                        if (!files.Contains(photo))
                        {
                            setx.Down++;
                        }
                    }
                }
                AllSynchroSets.Add(setx);
            }

            TasksCountChanged();
        }
Esempio n. 3
0
        public void AddReorderPhotosByDataTaken(SynchroSet synchroSet)
        {
            Action preSynchroAction = () =>
            {
                FlickrData.Sets = FlickrInstance.PhotosetsGetList();
            };

            ReOrderTasks.Add(new ActionTask(preSynchroAction, synchroSet.Title));
            ReOrderTasks.Add(new OrderPhotosTask(synchroSet.Title));
            TasksCountChanged();
        }
Esempio n. 4
0
        public void AddSynchronizeSet(SynchroSet synchroSet)
        {
            string directory = Root + Constants.DelimiterInWindowsPath + synchroSet.Title;

            EnsureDirectoryExist(directory);

            var set = FlickrData.Sets.FirstOrDefault(i => i.Title == synchroSet.Title);

            if (set == null)
            {
                //create new album, only if there is at least one photo
                if (Directory.GetFiles(directory).FilterPhotos().Any())
                {
                    SynchronizeNewDirectoryUp(directory);
                }
            }
            else
            {
                SynchronizeExistingDirectory(set, directory);
            }

            OnPropertyChanged(nameof(SynchronizationTasksCount));
            OnPropertyChanged(nameof(TasksString));
        }
Esempio n. 5
0
 public void RemoveReorderPhotosByDataTaken(SynchroSet synchroSet)
 {
     ReOrderTasks.RemoveAll(s => s.AlbumTitle == synchroSet.Title);
     TasksCountChanged();
 }
Esempio n. 6
0
 public void RemoveSynchronizationOfSet(SynchroSet synchroSet)
 {
     PhotoTasks.RemoveAll(t => t.AlbumTitle == synchroSet.Title);
     TasksCountChanged();
 }