Example #1
0
 private void LoggedIn()
 {
     if (Username == _accountService.LoggedInAccount.Name)
     {
         return;
     }
     Username      = _accountService.LoggedInAccount.Name;
     Thumbnailable = new PixivUserImage(_accountService.LoggedInAccount, _imageStoreService);
     Thumbnailable.ObserveProperty(w => w.ThumbnailPath)
     .Where(w => !string.IsNullOrWhiteSpace(w))
     .ObserveOnUIDispatcher()
     .Subscribe(w => ThumbnailPath = w)
     .AddTo(this);
 }
Example #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
        }