Ejemplo n.º 1
0
        internal void AddOrUpdateAlbum(Album createdOrUpdatedAlbum)
        {
            Func <AlbumHeader, bool> _9__1 = null;

            Execute.ExecuteOnUIThread(delegate
            {
                AlbumHeader albumHeader = this.FindByAlbumId(createdOrUpdatedAlbum.aid);
                if (albumHeader != null)
                {
                    albumHeader.Album = createdOrUpdatedAlbum;
                    albumHeader.ReadDataFromAlbumField();
                    IEnumerable <AlbumHeader> arg_5B_0 = this.EditAlbumsVM.Collection;
                    Func <AlbumHeader, bool> arg_5B_1;
                    if ((arg_5B_1 = _9__1) == null)
                    {
                        arg_5B_1 = (_9__1 = ((AlbumHeader ah) => ah.AlbumId == createdOrUpdatedAlbum.aid));
                    }
                    AlbumHeader albumHeader2 = Enumerable.FirstOrDefault <AlbumHeader>(arg_5B_0, arg_5B_1);
                    if (albumHeader2 != null)
                    {
                        albumHeader2.Album = createdOrUpdatedAlbum;
                        albumHeader2.ReadDataFromAlbumField();
                        return;
                    }
                }
                else
                {
                    AlbumHeader albumHeader3 = new AlbumHeader
                    {
                        AlbumType = AlbumType.NormalAlbum,
                        Album     = createdOrUpdatedAlbum
                    };
                    albumHeader3.ImageUri = (albumHeader3.ImageUriSmall = "https://vk.com/images/m_noalbum.png");
                    albumHeader3.ReadDataFromAlbumField();
                    this.EditAlbumsVM.Insert(albumHeader3, 0);
                    if (this.AlbumsVM.Collection.Count > 1)
                    {
                        this.AlbumsVM.Collection[1].Insert(0, albumHeader3);
                    }
                    else
                    {
                        GenericCollectionViewModel <AlbumsData, Group <AlbumHeader> > arg_130_0 = this.AlbumsVM;
                        string arg_116_0            = PhotosMainViewModel.FormatAlbumsCount(1);
                        List <AlbumHeader> expr_10E = new List <AlbumHeader>();
                        expr_10E.Add(albumHeader3);
                        arg_130_0.Insert(new Group <AlbumHeader>(arg_116_0, expr_10E, false), this.AlbumsVM.Collection.Count);
                    }
                    this.UpdateAlbums();
                    this.UpdateAlbumsCount();
                    if (!this._inAlbumCreatedHandler)
                    {
                        EventAggregator.Current.Publish(new PhotoAlbumCreated
                        {
                            Album       = createdOrUpdatedAlbum,
                            EventSource = this.GetHashCode()
                        });
                    }
                }
            });
        }
Ejemplo n.º 2
0
        private void ApplyAlbumAction(string aid, Action <AlbumHeader> action)
        {
            AlbumHeader albumHeader = Enumerable.FirstOrDefault <AlbumHeader>(this.EditAlbumsVM.Collection, (AlbumHeader ah) => ah.AlbumId == aid);

            if (albumHeader != null)
            {
                action.Invoke(albumHeader);
            }
            AlbumHeader albumHeader2 = this.FindByAlbumId(aid);

            if (albumHeader2 != null)
            {
                if (albumHeader == null || albumHeader != albumHeader2)
                {
                    action.Invoke(albumHeader2);
                }
                albumHeader2.ReadDataFromAlbumField();
                return;
            }
            this.AlbumsVM.LoadData(true, false, null, false);
        }