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(); }
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(); }
private void Initialize(UserDetailParameter parameter, bool full = true) { _categoryService.UpdateCategory(); if (parameter == null) { // オフライン IsFollowing = false; _isOffline = true; return; } SelectedIndex = (int)parameter.ProfileType; if (parameter.ProfileType == ProfileType.Work) { SubSelectedIndex1 = (int)parameter.ContentType; } else { SubSelectedIndex2 = parameter.ContentType == ContentType.Illust ? 0 : 1; } Username = parameter.Detail.User.Name; ScreenName = $"@{parameter.Detail.User.AccountName}"; Url = parameter.Detail.Profile.Webpage; IsFollowing = parameter.Detail.User.IsFollowed; _id = parameter.Detail.User.Id; if (!string.IsNullOrWhiteSpace(parameter.Detail.Profile.Webpage)) { NavigateUrl = new Uri(parameter.Detail.Profile.Webpage); } if (full) { Thumbnailable = new PixivUserImage(parameter.Detail.User, _imageStoreService); if (string.IsNullOrWhiteSpace(parameter.Detail.Profile.BackgroundImageUrl)) { Thumbnailable2 = new PixivUserImage(parameter.Detail.User, _imageStoreService); } else { Thumbnailable2 = new PixivUrlImage(parameter.Detail.Profile.BackgroundImageUrl, _imageStoreService); } } var param1 = new UserDetailParameter { Detail = parameter.Detail, ProfileType = ProfileType.Work, ContentType = ContentType.Illust }; var param2 = (UserDetailParameter)param1.Clone(); param2.ProfileType = ProfileType.Favorite; Parameter = new List <object> { new DetailByIdParameter { Id = parameter.Detail.User.Id }, param1, param2 }; if (parameter.ProfileType == ProfileType.Work) { InitializeSubMenu(param1, true); if (!full) { return; } _pixivWork = new PixivWork(parameter.Detail.User.Id, parameter.ContentType, _pixivClient, _queryCacheService); if (parameter.ContentType != ContentType.Novel) { ModelHelper.ConnectTo(Collection, _pixivWork, w => w.Illusts, CreatePixivImage).AddTo(this); } else { ModelHelper.ConnectTo(Collection, _pixivWork, w => w.Novels, CreatePixivNovel).AddTo(this); } } else { InitializeSubMenu(param1, false); if (!full) { return; } _pixivFavorite = new PixivFavorite(_pixivClient, _queryCacheService); if (parameter.ContentType != ContentType.Novel) { ModelHelper.ConnectTo(Collection, _pixivFavorite, w => w.ResultIllusts, CreatePixivImage) .AddTo(this); } else { ModelHelper.ConnectTo(Collection, _pixivFavorite, w => w.ResultNovels, CreatePixivNovel).AddTo(this); } _pixivFavorite.Query(new FavoriteOptionParameter { Restrict = RestrictType.Public, Type = parameter.ContentType.ToSearchType(), Tag = "", UserId = parameter.Detail.User.Id }); } }
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(); }
public async Task UserDetailAsync(UserDetailParameter screen_name) { Messenger.Notify("ShowUserDetail", UserDetail); this.UserDetail.OwnerAccount = GetAccount(screen_name.OwnerScreenName); this.UserDetail.Set(await GetAccount(screen_name.OwnerScreenName).TwitterClient.GetAccountInformationAsync(screen_name.ScreenName), (await GetAccount(screen_name.OwnerScreenName).TwitterClient.GetUserTimeLineAsync(screen_name.ScreenName, 100)).Select(q => new TimelineRow(q, screen_name.OwnerScreenName, Setting, CallRowAction)).ToList()); }