Пример #1
0
        private void AddImagesView_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "Width":
                if (Width > 0)
                {
                    var tempWidthOneCell = (Width - Spacing * 6) / 5;
                    HeightRequest = tempWidthOneCell * 2 + Spacing * 3;
                }
                break;

            case "OldImagePaths":
                if (OldImagePaths?.Count > 0)
                {
                    for (int i = 0; i < OldImagePaths.Count && i < 9; i++)
                    {
                        ImagePaths.Insert(1, OldImagePaths[i]);
                        _images[i + 1].SetUri(OldImagePaths[i]);
                    }
                    if (OldImagePaths.Count >= 10)
                    {
                        ImagePaths[0] = OldImagePaths[9];
                        _images[0].SetUri(OldImagePaths[9]);
                        _images[0].CanUseLongClick = true;
                    }
                }
                break;
            }
        }
Пример #2
0
        private void AddImagesView_LongClick(object sender, PropertyChangedEventArgs e)
        {
            var senderObject = sender as NewPinImage;

            if (senderObject != null)
            {
                ImagePaths.Remove(senderObject.ImagePath);
                if (!string.IsNullOrEmpty(senderObject.ImageUri))
                {
                    ImagePaths.Remove(senderObject.ImageUri);
                }
                if (ImagePaths.Count == 9 && !string.IsNullOrEmpty(ImagePaths[0]))
                {
                    ImagePaths.Insert(0, string.Empty);
                    _images[0].ClearImage();
                    _images[0].Source          = "plus_icon.png";
                    _images[0].CanUseLongClick = false;
                }
                for (int i = 1; i < _images.Length; i++)
                {
                    _images[i].ClearImage();
                }
                for (int i = 1; i < ImagePaths.Count; i++)
                {
                    _images[i].SetPath(ImagePaths[i]);
                }

                OnPropertyChanged("HaveChange");
            }
        }
Пример #3
0
 private void SetNewPhoto(string photoPath)
 {
     if (ImagePaths.Count < 10)
     {
         ImagePaths.Insert(1, photoPath);
         for (int i = 1; i < ImagePaths.Count; i++)
         {
             _images[i].SetPath(ImagePaths[i]);
         }
     }
     else if (ImagePaths.Count == 10)
     {
         ImagePaths[0] = photoPath;
         _images[0].SetPath(photoPath);
         _images[0].CanUseLongClick = true;
     }
     OnPropertyChanged("HaveChange");
 }