コード例 #1
0
        private void HandleHoverOverUpdate(FrameworkElement control)
        {
            if (control == this._hoveredOverElement || !(control is Image))
            {
                return;
            }
            Image image1 = control as Image;

            if (((FrameworkElement)image1).Tag == null || !(((FrameworkElement)image1).DataContext is AlbumPhotoHeaderFourInARow))
            {
                return;
            }
            AlbumPhoto photoByTag = (control.DataContext as AlbumPhotoHeaderFourInARow).GetPhotoByTag(control.Tag.ToString());

            if (photoByTag == null)
            {
                return;
            }
            Image image2 = ((PresentationFrameworkCollection <UIElement>)(((FrameworkElement)image1).Parent as Panel).Children)[3] as Image;

            if (!this._selectMode.HasValue)
            {
                this._selectMode = new bool?(!photoByTag.IsSelected);
            }
            if (photoByTag.IsSelected != this._selectMode.Value)
            {
                this.ToggleSelection((FrameworkElement)image2, photoByTag);
            }
            this._hoveredOverElement = control;
        }
コード例 #2
0
        public async Task <bool> Handle(AddPhotoCommand request, CancellationToken cancellationToken)
        {
            var album = await _albumRepository.GetAlbumWithPhotosAsync(request.AlbumId);

            if (album == null)
            {
                throw new ClientException("操作失败", new List <string> {
                    $"Album {request.AlbumId} does not exist."
                });
            }

            var myId = Guid.Parse(_httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (album.UserId != myId)
            {
                throw new ClientException("操作失败", new List <string> {
                    $"Album {request.AlbumId} does not belong to user {myId}."
                });
            }

            request.Names.ForEach(nameInfo =>
            {
                var photo = new AlbumPhoto(nameInfo.Name, nameInfo.DisplayName);
                album.AddPhoto(photo);
            });

            return(await _albumRepository.UnitOfWork.SaveEntitiesAsync(cancellationToken));
        }
コード例 #3
0
 public bool SavePhotoInAlbum(AlbumPhoto photo)
 {
     using (var context = new ContextDb())
     {
         return(SavePhotoInAlbum(context, photo));
     }
 }
コード例 #4
0
ファイル: ImportHelper.cs プロジェクト: YzYpYzY/koudou
 public int ImportPhotos()
 {
     JObject[] photos = JsonConvert.DeserializeObject <JObject[]>(File.ReadAllText(@"api/Koudou.Seed/Data/swp_albums.json"));
     foreach (var photo in photos)
     {
         var newPhoto = new Photo(
             HttpUtility.HtmlDecode((string)photo["nomfichier"]),
             null
             );
         newPhoto.OldId = (int)photo["numphoto"];
         var album      = Context.Albums.FirstOrDefault(a => a.OldId == (int)photo["numalbum"]);
         var albumPhoto = new AlbumPhoto();
         albumPhoto.Photo = newPhoto;
         albumPhoto.Album = album;
         albumPhoto.Order = (int)photo["posphoto"];
         if (album != null)
         {
             if (newPhoto.AlbumPhotos == null)
             {
                 newPhoto.AlbumPhotos = new List <AlbumPhoto>();
             }
             newPhoto.AlbumPhotos.Add(albumPhoto);
         }
         Context.Photos.Add(newPhoto);
     }
     return(Context.SaveChanges());
 }
コード例 #5
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);
        }
コード例 #6
0
        public ActionResult AddPhotoToAlbum()
        {
            var model = new AlbumPhoto();

            model.PhotoMod = GalleryController.;
            model.AlbumMod = AlbumController.albumrepo;
            return(View(model));
        }
コード例 #7
0
        public ActionResult AddPhotoToAlbum()
        {
            var model = new AlbumPhoto();

            model.Albums = AlbumRepository.Albums;
            model.Photos = PhotoRepository.Photos;
            return(View(model));
        }
コード例 #8
0
 private void ToggleSelection(AlbumPhoto choosenPhoto)
 {
     if (choosenPhoto == null || !choosenPhoto.IsSelected && this._viewModel.PhotosVM.SelectedCount == this._viewModel.MaxCount)
     {
         return;
     }
     choosenPhoto.IsSelected = !choosenPhoto.IsSelected;
 }
