public MediaListSectionViewModel(string title, int titleCounter, MediaListItemViewModelBase listItemViewModel, Action tapAction) { this.Title = title; this.TitleCounter = UIStringFormatterHelper.FormatForUIVeryShort((long)titleCounter); this.ListItemViewModel = listItemViewModel; this.TapAction = tapAction; }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { MediaListItemViewModelBase itemViewModelBase = item as MediaListItemViewModelBase; if (itemViewModelBase == null) { return(null); } switch (itemViewModelBase.Type) { case ProfileMediaListItemType.Generic: return(this.GenericTemplate); case ProfileMediaListItemType.PhotoAlbum: return(this.PhotoAlbumTemplate); case ProfileMediaListItemType.VideoAlbum: return(this.VideoAlbumTemplate); case ProfileMediaListItemType.Subscriptions: return(this.SubscriptionsTemplate); case ProfileMediaListItemType.Photo: return(this.PhotoTemplate); case ProfileMediaListItemType.Video: return(this.VideoTemplate); case ProfileMediaListItemType.Audio: return(this.AudioTemplate); case ProfileMediaListItemType.Discussions: return(this.DiscussionsTemplate); case ProfileMediaListItemType.Product: return(this.ProductTemplate); case ProfileMediaListItemType.Gifts: return(this.GiftsTemplate); case ProfileMediaListItemType.EmptyData: return(this.EmptyDataTemplate); default: return(null); } }
public void HandlePhotoDeleted(PhotoDeletedFromAlbum message) { IProfileData profileData = this._profileData; long num = profileData != null ? profileData.Id : 0L; if (num == 0L) { return; } if (this._isGroup) { num *= -1L; } if (message.OwnerId != num || this.Items == null) { return; } using (IEnumerator <MediaListItemViewModelBase> enumerator = this.Items.GetEnumerator()) { while (enumerator.MoveNext()) { MediaListItemViewModelBase current = enumerator.Current; PhotoMediaListItemViewModel listItemViewModel = current as PhotoMediaListItemViewModel; Photo photo = listItemViewModel != null ? listItemViewModel.Photo : null; if (photo != null && photo.id == message.PhotoId) { this._cachedSources.RemoveAt(this.Items.IndexOf(current)); this._profileData.photos.items.Remove(photo); this.Items.Remove(current); --this._profileData.photos.count; // ISSUE: type reference // ISSUE: method reference this.NotifyPropertyChanged <int>(() => this.Count); break; } } } }