Ejemplo n.º 1
0
 internal void DeleteAlbum(AudioAlbumHeader h)
 {
     AudioService.Instance.DeleteAlbum(h.Album.album_id, (Action <BackendResult <object, ResultCode> >)(res => { }));
     EventAggregator.Current.Publish(new AudioAlbumCreatedEditedDeleted()
     {
         Album   = h.Album,
         Created = new bool?()
     });
 }
Ejemplo n.º 2
0
        public void Handle(AudioAlbumCreatedEditedDeleted message)
        {
            if (message.Album.owner_id != this.UserOrGroupId)
            {
                return;
            }
            bool?created = message.Created;

            if (created.HasValue)
            {
                created = message.Created;
                if (created.Value)
                {
                    int ind = 0;
                    if (this._allAlbums.Collection.Count > 0 && this._allAlbums.Collection.First <AudioAlbumHeader>().Album.album_id == AllAlbumsViewModel.RECOMMENDED_ALBUM_ID)
                    {
                        ++ind;
                    }
                    if (this._allAlbums.Collection.Count > 1 && this._allAlbums.Collection[1].Album.album_id == AllAlbumsViewModel.POPULAR_ALBUM_ID)
                    {
                        ++ind;
                    }
                    this._allAlbums.Insert(new AudioAlbumHeader(message.Album), ind);
                    return;
                }
            }
            created = message.Created;
            if (created.HasValue)
            {
                AudioAlbumHeader audioAlbumHeader = (AudioAlbumHeader)Enumerable.FirstOrDefault <AudioAlbumHeader>(this._allAlbums.Collection, (Func <AudioAlbumHeader, bool>)(a => a.Album.album_id == message.Album.album_id));
                if (audioAlbumHeader == null)
                {
                    return;
                }
                audioAlbumHeader.Title = message.Album.title;
            }
            else
            {
                AudioAlbumHeader audioAlbumHeader = (AudioAlbumHeader)Enumerable.FirstOrDefault <AudioAlbumHeader>(this._allAlbums.Collection, (Func <AudioAlbumHeader, bool>)(a => a.Album.album_id == message.Album.album_id));
                if (audioAlbumHeader == null)
                {
                    return;
                }
                this._allAlbums.Delete(audioAlbumHeader);
            }
        }