コード例 #9
0
        public ActionResult AddPhotoToAlbum()
        {
            var model = new AlbumPhoto();

            model.Albums = AlbumAutomapper.FromBltoUiGetAll();
            model.Photos = PhotoAutomapper.FromBltoUiGetAll();
            return(PartialView("_AddPhotoToAlbum", model));
        }
コード例 #10
0
        public AlbumPhoto GetRandomPhoto(Guid id)
        {
            GalleryAlbum album       = GetGalleryAlbumById(id);
            var          albumPhotos = album.AlbumPhotos;
            var          random      = new Random();
            int          index       = random.Next(albumPhotos.Count());
            AlbumPhoto   albumPhoto  = albumPhotos.ElementAt(index);

            return(albumPhoto);
        }
コード例 #11
0
ファイル: PhotoAlbumPage.cs プロジェクト: Makzz90/VKClient_re
        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));
            }
        }
コード例 #12
0
 public void Attach(List <int> attachments, int albumId)
 {
     foreach (var photoId in attachments)
     {
         var photoAlbum = new AlbumPhoto();
         photoAlbum.AlbumId = albumId;
         photoAlbum.PhotoId = photoId;
         _context.AlbumPhotos.Add(photoAlbum);
     }
     _context.SaveChanges();
 }
コード例 #13
0
ファイル: PhotoAlbumPage.cs プロジェクト: Makzz90/VKClient_re
        private void listBoxPhotos_Link_1(object sender, MyLinkUnlinkEventArgs e)
        {
            int        count   = this.PhotoAlbumVM.AlbumPhotos.Count;
            AlbumPhoto content = e.ContentPresenter.Content as AlbumPhoto;

            if (count < 20 || content == null || this.PhotoAlbumVM.AlbumPhotos[count - 20] != content)
            {
                return;
            }
            this.PhotoAlbumVM.LoadMorePhotos();
        }
コード例 #14
0
 public void SaveAlbumPhoto(AlbumPhoto entity)
 {
     if (entity.Id == default)
     {
         context.Entry(entity).State = EntityState.Added;
     }
     else
     {
         context.Entry(entity).State = EntityState.Modified;
     }
     context.SaveChanges();
 }
コード例 #15
0
        public void UpdatePhoto(AlbumPhoto newT)
        {
            AlbumPhoto old = _albumPhotoRepo.GetById(newT.Id);

            old.DisplayOrder = newT.DisplayOrder;
            old.Description  = newT.Description;
            old.AltText      = newT.AltText;
            old.OverlayText  = newT.OverlayText;
            old.PhotoId      = newT.PhotoId;

            // strange: saving old or newT, it doesn't matter??
            _albumPhotoRepo.Save(newT);
        }
コード例 #16
0
        //
        public FeedAttachmentPhoto(ActivityAttachment attachment, ulong actionId)
        {
            _photo          = AlbumPhotos.GetById(attachment.id);
            attachment_id   = attachment.id;
            attachment_type = "album_photo";
            title           = _photo.title;
            body            = HttpUtility.HtmlDecode(_photo.description);

            //uri = $"https://beta.koobeca.com/advancedalbums/photo/view/album_id/{_photo.album_id}/photo_id/{_photo.photo_id}";
            //uri = $"https://beta.koobeca.com/core/link/index/action_id/{actionId}";
            uri        = $"https://beta.koobeca.com/view.php?action_id={actionId}";
            image_main = _photo.file_id > 0 ? new FeedImage(_photo.file_id) : null;
            mode       = (uint)(attachment.mode ? 1 : 0);
        }
コード例 #17
0
        public async Task <AlbumPhoto> GetAlbumPhoto()
        {
            var photos = await this.photoService.GetPhotos();

            var albums = await this.albumService.GetAlbums();

            var newAlbum = new AlbumPhoto
            {
                Photos = photos,
                Albums = albums
            };

            return(newAlbum);
        }
コード例 #18
0
        public ActionResult AddPhoto(int albumId, string photoPath)
        {
            var pathGalleryPhoto = System.Configuration.ConfigurationManager.AppSettings["pathGalleryPhoto"];
            var photo            = new AlbumPhoto()
            {
                AlbumId = albumId,
                Path    = photoPath
            };

            if (GalleryService.SavePhotoInAlbum(photo))
            {
                photo.Path = pathGalleryPhoto + photo.Path;
                return(PartialView("_Photo", photo));
            }
            return(View());
        }
コード例 #19
0
ファイル: PhotoAlbumPage.cs プロジェクト: Makzz90/VKClient_re
        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);
        }
