示例#1
0
 private void Initialize(DetailByIdParameter parameter)
 {
     _count       = 0;
     _pixivDetail = new PixivDetail(parameter.Id, SearchType.Novels, _pixivClient, _queryCacheService);
     _pixivDetail.ObserveProperty(w => w.NovelDetail)
     .Where(w => w != null)
     .ObserveOnUIDispatcher()
     .Subscribe(w =>
     {
         _novel = w;
         Initialize();
     }).AddTo(this);
     _pixivDetail.Fetch();
 }
示例#2
0
        private void Initialie(DetailByIdParameter parameter)
        {
            _categoryService.UpdateCategory();
            if (parameter == null)
            {
                // オフライン
                IsFollowing = new ReactiveProperty <bool>(false);
                _isOffline  = true;
                return;
            }
            _id        = string.IsNullOrWhiteSpace(parameter.Id) ? _accountService.LoggedInAccount.Id : parameter.Id;
            _pixivUser = new PixivDetail(_id, SearchType.Users, _pixivClient, _queryCacheService);
            var observer = _pixivUser.ObserveProperty(w => w.UserDetail).Where(w => w != null).Publish();

            observer.ObserveOnUIDispatcher().Subscribe(w =>
            {
                _userDetail   = w;
                Thumbnailable = new PixivUserImage(w.User, _imageStoreService);
                if (string.IsNullOrWhiteSpace(w.Profile.BackgroundImageUrl))
                {
                    Thumbnailable2 = new PixivUserImage(w.User, _imageStoreService);
                }
                else
                {
                    Thumbnailable2 = new PixivUrlImage(w.Profile.BackgroundImageUrl, _imageStoreService);
                }
                var param1 = new UserDetailParameter
                {
                    Detail      = w,
                    ProfileType = ProfileType.Work,
                    ContentType = ContentType.Illust
                };
                Parameter = ParamGen.GenerateRaw(param1, v => v.ProfileType).Cast <object>().Skip(1).ToList();
            });
            Username    = observer.Select(w => w.User.Name).ToReadOnlyReactiveProperty().AddTo(this);
            ScreenName  = observer.Select(w => $"@{w.User.AccountName}").ToReadOnlyReactiveProperty().AddTo(this);
            Url         = observer.Select(w => w.Profile.Webpage).ToReadOnlyReactiveProperty().AddTo(this);
            NavigateUrl = observer.Select(w => w.Profile.Webpage)
                          .Where(w => !string.IsNullOrWhiteSpace(w))
                          .Select(w => new Uri(w))
                          .ToReadOnlyReactiveProperty()
                          .AddTo(this);
            Gender = observer.Select(w => w.Profile.Gender)
                     .Where(w => !string.IsNullOrWhiteSpace(w))
                     .Select(w => w.ToLower() == "male" ? Resources.GetString("Male") : Resources.GetString("Famale"))
                     .ToReadOnlyReactiveProperty()
                     .AddTo(this);
            Region     = observer.Select(w => w.Profile.Region).ToReadOnlyReactiveProperty().AddTo(this);
            Birthday   = observer.Select(w => w.Profile.Birth).ToReadOnlyReactiveProperty().AddTo(this);
            Job        = observer.Select(w => w.Profile.Job).ToReadOnlyReactiveProperty().AddTo(this);
            Twitter    = observer.Select(w => w.Profile.TwitterAccount).ToReadOnlyReactiveProperty().AddTo(this);
            TwitterUrl = observer.Select(w => w.Profile.TwitterAccount)
                         .Where(w => !string.IsNullOrWhiteSpace(w))
                         .Select(w => new Uri($"https://twitter.com/{w}"))
                         .ToReadOnlyReactiveProperty()
                         .AddTo(this);
            Description = observer.Select(w => w.User.Comment).ToReadOnlyReactiveProperty().AddTo(this);
            Computer    = observer.Select(w => w.Workspace.Pc).ToReadOnlyReactiveProperty().AddTo(this);
            Monitor     = observer.Select(w => w.Workspace.Monitor).ToReadOnlyReactiveProperty().AddTo(this);
            Software    = observer.Select(w => w.Workspace.Tool).ToReadOnlyReactiveProperty().AddTo(this);
            Scanner     = observer.Select(w => w.Workspace.Scanner).ToReadOnlyReactiveProperty().AddTo(this);
            Tablet      = observer.Select(w => w.Workspace.Tablet).ToReadOnlyReactiveProperty().AddTo(this);
            Mouse       = observer.Select(w => w.Workspace.Monitor).ToReadOnlyReactiveProperty().AddTo(this);
            Printer     = observer.Select(w => w.Workspace.Printer).ToReadOnlyReactiveProperty().AddTo(this);
            Desktop     = observer.Select(w => w.Workspace.Desktop).ToReadOnlyReactiveProperty().AddTo(this);
            Bgm         = observer.Select(w => w.Workspace.Music).ToReadOnlyReactiveProperty().AddTo(this);
            Table       = observer.Select(w => w.Workspace.Desk).ToReadOnlyReactiveProperty().AddTo(this);
            Chair       = observer.Select(w => w.Workspace.Chair).ToReadOnlyReactiveProperty().AddTo(this);
            Other       = observer.Select(w => w.Workspace.Comment).ToReadOnlyReactiveProperty().AddTo(this);
            IsFollowing = observer.Select(w => w.User.IsFollowed).ToReactiveProperty().AddTo(this);
            observer.Connect().AddTo(this);

            _pixivUser.Fetch();
        }