public PhotoViewController1(ImageEntity image, List<ImageEntity> images)
        {
            _images = images;
            _currentImageIndex = GetImageIndex(image);

            var tabButton = new UIBarButtonItem("Tag", UIBarButtonItemStyle.Plain, OnTagClicked);
            NavigationItem.RightBarButtonItem = tabButton;

            _btShare = new UIBarButtonItem(UIBarButtonSystemItem.Action, OnShareClicked);
            var btTrash = new UIBarButtonItem(UIBarButtonSystemItem.Trash, OnTrashClicked);
            var deleteSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
            ToolbarItems = new[] { _btShare, deleteSpace, btTrash };
        }
        public PhotoViewController4(ImageEntity image, List<ImageEntity> images)
            : base(UIPageViewControllerTransitionStyle.Scroll,
                UIPageViewControllerNavigationOrientation.Horizontal,
                UIPageViewControllerSpineLocation.None, 20f)
        {
            FullScreen = false;
            _image = image;
            _images = images;

            var tabButton = new UIBarButtonItem("Tag", UIBarButtonItemStyle.Plain, OnTagClicked);
            NavigationItem.RightBarButtonItem = tabButton;

            _btShare = new UIBarButtonItem(UIBarButtonSystemItem.Action, OnShareClicked);

            var btTrash = new UIBarButtonItem(UIBarButtonSystemItem.Trash, OnTrashClicked);
            var deleteSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
            ToolbarItems = new[] { _btShare, deleteSpace, btTrash };

            DataSource = _pageVewDataSource;
            AutomaticallyAdjustsScrollViewInsets = false;
        }
 public TagSelectorViewController(ImageEntity image) : base("TagSelectorViewController", null)
 {
     _images.Add(image.CloneDeep());
 }
Example #4
0
 public ImageEntity CloneDeep()
 {
     var result = new ImageEntity
     {
         EntityId = EntityId,
         LocalIdentifier = LocalIdentifier,
         TagsInternal = TagsInternal,
         CreateTime = CreateTime
     };
     return result;
 }
Example #5
0
 public void Update(ImageEntity value)
 {
     _tags.Clear();
     _tags.AddRange(value.Tags);
     EntityId = value.EntityId;
     _tagsInternal = TagsToString();
 }
Example #6
0
 public List<TagEntity> GetRemovedTags(ImageEntity entity)
 {
     IEnumerable<TagEntity> result = Tags.Except(entity.Tags, new FuncComparer<TagEntity>((x, y) => x.Equals(y)));
     return result.ToList();
 }
Example #7
0
 public bool Equals(ImageEntity value)
 {
     if (ReferenceEquals(null, value))
     {
         return false;
     }
     if (ReferenceEquals(this, value))
     {
         return true;
     }
     return value.EntityId == EntityId
            && string.Equals(value.LocalIdentifier, LocalIdentifier, StringComparison.OrdinalIgnoreCase);
 }
 private static int GetImageIndex(ImageEntity image)
 {
     return _images.FindIndex(x => x.Equals(image));
 }
 private void OnTagSelectorDone(object sender, EventArgsOf<List<ImageEntity>> ea)
 {
     _imageCache.SaveOrUpdate(ea.Data);
     _image = ea.Data.First();
 }
        private void OnDeleteAssetsCompleted(ImageEntity removedImage, bool result, NSError error)
        {
            if (result == false)
            {
                return;
            }

            int imageIndex = GetImageIndex(removedImage);
            _images.Remove(removedImage);
            _imageCache.Remove(removedImage);

            InvokeOnMainThread(() =>
            {
                ResetDataSource();

                if (_images.IsNullOrEmpty())
                {
                    NavigationController.PopViewController(true);
                    return;
                }

                imageIndex--;
                if (imageIndex < 0)
                {
                    imageIndex = 0;
                }
                PhotoViewPage1 page = PhotoViewPage1.ImageViewControllerForPageIndex(_images[imageIndex]);

                SetViewControllers(new UIViewController[] { page },
                    UIPageViewControllerNavigationDirection.Forward,
                    false, null);
            });
        }
        public PhotoViewController2(ImageEntity image, List<ImageEntity> images)
        {
            Title = "Image";

            _image = image;
        }
Example #12
0
 public static PhotoViewPage1 ImageViewControllerForPageIndex(ImageEntity image)
 {
     return new PhotoViewPage1(image);
 }
Example #13
0
 private PhotoViewPage1(ImageEntity image)
 {
     ImageEntity = image;
     Title = "Image";
 }
        private void OnDeleteAssetsCompleted(ImageEntity removedImage, bool result, NSError error)
        {
            if (result == false)
            {
                return;
            }
            else
            {
                Console.WriteLine(error);
            }
            int imageIndex = GetImageIndex(removedImage);
            _images.Remove(removedImage);
            _imageCache.Remove(removedImage);

            InvokeOnMainThread(() =>
            {
                _pageViewController.ResetDataSource();

                if (_images.IsNullOrEmpty())
                {
                    NavigationController.PopViewController(true);
                    return;
                }
                var page = new PhotoPage(this, _currentImageIndex, _images);

                imageIndex--;
                if (imageIndex < 0)
                {
                    imageIndex = 0;
                }
                _pageViewController.SetViewControllers(new UIViewController[] { page },
                    UIPageViewControllerNavigationDirection.Forward,
                    false, null);
            });
        }
Example #15
0
 private void SwipeImage()
 {
     _image = _images[_currentImageIndex];
     PHAsset asset = _imageCache.GetAsset(_image.LocalIdentifier);
     InvokeOnMainThread(() => UpdateImage(asset));
 }
Example #16
0
 public void Remove(ImageEntity image)
 {
     Remove(new List<ImageEntity> { image });
 }
Example #17
0
 private ImageEntity CreateImage(PHAsset asset)
 {
     try
     {
         var result = new ImageEntity
         {
             LocalIdentifier = asset.LocalIdentifier,
             CreateTime = asset.CreationDate.ToDateTime()
         };
         return result;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return new ImageEntity
         {
             LocalIdentifier = asset.LocalIdentifier,
             CreateTime = DateTime.MinValue
         };
     }
 }
Example #18
0
 private void OnDeleteAssetsCompleted(ImageEntity removedImage, bool result, NSError error)
 {
     if (result)
     {
         _images.Remove(removedImage);
         _imageCache.Remove(removedImage);
         _currentImageIndex--;
         if (_images.IsNullOrEmpty())
         {
             InvokeOnMainThread(() => NavigationController.PopViewController(true));
             return;
         }
         else if (_currentImageIndex < 0)
         {
             _currentImageIndex = 0;
         }
         SwipeImage();
     }
     else
     {
         Console.WriteLine(error);
     }
 }