private void photo_OnTapped(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;

            if (frameworkElement == null)
            {
                return;
            }
            Photo photo = null;
            AlbumPhotoHeaderFourInARow dataContext = frameworkElement.DataContext as AlbumPhotoHeaderFourInARow;

            if (dataContext != null)
            {
                string str = frameworkElement.Tag.ToString();
                if (!(str == "1"))
                {
                    if (!(str == "2"))
                    {
                        if (!(str == "3"))
                        {
                            if (str == "4")
                            {
                                photo = dataContext.Photo4.Photo;
                            }
                        }
                        else
                        {
                            photo = dataContext.Photo3.Photo;
                        }
                    }
                    else
                    {
                        photo = dataContext.Photo2.Photo;
                    }
                }
                else
                {
                    photo = dataContext.Photo1.Photo;
                }
            }
            if (photo == null)
            {
                return;
            }
            List <Photo> photoList1 = new List <Photo>();

            foreach (AlbumPhotoHeaderFourInARow headerFourInArow in (Collection <AlbumPhotoHeaderFourInARow>) this.ViewModel.PhotosVM.Collection)
            {
                photoList1.AddRange(headerFourInArow.GetAsPhotos());
            }
            int          num1       = photoList1.IndexOf(photo);
            int          num2       = Math.Max(0, num1 - 20);
            List <Photo> photoList2 = new List <Photo>();

            for (int index = num2; index < Math.Min(photoList1.Count, num1 + 30); ++index)
            {
                photoList2.Add(photoList1[index]);
            }
            Navigator.Current.NavigateToImageViewer(this.ViewModel.PhotosVM.TotalCount, num2, photoList2.IndexOf(photo), (List <long>)Enumerable.ToList <long>(Enumerable.Select <Photo, long>(photoList2, (Func <Photo, long>)(p => p.pid))), (List <long>)Enumerable.ToList <long>(Enumerable.Select <Photo, long>(photoList2, (Func <Photo, long>)(p => p.owner_id))), (List <string>)Enumerable.ToList <string>(Enumerable.Select <Photo, string>(photoList2, (Func <Photo, string>)(p => p.access_key))), photoList2, "PhotosByIds", true, false, (Func <int, Image>)(i => null), null, false);
        }
Exemplo n.º 2
0
        private void Image_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement           frameworkElement = sender as FrameworkElement;
            AlbumPhoto                 albumPhoto       = null;
            AlbumPhotoHeaderFourInARow dataContext      = frameworkElement.DataContext as AlbumPhotoHeaderFourInARow;

            if (dataContext != null)
            {
                string str = frameworkElement.Tag.ToString();
                if (!(str == "1"))
                {
                    if (!(str == "2"))
                    {
                        if (!(str == "3"))
                        {
                            if (str == "4")
                            {
                                albumPhoto = dataContext.Photo4;
                            }
                        }
                        else
                        {
                            albumPhoto = dataContext.Photo3;
                        }
                    }
                    else
                    {
                        albumPhoto = dataContext.Photo2;
                    }
                }
                else
                {
                    albumPhoto = dataContext.Photo1;
                }
            }
            else
            {
                albumPhoto = frameworkElement.DataContext as AlbumPhoto;
            }
            if (albumPhoto == null)
            {
                return;
            }
            if (this._pickMode)
            {
                ParametersRepository.SetParameterForId("PickedPhoto", albumPhoto.Photo);
                base.NavigationService.RemoveBackEntrySafe();
                base.NavigationService.GoBackSafe();
            }
            else
            {
                List <Photo> list = this.PhotoAlbumVM.AlbumPhotos.Select <AlbumPhoto, Photo>((Func <AlbumPhoto, Photo>)(ap => ap.Photo)).ToList <Photo>();
                Navigator.Current.NavigateToImageViewer(this.PhotoAlbumVM.AlbumId, (int)this.PhotoAlbumVM.AType, this._inputData.UserOrGroupId, this._inputData.IsGroup, this.PhotoAlbumVM.PhotosCount, list.IndexOf(albumPhoto.Photo), list, new Func <int, Image>(this.GetPhotoById));
            }
        }
