Esempio n. 1
0
        public RankingNovelViewModel(INovel novel, RankingMode mode, IImageStoreService imageStoreService,
                                     INavigationService navigationService)
            : base(mode, imageStoreService, navigationService)
        {
            Title = novel.Title;

            ThumbnailPath = PyxisConstants.DummyImage;
            Thumbnailable = new PixivNovel(novel, imageStoreService);
        }
Esempio n. 2
0
        private void Initialize()
        {
            _categoryService.UpdateCategory();
            _browsingHistoryService.Add(_novel);
            Title         = _novel.Title;
            ConvertValues = new List <object> {
                _novel.Caption, _navigationService
            };
            CreatedAt     = _novel.CreateDate.ToString("g");
            Username      = _novel.User.Name;
            View          = _novel.TotalView;
            BookmarkCount = _novel.TotalBookmarks;
            IsBookmarked  = _novel.IsBookmarked;
            TextLength    = $"{_novel.TextLength.ToString("##,###")}文字";
            _novel.Tags.ForEach(w => Tags.Add(new PixivTagViewModel(w, _navigationService)));
            Thumbnailable = new PixivNovel(_novel, _imageStoreService);
            _pixivUser    = new PixivUserImage(_novel.User, _imageStoreService);
            _pixivUser.ObserveProperty(w => w.ThumbnailPath)
            .Where(w => !string.IsNullOrWhiteSpace(w))
            .ObserveOnUIDispatcher()
            .Subscribe(w => IconPath = w)
            .AddTo(this);
            _pixivComment = new PixivComment(_novel, _pixivClient, _queryCacheService);
            _pixivComment.Comments.ObserveAddChanged()
            .Where(w => ++ _count <= 5)
            .Select(CreatePixivComment)
            .ObserveOnUIDispatcher()
            .Subscribe(w => Comments.Add(w))
            .AddTo(this);
#if !OFFLINE
            if (IconPath == PyxisConstants.DummyIcon)
            {
                RunHelper.RunLaterUI(_pixivUser.ShowThumbnail, TimeSpan.FromMilliseconds(100));
            }
#endif
        }