コード例 #1
0
 private void InitializeSubMenu(UserDetailParameter param, bool mode)
 {
     IsEnabledSubMenu = mode;
     SubParameters    = ParamGen.GenerateRaw(param, w => w.ContentType)
                        .Do(w => w.ProfileType = (ProfileType)SelectedIndex)
                        .Cast <object>()
                        .ToList();
 }
コード例 #2
0
        private async void Follow()
        {
            if (IsFollowing.Value)
            {
                await _pixivClient.User.Follow.DeleteAsunc(user_id => _id, restrict => "public");
            }
            else
            {
                await _pixivClient.User.Follow.AddAsync(user_id => _id, restrict => "public");
            }
            IsFollowing.Value = !IsFollowing.Value;
            ((User)_userDetail.User).IsFollowed = IsFollowing.Value;
            var param1 = new UserDetailParameter
            {
                Detail      = _userDetail,
                ProfileType = ProfileType.Work,
                ContentType = ContentType.Illust
            };

            Parameter = ParamGen.GenerateRaw(param1, v => v.ProfileType).Cast <object>().Skip(1).ToList();
        }
コード例 #3
0
 private void Sync()
 {
     ParameterQueries = ParamGen.GenerateRaw(_favoriteOption, w => w.Type).Cast <object>().ToList();
     _pixivFavorite.Query(_favoriteOption);
 }
コード例 #4
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();
        }