Exemplo n.º 3
0
        private void itemsControlPhotos_Link_1(object sender, LinkUnlinkEventArgs e)
        {
            int count = this.PhotoAlbumVM.PhotosGenCol.Collection.Count;
            AlbumPhotoHeaderFourInARow content = e.ContentPresenter.Content as AlbumPhotoHeaderFourInARow;

            if (count < 10 || content == null || this.PhotoAlbumVM.PhotosGenCol.Collection[count - 10] != content)
            {
                return;
            }
            this.PhotoAlbumVM.LoadMorePhotos();
        }
Exemplo n.º 4
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            MenuItem   menuItem   = sender as MenuItem;
            AlbumPhoto albumPhoto = null;
            AlbumPhotoHeaderFourInARow dataContext = ((FrameworkElement)menuItem).DataContext as AlbumPhotoHeaderFourInARow;

            if (dataContext != null)
            {
                string str = ((FrameworkElement)(((FrameworkElement)menuItem).Parent as ContextMenu)).Tag.ToString();
                if (!(str == "1"))
                {
                    if (!(str == "2"))
                    {
                        if (!(str == "3"))
                        {
                            if (str == "4")
                            {
                                albumPhoto = dataContext.Photo4;
                            }
                        }
                        else
                        {
                            albumPhoto = dataContext.Photo3;
                        }
                    }
                    else
                    {
                        albumPhoto = dataContext.Photo2;
                    }
                }
                else
                {
                    albumPhoto = dataContext.Photo1;
                }
            }
            else
            {
                albumPhoto = ((FrameworkElement)menuItem).DataContext as AlbumPhoto;
            }
            if (albumPhoto == null || !this.AskDeletePhotoConfirmation(1))
            {
                return;
            }
            this.PhotoAlbumVM.DeletePhoto(albumPhoto.Photo);
        }
Exemplo n.º 5
0
        private void Image_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;

            if (frameworkElement == null)
            {
                return;
            }
            AlbumPhotoHeaderFourInARow dataContext = frameworkElement.DataContext as AlbumPhotoHeaderFourInARow;
            Photo photo = null;

            if (dataContext != null)
            {
                string str = frameworkElement.Tag.ToString();
                if (!(str == "1"))
                {
                    if (!(str == "2"))
                    {
                        if (!(str == "3"))
                        {
                            if (str == "4")
                            {
                                photo = dataContext.Photo4.Photo;
                            }
                        }
                        else
                        {
                            photo = dataContext.Photo3.Photo;
                        }
                    }
                    else
                    {
                        photo = dataContext.Photo2.Photo;
                    }
                }
                else
                {
                    photo = dataContext.Photo1.Photo;
                }
            }
            if (photo == null)
            {
                return;
            }
            List <Photo> photoList = new List <Photo>();

            foreach (AlbumPhotoHeaderFourInARow headerFourInArow in (Collection <AlbumPhotoHeaderFourInARow>) this.FavVM.PhotosVM.Collection)
            {
                photoList.AddRange(headerFourInArow.GetAsPhotos());
            }
            int          num           = photoList.IndexOf(photo);
            List <Photo> photos        = new List <Photo>();
            int          initialOffset = Math.Max(0, num - 20);

            for (int index = initialOffset; index < Math.Min(photoList.Count, num + 30); ++index)
            {
                photos.Add(photoList[index]);
            }
            this._initialOffset = initialOffset;
            Navigator.Current.NavigateToImageViewer(this.FavVM.PhotosVM.TotalCount, initialOffset, photos.IndexOf(photo), (List <long>)Enumerable.ToList <long>(Enumerable.Select <Photo, long>(photos, (Func <Photo, long>)(p => p.pid))), (List <long>)Enumerable.ToList <long>(Enumerable.Select <Photo, long>(photos, (Func <Photo, long>)(p => p.owner_id))), (List <string>)Enumerable.ToList <string>(Enumerable.Select <Photo, string>(photos, (Func <Photo, string>)(p => p.access_key))), photos, "PhotosByIdsForFavorites", false, false, new Func <int, Image>(this.GetPhotoById), null, false);
        }