コード例 #20
0
        private void SelectCapturedPhoto()
        {
            if (this.VM.PhotosCount <= 0 || this.VM.RecentlyAddedImageInd < 0)
            {
                return;
            }
            List <AlbumPhoto> list = (this.VM.Photos)[this.VM.RecentlyAddedImageInd / 4].GetAsAlbumPhotos().ToList <AlbumPhoto>();
            int index = this.VM.RecentlyAddedImageInd % 4;

            if (index >= list.Count)
            {
                return;
            }
            AlbumPhoto albumPhoto = list[index];

            albumPhoto.IsSelected = true;
            this.ShowPhotoEditor(albumPhoto.SeqNo);
        }
コード例 #21
0
        private void GoToMessage_OnClicked(object sender, RoutedEventArgs e)
        {
            long   message_id  = 0;
            object dataContext = ((FrameworkElement)sender).DataContext;

            switch (this.pivot.SelectedIndex)
            {
            case 0:
                AlbumPhoto albumPhoto = dataContext as AlbumPhoto;
                message_id = albumPhoto != null ? albumPhoto.MessageId : 0L;
                break;

            case 1:
                VideoHeader videoHeader = dataContext as VideoHeader;
                message_id = videoHeader != null ? videoHeader.MessageId : 0L;
                break;

            case 2:
                AudioHeader audioHeader = dataContext as AudioHeader;
                message_id = audioHeader != null ? audioHeader.MessageId : 0L;
                break;

            case 3:
                DocumentHeader documentHeader = dataContext as DocumentHeader;
                message_id = documentHeader != null ? documentHeader.MessageId : 0L;
                break;

            case 4:
                LinkHeader linkHeader = dataContext as LinkHeader;
                message_id = linkHeader != null ? linkHeader.MessageId : 0L;
                break;
            }
            if (message_id == 0L)
            {
                return;
            }
            long peerId = this.ViewModel.PeerId;

            if (this.ViewModel.IsChat)
            {
                peerId -= 2000000000L;
            }
            Navigator.Current.NavigateToConversation(peerId, this.ViewModel.IsChat, false, "", message_id, false);
        }
コード例 #22
0
        private void SavePhotos(GalleryAlbum model, List <IFormFile> photos, string albumFolderPath)
        {
            foreach (IFormFile photo in photos)
            {
                AlbumPhoto albumPhoto = new AlbumPhoto {
                    AlbumPhotoPath = photo.FileName
                };
                model.AlbumPhotos.Add(albumPhoto);

                using (var stream = new FileStream(Path.Combine(albumFolderPath, photo.FileName), FileMode.Create))
                    photo.CopyTo(stream);
            }

            dataManager.GalleryAlbums.SaveGalleryAlbum(model);

            foreach (AlbumPhoto photo in model.AlbumPhotos)
            {
                dataManager.AlbumPhotos.SaveAlbumPhoto(photo);
            }
        }
コード例 #23
0
        public async Task <IActionResult> Post([FromBody] AlbumPhoto albpto)
        {
            var entry = await _context.AlbumPhotos.FindAsync(albpto.AlbumID, albpto.PhotoID);

            if (entry != null)
            {
                return(BadRequest());
            }

            string userId = ControllerUtility.GetUserID(this._httpContextAccessor);

            if (userId == null)
            {
                return(StatusCode(401));
            }

            _context.AlbumPhotos.Add(albpto);
            await _context.SaveChangesAsync();

            return(Created(albpto));
        }
コード例 #24
0
        public async Task GetPhotoAlbum()
        {
            var findAlbumResponse = new Album
            {
                UserId = 2,
                Id     = 20,
                Title  = "voluptas rerum iure ut enim"
            };

            var findPhotoResponse = new Photo
            {
                Id           = 1000,
                AlbumId      = 20,
                Title        = "est consequatur deleniti quos minus",
                Url          = "https://via.placeholder.com/600/fab5da",
                ThumbnailUrl = "https://via.placeholder.com/150/fab5da"
            };


            var PhotoAlbumResponse = new AlbumPhoto
            {
                Photos = new List <Photo> {
                    findPhotoResponse
                },
                Albums = new List <Album> {
                    findAlbumResponse
                }
            };

            var photoAlbumRepo = new Mock <IJsonPhotoAlbumService>();

            photoAlbumRepo.Setup(x => x.GetAlbumPhotoByUserId(2)).ReturnsAsync(PhotoAlbumResponse);

            var classUnderTest = new JSONController(photoAlbumRepo.Object);

            var result = await classUnderTest.GetByUserId(2);

            Assert.True(result.Equals(PhotoAlbumResponse));
        }
