なろうブックマーク分析用ツールのPrism+WPFサンプル実装
Revision | 2edbaf8e01cb89a40d001266c9df130abdb21ef9 (tree) |
---|---|
Zeit | 2022-08-07 12:48:06 |
Autor | yoshy <yoshy.org.bitbucket@gz.j...> |
Commiter | yoshy |
[UPD] ブックマーク詳細のサマリツールチップに作者名/ジャンル/キーワードの表示を追加
@@ -10,10 +10,20 @@ namespace TestNarou.Domain.Model.Entity.Child | ||
10 | 10 | ReactivePropertySlim<string> Title, |
11 | 11 | ReactivePropertySlim<string> Writer, |
12 | 12 | ReactivePropertySlim<string> Story, |
13 | + ReactivePropertySlim<int> BigGenre, | |
14 | + ReactivePropertySlim<int> Genre, | |
15 | + ReactivePropertySlim<string> Keyword, | |
16 | + ReactivePropertySlim<int> NovelType, | |
13 | 17 | ReactivePropertySlim<int> End, |
14 | 18 | ReactivePropertySlim<int> GeneralAllNo, |
15 | 19 | ReactivePropertySlim<int> Time, |
16 | 20 | ReactivePropertySlim<int> IsStop, |
21 | + ReactivePropertySlim<int> IsR15, | |
22 | + ReactivePropertySlim<int> IsBL, | |
23 | + ReactivePropertySlim<int> IsGL, | |
24 | + ReactivePropertySlim<int> IsZankoku, | |
25 | + ReactivePropertySlim<int> IsTensei, | |
26 | + ReactivePropertySlim<int> IsTenni, | |
17 | 27 | ReactivePropertySlim<int> GlobalPoint, |
18 | 28 | ReactivePropertySlim<int> DailyPoint, |
19 | 29 | ReactivePropertySlim<int> WeeklyPoint, |
@@ -39,10 +49,20 @@ namespace TestNarou.Domain.Model.Entity.Child | ||
39 | 49 | Title: new(), |
40 | 50 | Writer: new(), |
41 | 51 | Story: new(), |
52 | + BigGenre: new(), | |
53 | + Genre: new(), | |
54 | + Keyword: new(), | |
55 | + NovelType: new(), | |
42 | 56 | End: new(), |
43 | 57 | GeneralAllNo: new(), |
44 | 58 | Time: new(), |
45 | 59 | IsStop: new(), |
60 | + IsR15: new(), | |
61 | + IsBL: new(), | |
62 | + IsGL: new(), | |
63 | + IsZankoku: new(), | |
64 | + IsTensei: new(), | |
65 | + IsTenni: new(), | |
46 | 66 | GlobalPoint: new(), |
47 | 67 | DailyPoint: new(), |
48 | 68 | WeeklyPoint: new(), |
@@ -63,10 +83,19 @@ namespace TestNarou.Domain.Model.Entity.Child | ||
63 | 83 | this.Title.AddTo(this.disposables); |
64 | 84 | this.Writer.AddTo(this.disposables); |
65 | 85 | this.Story.AddTo(this.disposables); |
86 | + this.BigGenre.AddTo(this.disposables); | |
87 | + this.Genre.AddTo(this.disposables); | |
88 | + this.Keyword.AddTo(this.disposables); | |
89 | + this.NovelType.AddTo(this.disposables); | |
66 | 90 | this.End.AddTo(this.disposables); |
67 | 91 | this.GeneralAllNo.AddTo(this.disposables); |
68 | 92 | this.Time.AddTo(this.disposables); |
69 | 93 | this.IsStop.AddTo(this.disposables); |
94 | + this.IsR15.AddTo(this.disposables); | |
95 | + this.IsBL.AddTo(this.disposables); | |
96 | + this.IsGL.AddTo(this.disposables); | |
97 | + this.IsZankoku.AddTo(this.disposables); | |
98 | + this.IsTensei.AddTo(this.disposables); | |
70 | 99 | this.GlobalPoint.AddTo(this.disposables); |
71 | 100 | this.DailyPoint.AddTo(this.disposables); |
72 | 101 | this.WeeklyPoint.AddTo(this.disposables); |
@@ -27,13 +27,23 @@ namespace TestNarou.Domain.Translator | ||
27 | 27 | { |
28 | 28 | mappingExpression |
29 | 29 | .ForMember(d => d.NCode, opts => opts.MapFrom(s => s.NCode)) |
30 | - .ForMember(d => d.Title, opts => opts.MapFrom(s => s.Title)) | |
30 | + .ForMember(d => d.Title, opts => opts.MapFrom(s => s.Title.Trim())) | |
31 | 31 | .ForMember(d => d.Writer, opts => opts.MapFrom(s => s.Writer)) |
32 | - .ForMember(d => d.End, opts => opts.MapFrom(s => s.End)) | |
33 | 32 | .ForMember(d => d.Story, opts => opts.MapFrom(s => s.Story)) |
33 | + .ForMember(d => d.BigGenre, opts => opts.MapFrom(s => s.BigGenre)) | |
34 | + .ForMember(d => d.Genre, opts => opts.MapFrom(s => s.Genre)) | |
35 | + .ForMember(d => d.Keyword, opts => opts.MapFrom(s => s.Keyword)) | |
36 | + .ForMember(d => d.NovelType, opts => opts.MapFrom(s => s.NovelType)) | |
37 | + .ForMember(d => d.End, opts => opts.MapFrom(s => s.End)) | |
34 | 38 | .ForMember(d => d.GeneralAllNo, opts => opts.MapFrom(s => s.GeneralAllNo)) |
35 | 39 | .ForMember(d => d.Time, opts => opts.MapFrom(s => s.Time)) |
36 | 40 | .ForMember(d => d.IsStop, opts => opts.MapFrom(s => s.IsStop)) |
41 | + .ForMember(d => d.IsR15, opts => opts.MapFrom(s => s.IsR15)) | |
42 | + .ForMember(d => d.IsBL, opts => opts.MapFrom(s => s.IsBL)) | |
43 | + .ForMember(d => d.IsGL, opts => opts.MapFrom(s => s.IsGL)) | |
44 | + .ForMember(d => d.IsZankoku, opts => opts.MapFrom(s => s.IsZankoku)) | |
45 | + .ForMember(d => d.IsTensei, opts => opts.MapFrom(s => s.IsTensei)) | |
46 | + .ForMember(d => d.IsTenni, opts => opts.MapFrom(s => s.IsTenni)) | |
37 | 47 | .ForMember(d => d.GlobalPoint, opts => opts.MapFrom(s => s.GlobalPoint)) |
38 | 48 | .ForMember(d => d.DailyPoint, opts => opts.MapFrom(s => s.DailyPoint)) |
39 | 49 | .ForMember(d => d.WeeklyPoint, opts => opts.MapFrom(s => s.WeeklyPoint)) |
@@ -1,6 +1,6 @@ | ||
1 | 1 | using AutoMapper; |
2 | 2 | using Reactive.Bindings; |
3 | -using System; | |
3 | +using System.Collections.Generic; | |
4 | 4 | using System.Reactive.Linq; |
5 | 5 | using System.Text; |
6 | 6 | using TestNarou.Adaptor.Gateway.ViewModel.Child; |
@@ -15,14 +15,127 @@ namespace TestNarou.Adaptor.Translator.Converter | ||
15 | 15 | BookmarkDetailListRow source, BookmarkDetailListRowViewModel destination, |
16 | 16 | ReadOnlyReactiveProperty<string> destMember, ResolutionContext context) |
17 | 17 | { |
18 | - return source.Title.CombineLatest(source.Story, (title, story) => Convert(title, story)).ToReadOnlyReactiveProperty(); | |
18 | + return source.Title.CombineLatest( | |
19 | + source.Writer, | |
20 | + source.Story, | |
21 | + source.BigGenre, | |
22 | + source.Genre, | |
23 | + source.Keyword, | |
24 | + source.NovelType, | |
25 | + source.IsR15, | |
26 | + source.IsBL, | |
27 | + source.IsGL, | |
28 | + source.IsZankoku, | |
29 | + source.IsTensei, | |
30 | + source.IsTenni, | |
31 | + ( | |
32 | + title, | |
33 | + writer, | |
34 | + story, | |
35 | + bigGenre, | |
36 | + genre, | |
37 | + keyword, | |
38 | + novelType, | |
39 | + isR15, | |
40 | + isBL, | |
41 | + isGL, | |
42 | + isZankoku, | |
43 | + isTensei, | |
44 | + isTenni | |
45 | + ) => Convert( | |
46 | + title, | |
47 | + writer, | |
48 | + story, | |
49 | + bigGenre, | |
50 | + genre, | |
51 | + keyword, | |
52 | + novelType, | |
53 | + isR15, | |
54 | + isBL, | |
55 | + isGL, | |
56 | + isZankoku, | |
57 | + isTensei, | |
58 | + isTenni | |
59 | + ) | |
60 | + ).ToReadOnlyReactiveProperty(); | |
19 | 61 | } |
20 | 62 | |
21 | - private static string Convert(string title, string story) | |
63 | + private static IDictionary<int, string> BigGenreMap => new Dictionary<int, string>() | |
64 | + { | |
65 | + { 1, "恋愛" }, | |
66 | + { 2, "ファンタジー" }, | |
67 | + { 3, "文芸" }, | |
68 | + { 4, "SF" }, | |
69 | + { 99, "その他" }, | |
70 | + { 98, "ノンジャンル" }, | |
71 | + }; | |
72 | + | |
73 | + private static IDictionary<int, string> GenreMap => new Dictionary<int, string>() | |
74 | + { | |
75 | + { 101, "異世界" }, | |
76 | + { 102, "現実世界" }, | |
77 | + { 201, "ハイファンタジー" }, | |
78 | + { 202, "ローファンタジー" }, | |
79 | + { 301, "純文学" }, | |
80 | + { 302, "ヒューマンドラマ" }, | |
81 | + { 303, "歴史" }, | |
82 | + { 304, "推理" }, | |
83 | + { 305, "ホラー" }, | |
84 | + { 306, "アクション" }, | |
85 | + { 307, "コメディー" }, | |
86 | + { 401, "VRゲーム" }, | |
87 | + { 402, "宇宙" }, | |
88 | + { 403, "空想科学" }, | |
89 | + { 404, "パニック" }, | |
90 | + { 9901, "童話" }, | |
91 | + { 9902, "詩" }, | |
92 | + { 9903, "エッセイ" }, | |
93 | + { 9904, "リプレイ" }, | |
94 | + { 9999, "その他" }, | |
95 | + { 9801, "ノンジャンル" }, | |
96 | + }; | |
97 | + | |
98 | + private static string Convert( | |
99 | + string title, | |
100 | + string writer, | |
101 | + string story, | |
102 | + int bigGenre, | |
103 | + int genre, | |
104 | + string keyword, | |
105 | + int novelType, | |
106 | + int isR15, | |
107 | + int isBL, | |
108 | + int isGL, | |
109 | + int isZankoku, | |
110 | + int isTensei, | |
111 | + int isTenni | |
112 | + ) | |
22 | 113 | { |
23 | 114 | StringBuilder buf = new(); |
24 | 115 | |
25 | - buf.AppendLine(title); | |
116 | + buf.Append(title); | |
117 | + buf.Append('('); | |
118 | + buf.Append(novelType switch { 1 => "連載", 2 => "短編", _ => "不明" }); | |
119 | + buf.Append(':'); | |
120 | + buf.Append(BigGenreMap[bigGenre]); | |
121 | + buf.Append('/'); | |
122 | + buf.Append(GenreMap[genre]); | |
123 | + buf.Append(')'); | |
124 | + buf.AppendLine(); | |
125 | + buf.Append('/'); | |
126 | + buf.AppendLine(writer); | |
127 | + buf.AppendLine(); | |
128 | + buf.Append("必須キーワード:"); | |
129 | + if (isR15 == 1) buf.Append("R15 "); | |
130 | + if (isBL == 1) buf.Append("BL "); | |
131 | + if (isGL == 1) buf.Append("GL "); | |
132 | + if (isZankoku == 1) buf.Append("残酷 "); | |
133 | + if (isTensei == 1) buf.Append("異世界転生 "); | |
134 | + if (isTenni == 1) buf.Append("異世界転移 "); | |
135 | + buf.AppendLine(); | |
136 | + buf.Append("キーワード:"); | |
137 | + buf.Append(keyword); | |
138 | + buf.AppendLine(); | |
26 | 139 | buf.AppendLine(); |
27 | 140 | buf.Append(story); |
28 | 141 |