public PhotoDetailViewModel(ObservableCollection<PhotoContainerViewModel> photoViewModelList, PhotoContainerViewModel currentPhotoContainerViewModel) : this() { _PhotoViewModelList = photoViewModelList; CurrentIndex = photoViewModelList.IndexOf(currentPhotoContainerViewModel); this.OnPropertyChanged(() => this.CurrentImage); }
/// <summary> /// 数据获取 /// </summary> /// <returns></returns> public static ObservableCollection<PhotoContainerViewModel> ConvertToViewModelDataList(IEnumerable<PhotoContainerModel> model) { _PhotoViewModelList = new ObservableCollection<PhotoContainerViewModel>(); model.ToList().ForEach(row => { PhotoContainerViewModel photoViewModel = new PhotoContainerViewModel(); photoViewModel.PhotoNum = row.PhotoNum; photoViewModel.Image = File.ReadAllBytes(row.ImagePath); photoViewModel.MatchType = row.MatchType; photoViewModel.IsSelected = false; _PhotoViewModelList.Add(photoViewModel); }); return _PhotoViewModelList; }