コード例 #25
0
        private void ToggleSelection(FrameworkElement element, AlbumPhoto choosenPhoto)
        {
            if (choosenPhoto == null)
            {
                return;
            }
            double  animateToScale = choosenPhoto.IsSelected ? 0.8 : 1.2;
            int     dur            = 100;
            Ellipse ellipse        = ((PresentationFrameworkCollection <UIElement>)(element.Parent as Panel).Children)[2] as Ellipse;
            Image   image          = ((PresentationFrameworkCollection <UIElement>)(element.Parent as Panel).Children)[3] as Image;

            if (!(((UIElement)ellipse).RenderTransform is ScaleTransform))
            {
                ((UIElement)ellipse).RenderTransform = ((Transform) new ScaleTransform());
            }
            if (!choosenPhoto.IsSelected && this.VM.SelectedCount == this.VM.MaxAllowedToSelect)
            {
                return;
            }
            choosenPhoto.IsSelected = !choosenPhoto.IsSelected;
            PhotoPickerPhotos.AnimateTransform(animateToScale, dur, ((UIElement)image).RenderTransform, 20);
            PhotoPickerPhotos.AnimateTransform(animateToScale, dur, ((UIElement)ellipse).RenderTransform, 20);
        }
コード例 #26
0
        public async Task <AlbumPhoto> GetAlbumPhotoByUserId(int id)
        {
            var album = await this.albumService.GetAlbumsByUserId(id);

            var photos = await this.photoService.GetPhotos();

            var albumIdList = new List <int>();

            foreach (var item in album)
            {
                albumIdList.Add(item.Id);
            }

            var photosInAlbums = photos.Where(x => albumIdList.Contains(x.AlbumId)).ToList();

            var newAlbum = new AlbumPhoto
            {
                Albums = album,
                Photos = photosInAlbums
            };


            return(newAlbum);
        }
コード例 #27
0
        public static bool SavePhotoInAlbum(AlbumPhoto photo)
        {
            IGalleryRepository galleryRepo = new GalleryRepository();

            return(galleryRepo.SavePhotoInAlbum(photo));
        }
コード例 #28
0
        public ActionResult UploadPicture(HttpPostedFileBase file, int albumId)
        {
            if (file == null)
            {
                throw new NullReferenceException("File is null!");
            }

            if (file.IsImage())
            {
                var image = file.HttpPostedFileBaseToImage().ImageToByteArray();

                var albumPhoto = new AlbumPhoto()
                {
                    Photo = image,
                    Likes = new List<Like>(),
                    Comments = new List<Comment>(),
                    AlbumId = albumId
                };

                this.Data.AlbumPhotos.Add(albumPhoto);
                this.Data.SaveChanges();
            }
            else
            {
                throw new ArgumentException("File is not image");
            }
            return RedirectToAction("PhotosInAlbum", new { id = albumId });
        }
コード例 #29
0
        public ActionResult SetAsProfilePhoto(int id)
        {
            var loggedUserId = this.User.Identity.GetUserId();
            var user = this.Data.Users.All().FirstOrDefault(us => us.Id == loggedUserId);
            var photo = this.Data.AlbumPhotos.All().FirstOrDefault(ph => ph.Id == id);

            user.ProfilePhotoId = id;

            var albums = this.Data
                .Albums
                .All()
                .Select(al => al.Title)
                .ToList();

            var albumExist = false;

            foreach (var album in albums.Where(album => album == "Profile photos"))
            {
                albumExist = true;
            }

            if (albumExist)
            {
                var album = this.Data.Albums.All().FirstOrDefault(al => al.Title == "Profile photos");

                var photoConsistInAlbum = false;
                foreach (var photoo in album.AlbumPhotos.Where(photoo => photoo.Id == photo.Id))
                {
                    photoConsistInAlbum = true;
                }
                if (photoConsistInAlbum)
                {
                    album.AlbumPhotos.Add(photo);
                }
            }
            else
            {
                var album = new Album()
                {
                    Title = "Profile photos",
                    Description = "Profile photos",
                    AlbumPhotos = new List<AlbumPhoto>()
                };

                var newPhoto = new AlbumPhoto()
                {
                    Photo = photo.Photo
                };

                album.AlbumPhotos.Add(newPhoto);
                this.Data.Albums.Add(album);
                user.Albums.Add(album);
            }

            this.Data.SaveChanges();

            return RedirectToAction("Index", "Profile");
        }
