public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
 {
     base.OnNavigatedTo(e, viewModelState);
     if (_accountService.IsLoggedIn)
     {
         Initialize();
     }
     else
     {
         RunHelper.RunLaterUI(RedirectToLoginPage, TimeSpan.FromMilliseconds(10));
     }
 }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);
            var parameter = ParameterBase.ToObject <FollowingParameter>((string)e.Parameter);

            if (_accountService.IsLoggedIn)
            {
                Initialize(parameter);
            }
            else
            {
                RunHelper.RunLaterUI(RedirectToLoginPage, parameter, TimeSpan.FromMilliseconds(10));
            }
        }
 private void AddEventHandler()
 {
     if (RootFrame != null)
     {
         RootFrame.Navigating += RootFrameOnNavigating;
         _disposable           = Observable.Interval(TimeSpan.FromMilliseconds(100))
                                 .ObserveOnUIDispatcher()
                                 .Where(w => CategoryService.UpdateRequired)
                                 .Subscribe(w =>
         {
             AssociatedObject.SelectionChanged -= OnSelectionChanged;
             if (CategoryService.Index >= 0)
             {
                 AssociatedObject.SelectedIndex = CategoryService.Index;
             }
             SetTitle(CategoryService.Name);
             AssociatedObject.SelectionChanged += OnSelectionChanged;
         });
         return;
     }
     RunHelper.RunLaterUI(AddEventHandler, TimeSpan.FromMilliseconds(100));
 }
        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
        }
 protected override void OnAttached()
 {
     base.OnAttached();
     AssociatedObject.SelectionChanged += OnSelectionChanged;
     RunHelper.RunLaterUI(AddEventHandler, TimeSpan.FromMilliseconds(500));
 }