なろうブックマーク分析用ツールのPrism+WinUI3サンプル実装
修订版 | 2534e928761185d4b51ac10a0e0085616db97401 (tree) |
---|---|
时间 | 2022-08-25 03:27:07 |
作者 | yoshy <yoshy.org.bitbucket@gz.j...> |
Commiter | yoshy |
Merge branch 'feature/sorting_bookmark_datagrid'
@@ -14,6 +14,7 @@ namespace TestNarou3.Adaptor.Boundary.Gateway.ViewModel.Child | ||
14 | 14 | ReadOnlyReactiveProperty<int> Time { get; } |
15 | 15 | ReadOnlyReactiveProperty<string> IsStop { get; } |
16 | 16 | ReadOnlyReactiveProperty<int> GlobalPoint { get; } |
17 | + ReadOnlyReactiveProperty<int> PointPerMin { get; } | |
17 | 18 | ReadOnlyReactiveProperty<int> DailyPoint { get; } |
18 | 19 | ReadOnlyReactiveProperty<int> WeeklyPoint { get; } |
19 | 20 | ReadOnlyReactiveProperty<int> MonthlyPoint { get; } |
@@ -1,4 +1,5 @@ | ||
1 | -using ObservableCollections; | |
1 | +using CleanAuLait.ObservableCollectionsMod; | |
2 | +using ObservableCollections; | |
2 | 3 | using Reactive.Bindings; |
3 | 4 | using TestNarou3.Adaptor.Boundary.Controller; |
4 | 5 | using TestNarou3.Adaptor.Boundary.Gateway.ViewModel.Child; |
@@ -1,7 +1,5 @@ | ||
1 | -using ObservableCollections; | |
1 | +using CleanAuLait.ObservableCollectionsMod; | |
2 | 2 | using Reactive.Bindings; |
3 | -using System; | |
4 | -using System.ComponentModel; | |
5 | 3 | using TestNarou3.Adaptor.Boundary.Gateway.ViewModel.Child; |
6 | 4 | using TestNarou3.Domain.Model.Entity; |
7 | 5 | using TestNarou3.Domain.Model.Entity.Child; |
@@ -23,5 +21,8 @@ namespace TestNarou3.Adaptor.Boundary.Gateway.ViewModel | ||
23 | 21 | BookmarkDetailList Source { get; } |
24 | 22 | |
25 | 23 | void SynchronizeWith(BookmarkDetailList list); |
24 | + | |
25 | + void SortByValueColumn<TValueColumn>(string tag, Func<BookmarkDetailListRow, TValueColumn> selector, bool asceding); | |
26 | + void SortByViewColumn<TViewColumn>(string tag, Func<IBookmarkDetailListRowViewModel, TViewColumn> selector, bool asceding); | |
26 | 27 | } |
27 | 28 | } |
@@ -1,6 +1,6 @@ | ||
1 | 1 | using CleanAuLait.Core.Log; |
2 | +using CleanAuLait.ObservableCollectionsMod; | |
2 | 3 | using NLog; |
3 | -using ObservableCollections; | |
4 | 4 | using Prism.Navigation; |
5 | 5 | using Reactive.Bindings; |
6 | 6 | using Reactive.Bindings.Extensions; |
@@ -93,25 +93,19 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
93 | 93 | |
94 | 94 | #endregion |
95 | 95 | |
96 | - #region IDestructible | |
96 | + #region IDestructible, IDisposable | |
97 | 97 | |
98 | 98 | public void Destroy() |
99 | 99 | { |
100 | 100 | this.Dispose(); |
101 | 101 | } |
102 | 102 | |
103 | - #endregion | |
104 | - | |
105 | - #region IDisposable | |
106 | - | |
107 | 103 | protected virtual void Dispose(bool disposing) |
108 | 104 | { |
109 | 105 | if (!disposedValue) |
110 | 106 | { |
111 | 107 | if (disposing) |
112 | 108 | { |
113 | - DisposeSynchronizedView(); | |
114 | - | |
115 | 109 | this.disposables.Dispose(); |
116 | 110 | |
117 | 111 | logger.Trace("BookmarkCategoryViewModel disposed."); |
@@ -121,20 +115,8 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
121 | 115 | } |
122 | 116 | } |
123 | 117 | |
124 | - private void DisposeSynchronizedView() | |
125 | - { | |
126 | - foreach (var row in this.Rows) | |
127 | - { | |
128 | - if (row is IDisposable disposable) | |
129 | - { | |
130 | - disposable.Dispose(); | |
131 | - } | |
132 | - } | |
133 | - } | |
134 | - | |
135 | 118 | public void Dispose() |
136 | 119 | { |
137 | - // このコードを変更しないでください。クリーンアップ コードを 'Dispose(bool disposing)' メソッドに記述します | |
138 | 120 | Dispose(disposing: true); |
139 | 121 | GC.SuppressFinalize(this); |
140 | 122 | } |
@@ -1,6 +1,6 @@ | ||
1 | 1 | using CleanAuLait.Core.Log; |
2 | +using CleanAuLait.ObservableCollectionsMod; | |
2 | 3 | using NLog; |
3 | -using ObservableCollections; | |
4 | 4 | using Prism.Navigation; |
5 | 5 | using Reactive.Bindings; |
6 | 6 | using Reactive.Bindings.Extensions; |
@@ -27,7 +27,10 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
27 | 27 | |
28 | 28 | public ReactiveProperty<IBookmarkDetailListRowViewModel> SelectedItem { get; } |
29 | 29 | |
30 | - public INotifyCollectionChangedListSynchronizedSingleView<BookmarkDetailListRow, IBookmarkDetailListRowViewModel> Rows { get; private set; } = null; | |
30 | + public INotifyCollectionChangedListSynchronizedSingleView< | |
31 | + BookmarkDetailListRow, IBookmarkDetailListRowViewModel> Rows { get; private set; } = null; | |
32 | + private ISortableSynchronizedCoupleView< | |
33 | + BookmarkDetailListRow, string, IBookmarkDetailListRowViewModel> SortableRows { get; set; } | |
31 | 34 | |
32 | 35 | public ReactiveCommand CommandOpenBookmark { get; } |
33 | 36 |
@@ -85,8 +88,12 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
85 | 88 | { |
86 | 89 | if (this.Source == null) |
87 | 90 | { |
88 | - this.Rows = source.Rows | |
89 | - .ToSynchronizedCoupleView(r => this.vmTranslator.Translate(r, this)) | |
91 | + this.SortableRows = source.Rows | |
92 | + .ToSortableSynchronizedCoupleView( | |
93 | + r => r.NCode, r => this.vmTranslator.Translate(r, this), | |
94 | + new DetailListViewComparer<string>(r => r.Title.Value)); | |
95 | + | |
96 | + this.Rows = this.SortableRows | |
90 | 97 | .ToSynchronizedSingleView() |
91 | 98 | .WithINotifyCollectionChangedList() |
92 | 99 | .AddTo(disposables); |
@@ -103,18 +110,50 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
103 | 110 | } |
104 | 111 | } |
105 | 112 | |
106 | - #endregion | |
113 | + public void SortByViewColumn<TViewColumn>( | |
114 | + string tag, Func<IBookmarkDetailListRowViewModel, TViewColumn> selector, bool ascending) | |
115 | + { | |
116 | + logger.Trace("Sort: {0}, ascending = {1}", tag, ascending); | |
117 | + this.SortableRows.Sort(this.SortableRows.CreateViewComparer(selector, ascending)); | |
118 | + } | |
107 | 119 | |
108 | - #region IDestructible | |
120 | + public void SortByValueColumn<TValueColumn>( | |
121 | + string tag, Func<BookmarkDetailListRow, TValueColumn> selector, bool ascending) | |
122 | + { | |
123 | + logger.Trace("Sort: {0}, ascending = {1}", tag, ascending); | |
124 | + this.SortableRows.Sort(this.SortableRows.CreateValueComparer(selector, ascending)); | |
125 | + } | |
109 | 126 | |
110 | - public void Destroy() | |
127 | + private class DetailListViewComparer<TViewColumn> | |
128 | + : SortableSynchronizedCoupleViewViewComparer< | |
129 | + string, BookmarkDetailListRow, IBookmarkDetailListRowViewModel, TViewColumn> | |
111 | 130 | { |
112 | - this.Dispose(); | |
131 | + public DetailListViewComparer( | |
132 | + Func<IBookmarkDetailListRowViewModel, TViewColumn> selector, bool ascending = true | |
133 | + ) : base(selector, ascending) | |
134 | + { | |
135 | + } | |
136 | + } | |
137 | + | |
138 | + private class DetailListValueComparer<TValueColumn> | |
139 | + : SortableSynchronizedCoupleViewValueComparer< | |
140 | + string, BookmarkDetailListRow, IBookmarkDetailListRowViewModel, TValueColumn> | |
141 | + { | |
142 | + public DetailListValueComparer( | |
143 | + Func<BookmarkDetailListRow, TValueColumn> selector, bool ascending = true | |
144 | + ) : base(selector, ascending) | |
145 | + { | |
146 | + } | |
113 | 147 | } |
114 | 148 | |
115 | 149 | #endregion |
116 | 150 | |
117 | - #region IDisposable | |
151 | + #region IDestructible, IDisposable | |
152 | + | |
153 | + public void Destroy() | |
154 | + { | |
155 | + this.Dispose(); | |
156 | + } | |
118 | 157 | |
119 | 158 | protected virtual void Dispose(bool disposing) |
120 | 159 | { |
@@ -122,8 +161,6 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
122 | 161 | { |
123 | 162 | if (disposing) |
124 | 163 | { |
125 | - DisposeSynchronizedView(); | |
126 | - | |
127 | 164 | this.disposables.Dispose(); |
128 | 165 | |
129 | 166 | logger.Trace("BookmarkDetailListViewModel disposed."); |
@@ -133,25 +170,12 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
133 | 170 | } |
134 | 171 | } |
135 | 172 | |
136 | - private void DisposeSynchronizedView() | |
137 | - { | |
138 | - foreach (var row in this.Rows) | |
139 | - { | |
140 | - if (row is IDisposable disposable) | |
141 | - { | |
142 | - disposable.Dispose(); | |
143 | - } | |
144 | - } | |
145 | - } | |
146 | - | |
147 | 173 | public void Dispose() |
148 | 174 | { |
149 | - // このコードを変更しないでください。クリーンアップ コードを 'Dispose(bool disposing)' メソッドに記述します | |
150 | 175 | Dispose(disposing: true); |
151 | 176 | GC.SuppressFinalize(this); |
152 | 177 | } |
153 | 178 | |
154 | 179 | #endregion |
155 | - | |
156 | 180 | } |
157 | 181 | } |
@@ -1,4 +1,5 @@ | ||
1 | 1 | using Microsoft.UI.Xaml.Media.Imaging; |
2 | +using NLog; | |
2 | 3 | using Reactive.Bindings; |
3 | 4 | using System.Reactive.Disposables; |
4 | 5 | using TestNarou3.Adaptor.Boundary.Gateway.ViewModel; |
@@ -17,6 +18,8 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel.Child | ||
17 | 18 | BookmarkCategoryRow Source |
18 | 19 | ) : IBookmarkCategoryRowViewModel, IDisposable |
19 | 20 | { |
21 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
22 | + | |
20 | 23 | private readonly CompositeDisposable disposables = new(); |
21 | 24 | private bool disposedValue; |
22 | 25 |
@@ -39,6 +42,7 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel.Child | ||
39 | 42 | if (disposing) |
40 | 43 | { |
41 | 44 | this.disposables.Dispose(); |
45 | + logger.Trace("BookmarkCategoryRowViewModel[{0}] disposed.", this.Index); | |
42 | 46 | } |
43 | 47 | |
44 | 48 | disposedValue = true; |
@@ -56,6 +56,7 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel.Child | ||
56 | 56 | if (disposing) |
57 | 57 | { |
58 | 58 | this.disposables.Dispose(); |
59 | + logger.Trace("BookmarkDetailListRowViewModel[{0}] disposed.", this.NCode); | |
59 | 60 | } |
60 | 61 | |
61 | 62 | disposedValue = true; |
@@ -38,17 +38,13 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
38 | 38 | this.CommandLogin = new ReactiveCommand().WithSubscribe(OnLogin).AddTo(disposables); |
39 | 39 | } |
40 | 40 | |
41 | - #region IDestructible | |
41 | + #region IDestructible, IDisposable | |
42 | 42 | |
43 | 43 | public void Destroy() |
44 | 44 | { |
45 | 45 | this.Dispose(); |
46 | 46 | } |
47 | 47 | |
48 | - #endregion | |
49 | - | |
50 | - #region IDisposable | |
51 | - | |
52 | 48 | protected virtual void Dispose(bool disposing) |
53 | 49 | { |
54 | 50 | if (!disposedValue) |
@@ -89,7 +85,6 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
89 | 85 | } |
90 | 86 | |
91 | 87 | this.wc.NavigateBookmarkView(); |
92 | - this.wc.NavigateBookmarkListView(1); | |
93 | 88 | } |
94 | 89 | |
95 | 90 | #endregion |
@@ -42,17 +42,13 @@ namespace TestNarou3.Adaptor.Gateway.ViewModel | ||
42 | 42 | this.Dispose(); |
43 | 43 | } |
44 | 44 | |
45 | - #region IDestructible | |
45 | + #region IDestructible, IDisposable | |
46 | 46 | |
47 | 47 | public void Destroy() |
48 | 48 | { |
49 | 49 | this.Dispose(); |
50 | 50 | } |
51 | 51 | |
52 | - #endregion | |
53 | - | |
54 | - #region IDisposable | |
55 | - | |
56 | 52 | protected virtual void Dispose(bool disposing) |
57 | 53 | { |
58 | 54 | if (!disposedValue) |
@@ -3,7 +3,7 @@ using TestNarou3.Domain.Model.API; | ||
3 | 3 | |
4 | 4 | namespace TestNarou3.Domain.Boundary.Repository |
5 | 5 | { |
6 | - public interface INarouRepository : IDestructible | |
6 | + public interface INarouRepository : IDisposable | |
7 | 7 | { |
8 | 8 | string Login(string id, string password); |
9 | 9 | void Logout(string dataToken); |
@@ -1,4 +1,5 @@ | ||
1 | -using ObservableCollections; | |
1 | +using NLog; | |
2 | +using ObservableCollections; | |
2 | 3 | using System; |
3 | 4 | using System.Collections.Generic; |
4 | 5 | using TestNarou3.Domain.Model.Entity.Child; |
@@ -9,6 +10,8 @@ namespace TestNarou3.Domain.Model.Entity | ||
9 | 10 | ObservableList<BookmarkCategoryRow> Rows |
10 | 11 | ) : IDisposable |
11 | 12 | { |
13 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
14 | + | |
12 | 15 | private bool disposedValue; |
13 | 16 | |
14 | 17 | public BookmarkCategory() : this( |
@@ -42,6 +45,8 @@ namespace TestNarou3.Domain.Model.Entity | ||
42 | 45 | { |
43 | 46 | row.Dispose(); |
44 | 47 | } |
48 | + | |
49 | + logger.Trace("BookmarkCategory disposed."); | |
45 | 50 | } |
46 | 51 | |
47 | 52 | disposedValue = true; |
@@ -1,4 +1,5 @@ | ||
1 | -using ObservableCollections; | |
1 | +using NLog; | |
2 | +using ObservableCollections; | |
2 | 3 | using System; |
3 | 4 | using System.Collections.Generic; |
4 | 5 | using TestNarou3.Domain.Model.Entity.Child; |
@@ -9,6 +10,8 @@ namespace TestNarou3.Domain.Model.Entity | ||
9 | 10 | ObservableList<BookmarkDetailListRow> Rows |
10 | 11 | ) : IDisposable |
11 | 12 | { |
13 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
14 | + | |
12 | 15 | private bool disposedValue; |
13 | 16 | |
14 | 17 | public BookmarkDetailList() : this( |
@@ -20,16 +23,7 @@ namespace TestNarou3.Domain.Model.Entity | ||
20 | 23 | public void Refresh(IEnumerable<BookmarkDetailListRow> rows) |
21 | 24 | { |
22 | 25 | this.Rows.Clear(); |
23 | - | |
24 | - // due to the communication toolkit datagrid does not support range operations, | |
25 | - // we have to add the data row by row. | |
26 | - | |
27 | - //this.Rows.AddRange(rows); | |
28 | - | |
29 | - foreach (var row in rows) | |
30 | - { | |
31 | - this.Rows.Add(row); | |
32 | - } | |
26 | + this.Rows.AddRange(rows); | |
33 | 27 | } |
34 | 28 | |
35 | 29 | protected virtual void Dispose(bool disposing) |
@@ -42,6 +36,8 @@ namespace TestNarou3.Domain.Model.Entity | ||
42 | 36 | { |
43 | 37 | row.Dispose(); |
44 | 38 | } |
39 | + | |
40 | + logger.Trace("BookmarkDetailList disposed."); | |
45 | 41 | } |
46 | 42 | |
47 | 43 | disposedValue = true; |
@@ -1,4 +1,5 @@ | ||
1 | -using Reactive.Bindings; | |
1 | +using NLog; | |
2 | +using Reactive.Bindings; | |
2 | 3 | using Reactive.Bindings.Extensions; |
3 | 4 | using System; |
4 | 5 | using System.Reactive.Disposables; |
@@ -11,6 +12,8 @@ namespace TestNarou3.Domain.Model.Entity.Child | ||
11 | 12 | ReactivePropertySlim<int> Count |
12 | 13 | ) : IDisposable |
13 | 14 | { |
15 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
16 | + | |
14 | 17 | private readonly CompositeDisposable disposables = new(); |
15 | 18 | private bool disposedValue; |
16 | 19 |
@@ -31,6 +34,7 @@ namespace TestNarou3.Domain.Model.Entity.Child | ||
31 | 34 | if (disposing) |
32 | 35 | { |
33 | 36 | this.disposables.Dispose(); |
37 | + logger.Trace("BookmarkCategoryRow[{0}] disposed.", Index); | |
34 | 38 | } |
35 | 39 | |
36 | 40 | disposedValue = true; |
@@ -1,4 +1,5 @@ | ||
1 | -using Reactive.Bindings; | |
1 | +using NLog; | |
2 | +using Reactive.Bindings; | |
2 | 3 | using Reactive.Bindings.Extensions; |
3 | 4 | using System; |
4 | 5 | using System.Reactive.Disposables; |
@@ -40,6 +41,8 @@ namespace TestNarou3.Domain.Model.Entity.Child | ||
40 | 41 | ReactivePropertySlim<string> NovelUpdatedAt |
41 | 42 | ) : IDisposable |
42 | 43 | { |
44 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
45 | + | |
43 | 46 | private readonly CompositeDisposable disposables = new(); |
44 | 47 | private bool disposedValue; |
45 | 48 |
@@ -117,6 +120,7 @@ namespace TestNarou3.Domain.Model.Entity.Child | ||
117 | 120 | if (disposing) |
118 | 121 | { |
119 | 122 | this.disposables.Dispose(); |
123 | + logger.Trace("BookmarkDetailListRow[{0}] disposed.", NCode); | |
120 | 124 | } |
121 | 125 | |
122 | 126 | disposedValue = true; |
@@ -11,7 +11,7 @@ using TestNarou3.Domain.Translator; | ||
11 | 11 | |
12 | 12 | namespace TestNarou3.Domain.Service |
13 | 13 | { |
14 | - internal class NarouService : INarouService, IDestructible | |
14 | + internal class NarouService : INarouService, IDisposable | |
15 | 15 | { |
16 | 16 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
17 | 17 |
@@ -25,6 +25,8 @@ namespace TestNarou3.Domain.Service | ||
25 | 25 | private readonly IBookmarkCategoryRowTranslator vmCategoryRowTranslator; |
26 | 26 | private readonly IBookmarkDetailListRowTranslator vmDetailRowTranslator; |
27 | 27 | |
28 | + private bool disposedValue; | |
29 | + | |
28 | 30 | public NarouService( |
29 | 31 | INarouRepository repo, |
30 | 32 | IBookmarkCategoryRowTranslator vmCategoryRowTranslator, |
@@ -85,12 +87,32 @@ namespace TestNarou3.Domain.Service | ||
85 | 87 | return this.DetailList; |
86 | 88 | } |
87 | 89 | |
88 | - public void Destroy() | |
90 | + #region IDisposable | |
91 | + | |
92 | + protected virtual void Dispose(bool disposing) | |
89 | 93 | { |
90 | - this.Categeory?.Dispose(); | |
91 | - this.DetailList?.Dispose(); | |
94 | + if (!disposedValue) | |
95 | + { | |
96 | + if (disposing) | |
97 | + { | |
98 | + this.Categeory?.Dispose(); | |
99 | + this.DetailList?.Dispose(); | |
100 | + | |
101 | + this.repo?.Dispose(); | |
102 | + | |
103 | + logger.Trace("NarouService disposed."); | |
104 | + } | |
92 | 105 | |
93 | - this.repo?.Destroy(); | |
106 | + disposedValue = true; | |
107 | + } | |
94 | 108 | } |
109 | + | |
110 | + public void Dispose() | |
111 | + { | |
112 | + Dispose(disposing: true); | |
113 | + GC.SuppressFinalize(this); | |
114 | + } | |
115 | + | |
116 | + #endregion | |
95 | 117 | } |
96 | 118 | } |
@@ -16,7 +16,7 @@ | ||
16 | 16 | </ItemGroup> |
17 | 17 | |
18 | 18 | <ItemGroup> |
19 | + <ProjectReference Include="..\..\CleanAuLait.ObservableCollectionsMod\CleanAuLait.ObservableCollectionsMod.csproj" /> | |
19 | 20 | <ProjectReference Include="..\..\CleanAuLait.Prism.WinUI3\CleanAuLait.Prism.WinUI3.csproj" /> |
20 | - <ProjectReference Include="..\..\ObservableCollectionsMod\src\ObservableCollections\ObservableCollections.csproj" /> | |
21 | 21 | </ItemGroup> |
22 | 22 | </Project> |
@@ -11,7 +11,7 @@ using System.Threading.Tasks; | ||
11 | 11 | |
12 | 12 | namespace TestNarou3.OuterEdge.Repository.API |
13 | 13 | { |
14 | - internal class HttpClientHelper : IDestructible | |
14 | + internal class HttpClientHelper : IDisposable | |
15 | 15 | { |
16 | 16 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
17 | 17 |
@@ -26,6 +26,8 @@ namespace TestNarou3.OuterEdge.Repository.API | ||
26 | 26 | private readonly HttpClientHandler httpClientHandler; |
27 | 27 | private readonly HttpClient httpClient; |
28 | 28 | |
29 | + private bool disposedValue; | |
30 | + | |
29 | 31 | public HttpClientHelper() |
30 | 32 | { |
31 | 33 | cookies = new(); |
@@ -66,6 +68,30 @@ namespace TestNarou3.OuterEdge.Repository.API | ||
66 | 68 | } |
67 | 69 | } |
68 | 70 | |
71 | + #region IDisposable | |
72 | + | |
73 | + protected virtual void Dispose(bool disposing) | |
74 | + { | |
75 | + if (!disposedValue) | |
76 | + { | |
77 | + if (disposing) | |
78 | + { | |
79 | + httpClient.Dispose(); | |
80 | + logger.Trace("HttpClientHelper disposed."); | |
81 | + } | |
82 | + | |
83 | + disposedValue = true; | |
84 | + } | |
85 | + } | |
86 | + | |
87 | + public void Dispose() | |
88 | + { | |
89 | + Dispose(disposing: true); | |
90 | + GC.SuppressFinalize(this); | |
91 | + } | |
92 | + | |
93 | + #endregion | |
94 | + | |
69 | 95 | public async Task<HttpResponseMessage> GetAsync(string url, string referer) |
70 | 96 | { |
71 | 97 | var request = CreateRequestMessage(url, referer, HttpMethod.Post); |
@@ -175,10 +201,5 @@ namespace TestNarou3.OuterEdge.Repository.API | ||
175 | 201 | |
176 | 202 | return Encoding.UTF8.GetString(raw); |
177 | 203 | } |
178 | - | |
179 | - public void Destroy() | |
180 | - { | |
181 | - httpClient.Dispose(); | |
182 | - } | |
183 | 204 | } |
184 | 205 | } |
@@ -46,6 +46,32 @@ namespace TestNarou3.OuterEdge.Repository.API | ||
46 | 46 | |
47 | 47 | private readonly HttpClientHelper httpClient = new(); |
48 | 48 | |
49 | + private bool disposedValue; | |
50 | + | |
51 | + #region IDisposable | |
52 | + | |
53 | + protected virtual void Dispose(bool disposing) | |
54 | + { | |
55 | + if (!disposedValue) | |
56 | + { | |
57 | + if (disposing) | |
58 | + { | |
59 | + this.httpClient?.Dispose(); | |
60 | + logger.Trace("NarouRepository disposed."); | |
61 | + } | |
62 | + | |
63 | + disposedValue = true; | |
64 | + } | |
65 | + } | |
66 | + | |
67 | + public void Dispose() | |
68 | + { | |
69 | + Dispose(disposing: true); | |
70 | + System.GC.SuppressFinalize(this); | |
71 | + } | |
72 | + | |
73 | + #endregion | |
74 | + | |
49 | 75 | public string Login(string id, string password) |
50 | 76 | { |
51 | 77 | var form = new Dictionary<string, string>() |
@@ -253,11 +279,5 @@ namespace TestNarou3.OuterEdge.Repository.API | ||
253 | 279 | |
254 | 280 | return json; |
255 | 281 | } |
256 | - | |
257 | - public void Destroy() | |
258 | - { | |
259 | - this.httpClient?.Destroy(); | |
260 | - } | |
261 | - | |
262 | 282 | } |
263 | 283 | } |
@@ -17,13 +17,14 @@ | ||
17 | 17 | <conv:StringFormatConverter x:Key="StringFormat" /> |
18 | 18 | </UserControl.Resources> |
19 | 19 | |
20 | - <ctc:DataGrid ItemsSource="{x:Bind ViewModel.Rows, Mode=OneWay}" | |
20 | + <ctc:DataGrid x:Name="dg" ItemsSource="{x:Bind ViewModel.Rows, Mode=OneWay}" | |
21 | 21 | AutoGenerateColumns="False" |
22 | + IsReadOnly="True" | |
22 | 23 | CanUserReorderColumns="False" |
23 | 24 | CanUserSortColumns="True" |
25 | + Sorting="OnSorting" | |
24 | 26 | SelectionMode="Single" |
25 | 27 | SelectedItem="{x:Bind ViewModel.SelectedItem.Value, Mode=TwoWay}" |
26 | - IsReadOnly="True" | |
27 | 28 | RowBackground="{ThemeResource SystemControlBackgroundAltMediumLowBrush}" |
28 | 29 | AlternatingRowBackground="{ThemeResource SystemControlBackgroundAltMediumHighBrush}" |
29 | 30 | GridLinesVisibility="None"> |
@@ -47,7 +48,7 @@ | ||
47 | 48 | |
48 | 49 | <ctc:DataGrid.Columns> |
49 | 50 | |
50 | - <ctc:DataGridTemplateColumn Header="概" Width="10"> | |
51 | + <ctc:DataGridTemplateColumn Header="概" Width="10" CanUserSort="False"> | |
51 | 52 | <ctc:DataGridTemplateColumn.CellTemplate> |
52 | 53 | <DataTemplate x:DataType="vm:IBookmarkDetailListRowViewModel"> |
53 | 54 | <Grid VerticalAlignment="Center"> |
@@ -57,7 +58,7 @@ | ||
57 | 58 | </DataTemplate> |
58 | 59 | </ctc:DataGridTemplateColumn.CellTemplate> |
59 | 60 | </ctc:DataGridTemplateColumn> |
60 | - <ctc:DataGridTemplateColumn Header="タイトル" Width="300"> | |
61 | + <ctc:DataGridTemplateColumn Header="タイトル" Width="300" Tag="Title"> | |
61 | 62 | <ctc:DataGridTemplateColumn.CellTemplate> |
62 | 63 | <DataTemplate x:DataType="vm:IBookmarkDetailListRowViewModel"> |
63 | 64 | <Grid VerticalAlignment="Center"> |
@@ -70,7 +71,7 @@ | ||
70 | 71 | </DataTemplate> |
71 | 72 | </ctc:DataGridTemplateColumn.CellTemplate> |
72 | 73 | </ctc:DataGridTemplateColumn> |
73 | - <ctc:DataGridTemplateColumn Header="作者" Width="100"> | |
74 | + <ctc:DataGridTemplateColumn Header="作者" Width="100" Tag="Writer"> | |
74 | 75 | <ctc:DataGridTemplateColumn.CellTemplate> |
75 | 76 | <DataTemplate x:DataType="vm:IBookmarkDetailListRowViewModel"> |
76 | 77 | <Grid VerticalAlignment="Center"> |
@@ -83,7 +84,7 @@ | ||
83 | 84 | </DataTemplate> |
84 | 85 | </ctc:DataGridTemplateColumn.CellTemplate> |
85 | 86 | </ctc:DataGridTemplateColumn> |
86 | - <ctc:DataGridTemplateColumn Header="完結" Width="40"> | |
87 | + <ctc:DataGridTemplateColumn Header="完結" Width="40" Tag="End"> | |
87 | 88 | <ctc:DataGridTemplateColumn.CellTemplate> |
88 | 89 | <DataTemplate x:DataType="vm:IBookmarkDetailListRowViewModel"> |
89 | 90 | <Grid VerticalAlignment="Center"> |
@@ -92,7 +93,7 @@ | ||
92 | 93 | </DataTemplate> |
93 | 94 | </ctc:DataGridTemplateColumn.CellTemplate> |
94 | 95 | </ctc:DataGridTemplateColumn> |
95 | - <ctc:DataGridTextColumn Header="話数" Width="60" | |
96 | + <ctc:DataGridTextColumn Header="話数" Width="60" Tag="GeneralAllNo" | |
96 | 97 | Binding="{Binding GeneralAllNo.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
97 | 98 | <ctc:DataGridTextColumn.ElementStyle> |
98 | 99 | <Style TargetType="TextBlock"> |
@@ -100,7 +101,7 @@ | ||
100 | 101 | </Style> |
101 | 102 | </ctc:DataGridTextColumn.ElementStyle> |
102 | 103 | </ctc:DataGridTextColumn> |
103 | - <ctc:DataGridTextColumn Header="長さ[h]" Width="70" | |
104 | + <ctc:DataGridTextColumn Header="長さ[h]" Width="70" Tag="Time" | |
104 | 105 | Binding="{Binding Time.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}"> |
105 | 106 | <ctc:DataGridTextColumn.ElementStyle> |
106 | 107 | <Style TargetType="TextBlock"> |
@@ -108,7 +109,7 @@ | ||
108 | 109 | </Style> |
109 | 110 | </ctc:DataGridTextColumn.ElementStyle> |
110 | 111 | </ctc:DataGridTextColumn> |
111 | - <ctc:DataGridTemplateColumn Header="エタ" Width="25"> | |
112 | + <ctc:DataGridTemplateColumn Header="エタ" Width="25" Tag="IsStop"> | |
112 | 113 | <ctc:DataGridTemplateColumn.CellTemplate> |
113 | 114 | <DataTemplate x:DataType="vm:IBookmarkDetailListRowViewModel"> |
114 | 115 | <Grid VerticalAlignment="Center"> |
@@ -117,7 +118,7 @@ | ||
117 | 118 | </DataTemplate> |
118 | 119 | </ctc:DataGridTemplateColumn.CellTemplate> |
119 | 120 | </ctc:DataGridTemplateColumn> |
120 | - <ctc:DataGridTextColumn Header="総合評価pt." Width="100" | |
121 | + <ctc:DataGridTextColumn Header="総合評価pt." Width="100" Tag="GlobalPoint" | |
121 | 122 | Binding="{Binding GlobalPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
122 | 123 | <ctc:DataGridTextColumn.ElementStyle> |
123 | 124 | <Style TargetType="TextBlock"> |
@@ -125,7 +126,7 @@ | ||
125 | 126 | </Style> |
126 | 127 | </ctc:DataGridTextColumn.ElementStyle> |
127 | 128 | </ctc:DataGridTextColumn> |
128 | - <ctc:DataGridTextColumn Header="評価/分" Width="80" | |
129 | + <ctc:DataGridTextColumn Header="評価/分" Width="80" Tag="PointPerMin" | |
129 | 130 | Binding="{Binding PointPerMin.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
130 | 131 | <ctc:DataGridTextColumn.ElementStyle> |
131 | 132 | <Style TargetType="TextBlock"> |
@@ -133,7 +134,7 @@ | ||
133 | 134 | </Style> |
134 | 135 | </ctc:DataGridTextColumn.ElementStyle> |
135 | 136 | </ctc:DataGridTextColumn> |
136 | - <ctc:DataGridTextColumn Header="日間pt." Width="80" | |
137 | + <ctc:DataGridTextColumn Header="日間pt." Width="80" Tag="DailyPoint" | |
137 | 138 | Binding="{Binding DailyPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
138 | 139 | <ctc:DataGridTextColumn.ElementStyle> |
139 | 140 | <Style TargetType="TextBlock"> |
@@ -141,7 +142,7 @@ | ||
141 | 142 | </Style> |
142 | 143 | </ctc:DataGridTextColumn.ElementStyle> |
143 | 144 | </ctc:DataGridTextColumn> |
144 | - <ctc:DataGridTextColumn Header="週間pt." Width="80" | |
145 | + <ctc:DataGridTextColumn Header="週間pt." Width="80" Tag="WeeklyPoint" | |
145 | 146 | Binding="{Binding WeeklyPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
146 | 147 | <ctc:DataGridTextColumn.ElementStyle> |
147 | 148 | <Style TargetType="TextBlock"> |
@@ -149,7 +150,7 @@ | ||
149 | 150 | </Style> |
150 | 151 | </ctc:DataGridTextColumn.ElementStyle> |
151 | 152 | </ctc:DataGridTextColumn> |
152 | - <ctc:DataGridTextColumn Header="月間pt." Width="80" | |
153 | + <ctc:DataGridTextColumn Header="月間pt." Width="80" Tag="MonthlyPoint" | |
153 | 154 | Binding="{Binding MonthlyPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
154 | 155 | <ctc:DataGridTextColumn.ElementStyle> |
155 | 156 | <Style TargetType="TextBlock"> |
@@ -157,7 +158,7 @@ | ||
157 | 158 | </Style> |
158 | 159 | </ctc:DataGridTextColumn.ElementStyle> |
159 | 160 | </ctc:DataGridTextColumn> |
160 | - <ctc:DataGridTextColumn Header="四半期pt." Width="80" | |
161 | + <ctc:DataGridTextColumn Header="四半期pt." Width="80" Tag="QuarterPoint" | |
161 | 162 | Binding="{Binding QuarterPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
162 | 163 | <ctc:DataGridTextColumn.ElementStyle> |
163 | 164 | <Style TargetType="TextBlock"> |
@@ -165,7 +166,7 @@ | ||
165 | 166 | </Style> |
166 | 167 | </ctc:DataGridTextColumn.ElementStyle> |
167 | 168 | </ctc:DataGridTextColumn> |
168 | - <ctc:DataGridTextColumn Header="年間pt." Width="80" | |
169 | + <ctc:DataGridTextColumn Header="年間pt." Width="80" Tag="YearlyPoint" | |
169 | 170 | Binding="{Binding YearlyPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
170 | 171 | <ctc:DataGridTextColumn.ElementStyle> |
171 | 172 | <Style TargetType="TextBlock"> |
@@ -173,7 +174,7 @@ | ||
173 | 174 | </Style> |
174 | 175 | </ctc:DataGridTextColumn.ElementStyle> |
175 | 176 | </ctc:DataGridTextColumn> |
176 | - <ctc:DataGridTextColumn Header="ブクマ数" Width="80" | |
177 | + <ctc:DataGridTextColumn Header="ブクマ数" Width="80" Tag="FavNovelCnt" | |
177 | 178 | Binding="{Binding FavNovelCnt.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
178 | 179 | <ctc:DataGridTextColumn.ElementStyle> |
179 | 180 | <Style TargetType="TextBlock"> |
@@ -181,7 +182,7 @@ | ||
181 | 182 | </Style> |
182 | 183 | </ctc:DataGridTextColumn.ElementStyle> |
183 | 184 | </ctc:DataGridTextColumn> |
184 | - <ctc:DataGridTextColumn Header="感想数" Width="80" | |
185 | + <ctc:DataGridTextColumn Header="感想数" Width="80" Tag="ImpressionCnt" | |
185 | 186 | Binding="{Binding ImpressionCnt.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
186 | 187 | <ctc:DataGridTextColumn.ElementStyle> |
187 | 188 | <Style TargetType="TextBlock"> |
@@ -189,7 +190,7 @@ | ||
189 | 190 | </Style> |
190 | 191 | </ctc:DataGridTextColumn.ElementStyle> |
191 | 192 | </ctc:DataGridTextColumn> |
192 | - <ctc:DataGridTextColumn Header="レビュー数" Width="60" | |
193 | + <ctc:DataGridTextColumn Header="レビュー数" Width="60" Tag="ReviewCnt" | |
193 | 194 | Binding="{Binding ReviewCnt.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
194 | 195 | <ctc:DataGridTextColumn.ElementStyle> |
195 | 196 | <Style TargetType="TextBlock"> |
@@ -197,7 +198,7 @@ | ||
197 | 198 | </Style> |
198 | 199 | </ctc:DataGridTextColumn.ElementStyle> |
199 | 200 | </ctc:DataGridTextColumn> |
200 | - <ctc:DataGridTextColumn Header="評価pt." Width="80" | |
201 | + <ctc:DataGridTextColumn Header="評価pt." Width="80" Tag="AllPoint" | |
201 | 202 | Binding="{Binding AllPoint.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
202 | 203 | <ctc:DataGridTextColumn.ElementStyle> |
203 | 204 | <Style TargetType="TextBlock"> |
@@ -205,7 +206,7 @@ | ||
205 | 206 | </Style> |
206 | 207 | </ctc:DataGridTextColumn.ElementStyle> |
207 | 208 | </ctc:DataGridTextColumn> |
208 | - <ctc:DataGridTextColumn Header="評価者数" Width="70" | |
209 | + <ctc:DataGridTextColumn Header="評価者数" Width="70" Tag="AllHyokaCnt" | |
209 | 210 | Binding="{Binding AllHyokaCnt.Value, Converter={StaticResource StringFormat},ConverterParameter=\{0:N0\}}" > |
210 | 211 | <ctc:DataGridTextColumn.ElementStyle> |
211 | 212 | <Style TargetType="TextBlock"> |
@@ -213,7 +214,7 @@ | ||
213 | 214 | </Style> |
214 | 215 | </ctc:DataGridTextColumn.ElementStyle> |
215 | 216 | </ctc:DataGridTextColumn> |
216 | - <ctc:DataGridTextColumn Header="最終掲載日" Width="100" | |
217 | + <ctc:DataGridTextColumn Header="最終掲載日" Width="100" Tag="GeneralLastUp" | |
217 | 218 | Binding="{Binding GeneralLastUp.Value}"> |
218 | 219 | <ctc:DataGridTextColumn.ElementStyle> |
219 | 220 | <Style TargetType="TextBlock"> |
@@ -221,7 +222,7 @@ | ||
221 | 222 | </Style> |
222 | 223 | </ctc:DataGridTextColumn.ElementStyle> |
223 | 224 | </ctc:DataGridTextColumn> |
224 | - <ctc:DataGridTextColumn Header="初回掲載日" Width="100" | |
225 | + <ctc:DataGridTextColumn Header="初回掲載日" Width="100" Tag="GeneralFirstUp" | |
225 | 226 | Binding="{Binding GeneralFirstUp.Value}"> |
226 | 227 | <ctc:DataGridTextColumn.ElementStyle> |
227 | 228 | <Style TargetType="TextBlock"> |
@@ -229,7 +230,7 @@ | ||
229 | 230 | </Style> |
230 | 231 | </ctc:DataGridTextColumn.ElementStyle> |
231 | 232 | </ctc:DataGridTextColumn> |
232 | - <ctc:DataGridTextColumn Header="小説更新日" Width="100" | |
233 | + <ctc:DataGridTextColumn Header="小説更新日" Width="100" Tag="NovelUpdatedAt" | |
233 | 234 | Binding="{Binding NovelUpdatedAt.Value}"> |
234 | 235 | <ctc:DataGridTextColumn.ElementStyle> |
235 | 236 | <Style TargetType="TextBlock"> |
@@ -1,16 +1,20 @@ | ||
1 | -using Microsoft.UI.Xaml; | |
1 | +using CommunityToolkit.WinUI.UI.Controls; | |
2 | +using Microsoft.UI.Xaml; | |
2 | 3 | using Microsoft.UI.Xaml.Controls; |
3 | 4 | using Microsoft.UI.Xaml.Controls.Primitives; |
4 | 5 | using Microsoft.UI.Xaml.Data; |
5 | 6 | using Microsoft.UI.Xaml.Input; |
6 | 7 | using Microsoft.UI.Xaml.Media; |
7 | 8 | using Microsoft.UI.Xaml.Navigation; |
9 | +using NLog; | |
8 | 10 | using System; |
9 | 11 | using System.Collections.Generic; |
12 | +using System.Collections.ObjectModel; | |
10 | 13 | using System.IO; |
11 | 14 | using System.Linq; |
12 | 15 | using System.Runtime.InteropServices.WindowsRuntime; |
13 | 16 | using TestNarou3.Adaptor.Boundary.Gateway.ViewModel; |
17 | +using TestNarou3.Adaptor.Boundary.Gateway.ViewModel.Child; | |
14 | 18 | using Windows.Foundation; |
15 | 19 | using Windows.Foundation.Collections; |
16 | 20 |
@@ -21,6 +25,8 @@ namespace TestNarou3.OuterEdge.UI.View | ||
21 | 25 | { |
22 | 26 | public sealed partial class BookmarkDetailListView : UserControl |
23 | 27 | { |
28 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
29 | + | |
24 | 30 | public IBookmarkDetailListViewModel ViewModel { get; } |
25 | 31 | |
26 | 32 | public BookmarkDetailListView(IBookmarkDetailListViewModel viewModel) |
@@ -29,5 +35,303 @@ namespace TestNarou3.OuterEdge.UI.View | ||
29 | 35 | |
30 | 36 | this.InitializeComponent(); |
31 | 37 | } |
38 | + | |
39 | + private void OnSorting(object sender, DataGridColumnEventArgs e) | |
40 | + { | |
41 | + string tag = e.Column.Tag.ToString(); | |
42 | + | |
43 | + DataGridSortDirection direction = e.Column.SortDirection ?? DataGridSortDirection.Ascending; | |
44 | + | |
45 | + logger.Trace("OnSorting: tag [{0}], direction [{1}]", tag, direction.ToString()); | |
46 | + | |
47 | + switch (tag) | |
48 | + { | |
49 | + case "Title": | |
50 | + if ((e.Column.SortDirection == null) || (direction == DataGridSortDirection.Descending)) | |
51 | + { | |
52 | + this.ViewModel.SortByViewColumn(tag, r => r.Title.Value, true); | |
53 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
54 | + } | |
55 | + else | |
56 | + { | |
57 | + this.ViewModel.SortByViewColumn(tag, r => r.Title.Value, false); | |
58 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
59 | + } | |
60 | + break; | |
61 | + | |
62 | + case "Writer": | |
63 | + if ((e.Column.SortDirection == null) || (direction == DataGridSortDirection.Descending)) | |
64 | + { | |
65 | + this.ViewModel.SortByViewColumn(tag, r => r.Writer.Value, true); | |
66 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
67 | + } | |
68 | + else | |
69 | + { | |
70 | + this.ViewModel.SortByViewColumn(tag, r => r.Writer.Value, false); | |
71 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
72 | + } | |
73 | + break; | |
74 | + | |
75 | + case "End": | |
76 | + if (direction == DataGridSortDirection.Ascending) | |
77 | + { | |
78 | + this.ViewModel.SortByViewColumn(tag, r => r.End.Value, false); | |
79 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
80 | + } | |
81 | + else | |
82 | + { | |
83 | + this.ViewModel.SortByViewColumn(tag, r => r.End.Value, true); | |
84 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
85 | + } | |
86 | + break; | |
87 | + | |
88 | + case "GeneralAllNo": | |
89 | + if (direction == DataGridSortDirection.Ascending) | |
90 | + { | |
91 | + this.ViewModel.SortByViewColumn(tag, r => r.GeneralAllNo.Value, false); | |
92 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
93 | + } | |
94 | + else | |
95 | + { | |
96 | + this.ViewModel.SortByViewColumn(tag, r => r.GeneralAllNo.Value, true); | |
97 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
98 | + } | |
99 | + break; | |
100 | + | |
101 | + case "Time": | |
102 | + if (direction == DataGridSortDirection.Ascending) | |
103 | + { | |
104 | + this.ViewModel.SortByViewColumn(tag, r => r.Time.Value, false); | |
105 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
106 | + } | |
107 | + else | |
108 | + { | |
109 | + this.ViewModel.SortByViewColumn(tag, r => r.Time.Value, true); | |
110 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
111 | + } | |
112 | + break; | |
113 | + | |
114 | + case "IsStop": | |
115 | + if ((e.Column.SortDirection == null) || (direction == DataGridSortDirection.Descending)) | |
116 | + { | |
117 | + this.ViewModel.SortByViewColumn(tag, r => r.IsStop.Value, true); | |
118 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
119 | + } | |
120 | + else | |
121 | + { | |
122 | + this.ViewModel.SortByViewColumn(tag, r => r.IsStop.Value, false); | |
123 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
124 | + } | |
125 | + break; | |
126 | + | |
127 | + case "GlobalPoint": | |
128 | + if (direction == DataGridSortDirection.Ascending) | |
129 | + { | |
130 | + this.ViewModel.SortByViewColumn(tag, r => r.GlobalPoint.Value, false); | |
131 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
132 | + } | |
133 | + else | |
134 | + { | |
135 | + this.ViewModel.SortByViewColumn(tag, r => r.GlobalPoint.Value, true); | |
136 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
137 | + } | |
138 | + break; | |
139 | + | |
140 | + case "PointPerMin": | |
141 | + if (direction == DataGridSortDirection.Ascending) | |
142 | + { | |
143 | + this.ViewModel.SortByViewColumn(tag, r => r.PointPerMin.Value, false); | |
144 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
145 | + } | |
146 | + else | |
147 | + { | |
148 | + this.ViewModel.SortByViewColumn(tag, r => r.PointPerMin.Value, true); | |
149 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
150 | + } | |
151 | + break; | |
152 | + | |
153 | + case "DailyPoint": | |
154 | + if (direction == DataGridSortDirection.Ascending) | |
155 | + { | |
156 | + this.ViewModel.SortByViewColumn(tag, r => r.DailyPoint.Value, false); | |
157 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
158 | + } | |
159 | + else | |
160 | + { | |
161 | + this.ViewModel.SortByViewColumn(tag, r => r.DailyPoint.Value, true); | |
162 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
163 | + } | |
164 | + break; | |
165 | + | |
166 | + case "WeeklyPoint": | |
167 | + if (direction == DataGridSortDirection.Ascending) | |
168 | + { | |
169 | + this.ViewModel.SortByViewColumn(tag, r => r.WeeklyPoint.Value, false); | |
170 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
171 | + } | |
172 | + else | |
173 | + { | |
174 | + this.ViewModel.SortByViewColumn(tag, r => r.WeeklyPoint.Value, true); | |
175 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
176 | + } | |
177 | + break; | |
178 | + | |
179 | + case "MonthlyPoint": | |
180 | + if (direction == DataGridSortDirection.Ascending) | |
181 | + { | |
182 | + this.ViewModel.SortByViewColumn(tag, r => r.MonthlyPoint.Value, false); | |
183 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
184 | + } | |
185 | + else | |
186 | + { | |
187 | + this.ViewModel.SortByViewColumn(tag, r => r.MonthlyPoint.Value, true); | |
188 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
189 | + } | |
190 | + break; | |
191 | + | |
192 | + case "QuarterPoint": | |
193 | + if (direction == DataGridSortDirection.Ascending) | |
194 | + { | |
195 | + this.ViewModel.SortByViewColumn(tag, r => r.QuarterPoint.Value, false); | |
196 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
197 | + } | |
198 | + else | |
199 | + { | |
200 | + this.ViewModel.SortByViewColumn(tag, r => r.QuarterPoint.Value, true); | |
201 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
202 | + } | |
203 | + break; | |
204 | + | |
205 | + case "YearlyPoint": | |
206 | + if (direction == DataGridSortDirection.Ascending) | |
207 | + { | |
208 | + this.ViewModel.SortByViewColumn(tag, r => r.YearlyPoint.Value, false); | |
209 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
210 | + } | |
211 | + else | |
212 | + { | |
213 | + this.ViewModel.SortByViewColumn(tag, r => r.YearlyPoint.Value, true); | |
214 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
215 | + } | |
216 | + break; | |
217 | + | |
218 | + case "FavNovelCnt": | |
219 | + if (direction == DataGridSortDirection.Ascending) | |
220 | + { | |
221 | + this.ViewModel.SortByViewColumn(tag, r => r.FavNovelCnt.Value, false); | |
222 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
223 | + } | |
224 | + else | |
225 | + { | |
226 | + this.ViewModel.SortByViewColumn(tag, r => r.FavNovelCnt.Value, true); | |
227 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
228 | + } | |
229 | + break; | |
230 | + | |
231 | + case "ImpressionCnt": | |
232 | + if (direction == DataGridSortDirection.Ascending) | |
233 | + { | |
234 | + this.ViewModel.SortByViewColumn(tag, r => r.ImpressionCnt.Value, false); | |
235 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
236 | + } | |
237 | + else | |
238 | + { | |
239 | + this.ViewModel.SortByViewColumn(tag, r => r.ImpressionCnt.Value, true); | |
240 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
241 | + } | |
242 | + break; | |
243 | + | |
244 | + case "ReviewCnt": | |
245 | + if (direction == DataGridSortDirection.Ascending) | |
246 | + { | |
247 | + this.ViewModel.SortByViewColumn(tag, r => r.ReviewCnt.Value, false); | |
248 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
249 | + } | |
250 | + else | |
251 | + { | |
252 | + this.ViewModel.SortByViewColumn(tag, r => r.ReviewCnt.Value, true); | |
253 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
254 | + } | |
255 | + break; | |
256 | + | |
257 | + case "AllPoint": | |
258 | + if (direction == DataGridSortDirection.Ascending) | |
259 | + { | |
260 | + this.ViewModel.SortByViewColumn(tag, r => r.AllPoint.Value, false); | |
261 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
262 | + } | |
263 | + else | |
264 | + { | |
265 | + this.ViewModel.SortByViewColumn(tag, r => r.AllPoint.Value, true); | |
266 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
267 | + } | |
268 | + break; | |
269 | + | |
270 | + case "AllHyokaCnt": | |
271 | + if (direction == DataGridSortDirection.Ascending) | |
272 | + { | |
273 | + this.ViewModel.SortByViewColumn(tag, r => r.AllHyokaCnt.Value, false); | |
274 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
275 | + } | |
276 | + else | |
277 | + { | |
278 | + this.ViewModel.SortByViewColumn(tag, r => r.AllHyokaCnt.Value, true); | |
279 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
280 | + } | |
281 | + break; | |
282 | + | |
283 | + case "GeneralLastUp": | |
284 | + if (direction == DataGridSortDirection.Ascending) | |
285 | + { | |
286 | + this.ViewModel.SortByValueColumn(tag, r => r.GeneralLastUp.Value, false); | |
287 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
288 | + } | |
289 | + else | |
290 | + { | |
291 | + this.ViewModel.SortByValueColumn(tag, r => r.GeneralLastUp.Value, true); | |
292 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
293 | + } | |
294 | + break; | |
295 | + | |
296 | + case "GeneralFirstUp": | |
297 | + if (direction == DataGridSortDirection.Ascending) | |
298 | + { | |
299 | + this.ViewModel.SortByValueColumn(tag, r => r.GeneralFirstUp.Value, false); | |
300 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
301 | + } | |
302 | + else | |
303 | + { | |
304 | + this.ViewModel.SortByValueColumn(tag, r => r.GeneralFirstUp.Value, true); | |
305 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
306 | + } | |
307 | + break; | |
308 | + | |
309 | + case "NovelUpdatedAt": | |
310 | + if (direction == DataGridSortDirection.Ascending) | |
311 | + { | |
312 | + this.ViewModel.SortByValueColumn(tag, r => r.NovelUpdatedAt.Value, false); | |
313 | + e.Column.SortDirection = DataGridSortDirection.Descending; | |
314 | + } | |
315 | + else | |
316 | + { | |
317 | + this.ViewModel.SortByValueColumn(tag, r => r.NovelUpdatedAt.Value, true); | |
318 | + e.Column.SortDirection = DataGridSortDirection.Ascending; | |
319 | + } | |
320 | + break; | |
321 | + | |
322 | + default: | |
323 | + logger.Trace("OnSorting: column not sortable."); | |
324 | + return; | |
325 | + } | |
326 | + | |
327 | + // Remove sorting indicators from other columns | |
328 | + foreach (var dgColumn in dg.Columns) | |
329 | + { | |
330 | + if (dgColumn.Tag?.ToString() != tag) | |
331 | + { | |
332 | + dgColumn.SortDirection = null; | |
333 | + } | |
334 | + } | |
335 | + } | |
32 | 336 | } |
33 | 337 | } |
@@ -19,13 +19,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Unity.WinUI", "D:\Rep | ||
19 | 19 | EndProject |
20 | 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait", "..\CleanAuLait\CleanAuLait.csproj", "{543C3E97-A0BC-4AC6-8780-701902406542}" |
21 | 21 | EndProject |
22 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CleanAuLait.Prism.WinUI3", "..\CleanAuLait.Prism.WinUI3\CleanAuLait.Prism.WinUI3.csproj", "{F804C913-6C3E-4116-82DB-24BFD501E397}" | |
22 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait.Prism.WinUI3", "..\CleanAuLait.Prism.WinUI3\CleanAuLait.Prism.WinUI3.csproj", "{F804C913-6C3E-4116-82DB-24BFD501E397}" | |
23 | 23 | EndProject |
24 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestNarou3.10Domain", "TestNarou3.Domain\TestNarou3.10Domain.csproj", "{9D49E4D8-8D72-4273-8393-D39EB047E8EE}" | |
24 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestNarou3.10Domain", "TestNarou3.Domain\TestNarou3.10Domain.csproj", "{9D49E4D8-8D72-4273-8393-D39EB047E8EE}" | |
25 | 25 | EndProject |
26 | -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObservableCollections", "..\ObservableCollectionsMod\src\ObservableCollections\ObservableCollections.csproj", "{17A69251-440F-4665-ACD1-986351AC168E}" | |
26 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestNarou3.20UseCase", "TestNarou3.UseCase\TestNarou3.20UseCase.csproj", "{7A85A717-EFEF-4F87-A2BB-76D03F864287}" | |
27 | 27 | EndProject |
28 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestNarou3.20UseCase", "TestNarou3.UseCase\TestNarou3.20UseCase.csproj", "{7A85A717-EFEF-4F87-A2BB-76D03F864287}" | |
28 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait.ObservableCollectionsMod", "..\CleanAuLait.ObservableCollectionsMod\CleanAuLait.ObservableCollectionsMod.csproj", "{B9BA0032-9C0E-4B3A-A646-8280D64EF45B}" | |
29 | 29 | EndProject |
30 | 30 | Global |
31 | 31 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
@@ -207,22 +207,6 @@ Global | ||
207 | 207 | {9D49E4D8-8D72-4273-8393-D39EB047E8EE}.Release|x64.Build.0 = Release|Any CPU |
208 | 208 | {9D49E4D8-8D72-4273-8393-D39EB047E8EE}.Release|x86.ActiveCfg = Release|Any CPU |
209 | 209 | {9D49E4D8-8D72-4273-8393-D39EB047E8EE}.Release|x86.Build.0 = Release|Any CPU |
210 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
211 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
212 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|arm64.ActiveCfg = Debug|Any CPU | |
213 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|arm64.Build.0 = Debug|Any CPU | |
214 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|x64.ActiveCfg = Debug|Any CPU | |
215 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|x64.Build.0 = Debug|Any CPU | |
216 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|x86.ActiveCfg = Debug|Any CPU | |
217 | - {17A69251-440F-4665-ACD1-986351AC168E}.Debug|x86.Build.0 = Debug|Any CPU | |
218 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
219 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|Any CPU.Build.0 = Release|Any CPU | |
220 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|arm64.ActiveCfg = Release|Any CPU | |
221 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|arm64.Build.0 = Release|Any CPU | |
222 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|x64.ActiveCfg = Release|Any CPU | |
223 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|x64.Build.0 = Release|Any CPU | |
224 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|x86.ActiveCfg = Release|Any CPU | |
225 | - {17A69251-440F-4665-ACD1-986351AC168E}.Release|x86.Build.0 = Release|Any CPU | |
226 | 210 | {7A85A717-EFEF-4F87-A2BB-76D03F864287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
227 | 211 | {7A85A717-EFEF-4F87-A2BB-76D03F864287}.Debug|Any CPU.Build.0 = Debug|Any CPU |
228 | 212 | {7A85A717-EFEF-4F87-A2BB-76D03F864287}.Debug|arm64.ActiveCfg = Debug|Any CPU |
@@ -239,6 +223,22 @@ Global | ||
239 | 223 | {7A85A717-EFEF-4F87-A2BB-76D03F864287}.Release|x64.Build.0 = Release|Any CPU |
240 | 224 | {7A85A717-EFEF-4F87-A2BB-76D03F864287}.Release|x86.ActiveCfg = Release|Any CPU |
241 | 225 | {7A85A717-EFEF-4F87-A2BB-76D03F864287}.Release|x86.Build.0 = Release|Any CPU |
226 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
227 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
228 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|arm64.ActiveCfg = Debug|Any CPU | |
229 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|arm64.Build.0 = Debug|Any CPU | |
230 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|x64.ActiveCfg = Debug|Any CPU | |
231 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|x64.Build.0 = Debug|Any CPU | |
232 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|x86.ActiveCfg = Debug|Any CPU | |
233 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Debug|x86.Build.0 = Debug|Any CPU | |
234 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
235 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|Any CPU.Build.0 = Release|Any CPU | |
236 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|arm64.ActiveCfg = Release|Any CPU | |
237 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|arm64.Build.0 = Release|Any CPU | |
238 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|x64.ActiveCfg = Release|Any CPU | |
239 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|x64.Build.0 = Release|Any CPU | |
240 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|x86.ActiveCfg = Release|Any CPU | |
241 | + {B9BA0032-9C0E-4B3A-A646-8280D64EF45B}.Release|x86.Build.0 = Release|Any CPU | |
242 | 242 | EndGlobalSection |
243 | 243 | GlobalSection(SolutionProperties) = preSolution |
244 | 244 | HideSolutionNode = FALSE |
@@ -278,6 +278,11 @@ public partial class App : PrismApplication | ||
278 | 278 | var vm = Container.Resolve<IMainWindowViewModel>(); |
279 | 279 | vm.OnClosing(); |
280 | 280 | |
281 | + if (Container.GetContainer() is IDisposable disposable) | |
282 | + { | |
283 | + disposable.Dispose(); | |
284 | + } | |
285 | + | |
281 | 286 | LogManager.Shutdown(); |
282 | 287 | } |
283 | 288 |
@@ -1,7 +1,8 @@ | ||
1 | 1 | { |
2 | 2 | "profiles": { |
3 | 3 | "TestNarou3 (Package)": { |
4 | - "commandName": "MsixPackage" | |
4 | + "commandName": "MsixPackage", | |
5 | + "nativeDebugging": false | |
5 | 6 | }, |
6 | 7 | "TestNarou3 (Unpackaged)": { |
7 | 8 | "commandName": "Project" |