コード例 #30
0
        private void HandleAttachmentSelection(AttachmentPickerItemViewModel item)
        {
            if (item == null)
            {
                return;
            }
            if (this._subPickerUC != null)
            {
                this._subPickerUC.ItemSelected -= new AttachmentSubItemSelectedEventHandler(this.HandleAttachmentSelection);
            }
            AttachmentType attachmentType = item.AttachmentType.AttachmentType;

            switch (attachmentType)
            {
            case AttachmentType.Photo:
                if (!item.IsHighlighted)
                {
                    List <NamedAttachmentType> attachmentTypes = new List <NamedAttachmentType>((IEnumerable <NamedAttachmentType>)AttachmentTypes.AttachmentPhotoSubtypes);
                    if (this.OwnerId < 0L && this._adminLevel > 1)
                    {
                        attachmentTypes.Add(AttachmentTypes.PhotoCommunityType);
                    }
                    this.ShowAttachmentSubPickerFor(attachmentTypes);
                    break;
                }
                ((UIElement)this.borderLoading).Visibility = Visibility.Visible;
                ThreadPool.QueueUserWorkItem((WaitCallback)(state =>
                {
                    List <Stream> choosedPhotos = new List <Stream>();
                    List <Stream> previewsPhotos = new List <Stream>();
                    List <Size> sizes = new List <Size>();
                    this._viewModel.PhotosVM.SuppressEXIFFetch = true;
                    IEnumerator <AlbumPhoto> enumerator4 = ((IEnumerable <AlbumPhoto>)Enumerable.Where <AlbumPhoto>(this._viewModel.PhotosVM.AlbumPhotos, (Func <AlbumPhoto, bool>)(ap => ap.IsSelected))).GetEnumerator();
                    try
                    {
                        while (enumerator4.MoveNext())
                        {
                            AlbumPhoto current = enumerator4.Current;
                            Stream imageStream = current.ImageStream;
                            if (imageStream != null)
                            {
                                choosedPhotos.Add(imageStream);
                                previewsPhotos.Add(current.ThumbnailStream);
                                Size size = new Size();
                                sizes.Add(size);
                            }
                        }
                    }
                    finally
                    {
                        if (enumerator4 != null)
                        {
                            enumerator4.Dispose();
                        }
                    }
                    Execute.ExecuteOnUIThread((Action)(() =>
                    {
                        ParametersRepository.SetParameterForId("ChoosenPhotos", choosedPhotos);
                        ParametersRepository.SetParameterForId("ChoosenPhotosPreviews", previewsPhotos);
                        ParametersRepository.SetParameterForId("ChoosenPhotosSizes", sizes);
                        this._quickPhotoPickCallback();
                        ((UIElement)this.borderLoading).Visibility = Visibility.Collapsed;
                        this._ds.Hide();
                    }));
                }));
                break;

            case AttachmentType.Video:
                List <NamedAttachmentType> attachmentTypes1 = new List <NamedAttachmentType>((IEnumerable <NamedAttachmentType>)AttachmentTypes.AttachmentVideoSubtypes);
                if (this.OwnerId < 0L && this._adminLevel > 1)
                {
                    attachmentTypes1.Add(AttachmentTypes.VideoCommunityType);
                }
                this.ShowAttachmentSubPickerFor(attachmentTypes1);
                break;

            case AttachmentType.Audio:
                Navigator.Current.NavigateToAudio(1, 0, false, 0, 0, "");
                break;

            case AttachmentType.Document:
                Navigator.Current.NavigateToDocumentsPicker(this._viewModel.MaxCount);
                break;

            case AttachmentType.Location:
                Navigator.Current.NavigateToMap(true, 0.0, 0.0);
                break;

            case AttachmentType.PhotoFromPhone:
                Navigator.Current.NavigateToPhotoPickerPhotos(this._viewModel.MaxCount, false, false);
                break;

            case AttachmentType.VideoFromPhone:
                this._ds.Hide();
                FileOpenPicker fileOpenPicker1 = new FileOpenPicker();
                fileOpenPicker1.ContinuationData["FilePickedType"] = (int)attachmentType;
                List <string> .Enumerator enumerator1 = VKConstants.SupportedVideoExtensions.GetEnumerator();
                try
                {
                    while (enumerator1.MoveNext())
                    {
                        string current = enumerator1.Current;
                        fileOpenPicker1.FileTypeFilter.Add(current);
                    }
                }
                finally
                {
                    enumerator1.Dispose();
                }
                fileOpenPicker1.ContinuationData["Operation"] = "VideoFromPhone";
                fileOpenPicker1.PickSingleFileAndContinue();
                break;

            case AttachmentType.DocumentFromPhone:
                this._ds.Hide();
                FileOpenPicker fileOpenPicker2 = new FileOpenPicker();
                ((IDictionary <string, object>)fileOpenPicker2.ContinuationData)["FilePickedType"] = attachmentType;
                List <string> .Enumerator enumerator2 = VKConstants.SupportedDocExtensions.GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        string current = enumerator2.Current;
                        fileOpenPicker2.FileTypeFilter.Add(current);
                    }
                }
                finally
                {
                    enumerator2.Dispose();
                }
                ((IDictionary <string, object>)fileOpenPicker2.ContinuationData)["Operation"] = "DocumentFromPhone";
                fileOpenPicker2.PickSingleFileAndContinue();
                break;

            case AttachmentType.PhotoMy:
                Navigator.Current.NavigateToPhotoAlbums(true, 0, false, 0);
                break;

            case AttachmentType.VideoMy:
                Navigator.Current.NavigateToVideo(true, 0, false, false);
                break;

            case AttachmentType.DocumentMy:
                Navigator.Current.NavigateToDocumentsPicker(this._viewModel.MaxCount);
                break;

            case AttachmentType.DocumentPhoto:
                this._ds.Hide();
                FileOpenPicker fileOpenPicker3 = new FileOpenPicker();
                ((IDictionary <string, object>)fileOpenPicker3.ContinuationData)["FilePickedType"] = attachmentType;
                List <string> .Enumerator enumerator3 = ((List <string>)VKConstants.SupportedDocLibraryExtensions).GetEnumerator();
                try
                {
                    while (enumerator3.MoveNext())
                    {
                        string current = enumerator3.Current;
                        fileOpenPicker3.FileTypeFilter.Add(current);
                    }
                }
                finally
                {
                    enumerator3.Dispose();
                }
                ((IDictionary <string, object>)fileOpenPicker3.ContinuationData)["Operation"] = "DocumentLibraryFromPhone";
                fileOpenPicker3.PickSingleFileAndContinue();
                break;

            case AttachmentType.Poll:
                Navigator.Current.NavigateToCreateEditPoll(this.OwnerId, 0, null);
                break;

            case AttachmentType.Timer:
                Navigator.Current.NavigateToPostSchedule(new DateTime?());
                break;

            case AttachmentType.PhotoCommunity:
                Navigator.Current.NavigateToPhotoAlbums(true, -this.OwnerId, true, this._adminLevel);
                break;

            case AttachmentType.VideoCommunity:
                Navigator.Current.NavigateToVideo(true, -this.OwnerId, true, false);
                break;

            case AttachmentType.Graffiti:
                if (this._conversationInfo == null)
                {
                    break;
                }
                this._ds.Hide();
                ParametersRepository.SetParameterForId("ConversationInfo", this._conversationInfo);
                Navigator.Current.NavigateToGraffitiDrawPage(this._conversationInfo.UserOrChatId, this._conversationInfo.IsChat, this._conversationInfo.Title);
                break;

            case AttachmentType.MoneyTransfer:
                Navigator.Current.NavigateToSendMoneyPage(this._conversationInfo.User.id, this._conversationInfo.User, 0, "");
                break;

            case AttachmentType.Gift:
                Navigator.Current.NavigateToGiftsCatalog(this._conversationInfo.UserOrChatId, this._conversationInfo.IsChat);
                break;
            }
        }
コード例 #31
0
 public void InsertPhoto(AlbumPhoto t)
 {
     _albumPhotoRepo.Save(t);
 }
コード例 #32
0
        public void DeletePhoto(AlbumPhoto t)
        {
            AlbumPhoto ap = _albumPhotoRepo.GetById(t.Id);

            _albumPhotoRepo.Delete(ap);
        }