Exemple #1
0
        private void ToggleSelection(FrameworkElement iconImage, AlbumPhoto choosenPhoto)
        {
            if (choosenPhoto == null)
            {
                return;
            }
            double  animateToScale = choosenPhoto.IsSelected ? 0.8 : 1.2;
            int     dur            = 100;
            Ellipse ellipse        = ((IEnumerable <UIElement>)((Panel)(iconImage.Parent as Grid)).Children).FirstOrDefault <UIElement>((Func <UIElement, bool>)(c => c is Ellipse)) as Ellipse;

            if (!(((UIElement)ellipse).RenderTransform is ScaleTransform))
            {
                ((UIElement)ellipse).RenderTransform = ((Transform) new ScaleTransform());
            }
            if (!(((UIElement)iconImage).RenderTransform is ScaleTransform))
            {
                ((UIElement)iconImage).RenderTransform = ((Transform) new ScaleTransform());
            }
            if (!choosenPhoto.IsSelected && this._pppVM.SelectedCount == this._pppVM.MaxAllowedToSelect)
            {
                return;
            }
            choosenPhoto.IsSelected = !choosenPhoto.IsSelected;
            PhotoPickerPhotos.AnimateTransform(animateToScale, dur, ((UIElement)iconImage).RenderTransform, 25);
            PhotoPickerPhotos.AnimateTransform(animateToScale, dur, ((UIElement)ellipse).RenderTransform, 25);
        }
Exemple #2
0
        public void Show(int totalCount, string albumId, int ind, Func <int, Image> getImageFunc, Action <int, bool> showHideOriginalImageCallback, PhotoPickerPhotos pickerPage)
        {
            if (this.IsShown)
            {
                return;
            }
            ((UIElement)this).Visibility = Visibility.Visible;
            this._indToShow = ind;
            if (this._pppVM != null)
            {
                this._pppVM.PropertyChanged -= new PropertyChangedEventHandler(this.PickerVM_PropertyChanged);
            }
            this._pppVM = pickerPage.VM;
            this._pppVM.PropertyChanged += new PropertyChangedEventHandler(this.PickerVM_PropertyChanged);
            this._pickerPage             = pickerPage;
            this._totalCount             = totalCount;
            this._savedPageAppBar        = this.Page.ApplicationBar;
            this._albumId       = albumId;
            this._imageEditorVM = this._pickerPage.VM.ImageEditor;
            ((UIElement)this.elliplseSelect).Opacity = (0.0);
            ((UIElement)this.imageSelect).Opacity    = (0.0);
            this.OnPropertyChanged("ImageEditor");
            this.InitializeImageSizes();
            PhoneApplicationPage page = this.Page;

            // ISSUE: variable of the null type
            page.ApplicationBar = (null);
            EventHandler <CancelEventArgs> eventHandler = new EventHandler <CancelEventArgs>(this.Page_BackKeyPress);

            page.BackKeyPress += (eventHandler);
            this.UpdateConfirmButtonState();
            this.imageViewer.Initialize(totalCount, (Func <int, ImageInfo>)(i =>
            {
                double num1 = 0.0;
                double num2 = 0.0;
                if (this._imageSizes.Count > i)
                {
                    Size imageSize1 = this._imageSizes[i];
                    // ISSUE: explicit reference operation
                    num1            = ((Size)@imageSize1).Width;
                    Size imageSize2 = this._imageSizes[i];
                    // ISSUE: explicit reference operation
                    num2 = ((Size)@imageSize2).Height;
                }
                ImageEffectsInfo imageEffectsInfo = this._imageEditorVM.GetImageEffectsInfo(this._albumId, this._totalCount - i - 1);
                if (imageEffectsInfo != null && imageEffectsInfo.ParsedExif != null && (imageEffectsInfo.ParsedExif.Width != 0 && imageEffectsInfo.ParsedExif.Height != 0))
                {
                    num1 = (double)imageEffectsInfo.ParsedExif.Width;
                    num2 = (double)imageEffectsInfo.ParsedExif.Height;
                    if (imageEffectsInfo.ParsedExif.Orientation == ExifOrientation.TopRight || imageEffectsInfo.ParsedExif.Orientation == ExifOrientation.BottomLeft)
                    {
                        double num3 = num1;
                        num1        = num2;
                        num2        = num3;
                    }
                }
                if (imageEffectsInfo != null && imageEffectsInfo.CropRect != null && !this._inCropMode)
                {
                    num1 = (double)imageEffectsInfo.CropRect.Width;
                    num2 = (double)imageEffectsInfo.CropRect.Height;
                }
                return(new ImageInfo()
                {
                    GetSourceFunc = (Func <bool, BitmapSource>)(allowBackgroundCreation => this._imageEditorVM.GetBitmapSource(this._albumId, this._totalCount - i - 1, allowBackgroundCreation)),
                    Width = num1,
                    Height = num2
                });
            }), getImageFunc, showHideOriginalImageCallback, (FrameworkElement)null, (Action <int>)null);
            this.IsShown = true;
            this.ShowViewer();
        }