public ImageViewModel(Media media) { CurrentMedia = media; CurrentUser = CurrentMedia.user; RelatedMedia = new UserMedia(CurrentUser); Init(); }
public async void Init() { try { await RelatedMedia.Init(); } catch (Exception) { Debug.WriteLine("Error when trying to init"); } if (CurrentMedia == null) { if (RelatedMedia.Any()) CurrentMedia = RelatedMedia.First(); else { Media tmpMedia = new Media(); tmpMedia.images = new Images(); tmpMedia.images.standard_resolution = new StandardResolution(); tmpMedia.images.standard_resolution.url = "ms-appx:/Assets/No_pictures.gif"; tmpMedia.comments = new Comments(); tmpMedia.comments.count = 0; tmpMedia.comments.data = new List<Comment>(); tmpMedia.user = CurrentUser; CurrentMedia = tmpMedia; } OnPropertyChanged("CurrentMedia"); } else { if (CurrentMedia.comments.count != CurrentMedia.comments.observableData.Count) CurrentMedia.comments.observableData.Clear(); } LoadUserInfo(CurrentUser.id); LoadComments(); }
public void LoadNewMedia(Media media) { media.user = CurrentUser; CurrentMedia = media; OnPropertyChanged("CurrentMedia"); }