なろうブックマーク分析用ツールのPrism+MAUIサンプル実装
修訂 | 9b22bbc5f4626c0ce4b6fd8a6aeaa795d4eb8e50 (tree) |
---|---|
時間 | 2022-08-25 06:35:28 |
作者 | yoshy <yoshy.org.bitbucket@gz.j...> |
Commiter | yoshy |
[UPG] ObservableCollectionMod を CleanAuLait.ObservableCollectionMod に差し替え
[MOD] Service/Model/ViewModel の破棄処理が正しく行われるように改善
[CLEAN] コードクリーンナップ
@@ -12,7 +12,7 @@ namespace TestNarou2.Adaptor.Boundary.Gateway.ViewModel | ||
12 | 12 | IAppWindowController WindowController { get; } |
13 | 13 | |
14 | 14 | ReactiveProperty<IBookmarkCategoryRowViewModel> SelectedItem { get; } |
15 | - ISynchronizedSingleView<BookmarkCategoryRow, IBookmarkCategoryRowViewModel> Rows { get; } | |
15 | + INotifyCollectionChangedListSynchronizedSingleView<BookmarkCategoryRow, IBookmarkCategoryRowViewModel> Rows { get; } | |
16 | 16 | |
17 | 17 | BookmarkCategory Source { get; } |
18 | 18 |
@@ -15,7 +15,7 @@ namespace TestNarou2.Adaptor.Boundary.Gateway.ViewModel | ||
15 | 15 | internal static readonly Uri URI = new("BookmarkDetailListView", UriKind.Relative); |
16 | 16 | |
17 | 17 | ReactiveProperty<IBookmarkDetailListRowViewModel> SelectedItem { get; } |
18 | - ISynchronizedSingleView<BookmarkDetailListRow, IBookmarkDetailListRowViewModel> Rows { get; } | |
18 | + INotifyCollectionChangedListSynchronizedSingleView<BookmarkDetailListRow, IBookmarkDetailListRowViewModel> Rows { get; } | |
19 | 19 | |
20 | 20 | ReactiveCommand CommandOpenBookmark { get; } |
21 | 21 | BookmarkDetailList Source { get; } |
@@ -1,4 +1,5 @@ | ||
1 | -using CleanAuLait.ObservableCollectionsMod; | |
1 | +using CleanAuLait.Core.Log; | |
2 | +using CleanAuLait.ObservableCollectionsMod; | |
2 | 3 | using NLog; |
3 | 4 | using Reactive.Bindings; |
4 | 5 | using Reactive.Bindings.Extensions; |
@@ -14,7 +15,7 @@ using TestNarou2.Domain.Model.Entity.Child; | ||
14 | 15 | namespace TestNarou2.Adaptor.Gateway.ViewModel |
15 | 16 | { |
16 | 17 | internal class BookmarkCategoryViewModel |
17 | - : IBookmarkCategoryViewModel, INotifyPropertyChanged, IDestructible | |
18 | + : IBookmarkCategoryViewModel, INotifyPropertyChanged, IDestructible, IDisposable | |
18 | 19 | { |
19 | 20 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
20 | 21 |
@@ -24,14 +25,16 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
24 | 25 | |
25 | 26 | public ReactiveProperty<IBookmarkCategoryRowViewModel> SelectedItem { get; } |
26 | 27 | |
27 | - public ISynchronizedSingleView<BookmarkCategoryRow, IBookmarkCategoryRowViewModel> Rows { get; private set; } = null; | |
28 | + public INotifyCollectionChangedListSynchronizedSingleView<BookmarkCategoryRow, IBookmarkCategoryRowViewModel> Rows { get; private set; } = null; | |
28 | 29 | |
29 | 30 | public BookmarkCategory Source { get; private set; } |
30 | 31 | |
31 | 32 | public IAppWindowController WindowController { get; } |
32 | 33 | |
33 | 34 | private readonly IBookmarkCategoryRowViewModelTranslator vmTranslator; |
35 | + | |
34 | 36 | private readonly CompositeDisposable disposables = new(); |
37 | + private bool disposedValue; | |
35 | 38 | |
36 | 39 | public BookmarkCategoryViewModel( |
37 | 40 | IAppWindowController wc, |
@@ -44,6 +47,8 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
44 | 47 | this.SelectedItem.Subscribe(OnSelectedItemChanged).AddTo(disposables); |
45 | 48 | } |
46 | 49 | |
50 | + #region event handler | |
51 | + | |
47 | 52 | private void OnSelectedItemChanged(IBookmarkCategoryRowViewModel row) |
48 | 53 | { |
49 | 54 | if (row == null) |
@@ -53,30 +58,69 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
53 | 58 | this.WindowController.NavigateBookmarkListView(row.Index); |
54 | 59 | } |
55 | 60 | |
61 | + #endregion | |
62 | + | |
63 | + #region vm operation | |
64 | + | |
56 | 65 | public void SynchronizeWith(BookmarkCategory source) |
57 | 66 | { |
58 | - if (this.Rows != null) | |
67 | + if (this.Source == null) | |
59 | 68 | { |
60 | - this.Rows.Dispose(); | |
61 | - this.disposables.Remove(this.Rows); | |
69 | + this.Rows = source.Rows | |
70 | + .ToSynchronizedCoupleView(r => this.vmTranslator.Translate(r, this)) | |
71 | + .ToSynchronizedSingleView() | |
72 | + .WithINotifyCollectionChangedList() | |
73 | + .AddTo(disposables); | |
74 | + | |
75 | + logger.Trace("BookmarkCategoryViewModel.SynchronizeWith: source [{0}], collection view [{1}]", | |
76 | + source.ToHashString(), this.Rows.GetType().FullName); | |
77 | + | |
78 | + this.Source = source; | |
79 | + | |
80 | + // after transitioning to the bookmark page, the first category must be selected. | |
81 | + if (source.Rows.Count() > 0) | |
82 | + { | |
83 | + this.SelectedItem.Value = this.Rows.ElementAt(0); | |
84 | + } | |
62 | 85 | } |
86 | + else | |
87 | + { | |
88 | + logger.Trace("BookmarkCategoryViewModel.SynchronizeWith: viewmodel already synchronized to model [{0}]", | |
89 | + this.Source.ToHashString()); | |
90 | + } | |
91 | + } | |
63 | 92 | |
64 | - this.Rows = source.Rows | |
65 | - .ToSynchronizedCoupleView(r => this.vmTranslator.Translate(r, this)) | |
66 | - .ToSynchronizedSingleView() | |
67 | - .AddTo(disposables); | |
68 | - | |
69 | - logger.Trace("BookmarkCategoryViewModel.SynchronizeWith: collection view [{0}]", this.Rows.GetType().FullName); | |
93 | + #endregion | |
70 | 94 | |
71 | - this.Source = source; | |
95 | + #region IDestructible, IDisposable | |
72 | 96 | |
73 | - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.Rows))); | |
97 | + public void Destroy() | |
98 | + { | |
99 | + this.Dispose(); | |
74 | 100 | } |
75 | 101 | |
76 | - public void Destroy() | |
102 | + protected virtual void Dispose(bool disposing) | |
77 | 103 | { |
104 | + if (!disposedValue) | |
105 | + { | |
106 | + if (disposing) | |
107 | + { | |
78 | 108 | this.disposables.Dispose(); |
109 | + | |
110 | + logger.Trace("BookmarkCategoryViewModel disposed."); | |
111 | + } | |
112 | + | |
113 | + disposedValue = true; | |
114 | + } | |
79 | 115 | } |
80 | 116 | |
117 | + public void Dispose() | |
118 | + { | |
119 | + Dispose(disposing: true); | |
120 | + GC.SuppressFinalize(this); | |
121 | + } | |
122 | + | |
123 | + #endregion | |
124 | + | |
81 | 125 | } |
82 | 126 | } |
@@ -1,4 +1,5 @@ | ||
1 | -using CleanAuLait.ObservableCollectionsMod; | |
1 | +using CleanAuLait.Core.Log; | |
2 | +using CleanAuLait.ObservableCollectionsMod; | |
2 | 3 | using NLog; |
3 | 4 | using Reactive.Bindings; |
4 | 5 | using Reactive.Bindings.Extensions; |
@@ -15,7 +16,7 @@ using TestNarou2.Domain.Model.Entity.Child; | ||
15 | 16 | namespace TestNarou2.Adaptor.Gateway.ViewModel |
16 | 17 | { |
17 | 18 | internal class BookmarkDetailListViewModel |
18 | - : IBookmarkDetailListViewModel, INotifyPropertyChanged, IDestructible | |
19 | + : IBookmarkDetailListViewModel, INotifyPropertyChanged, IDestructible, IDisposable | |
19 | 20 | { |
20 | 21 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
21 | 22 |
@@ -25,7 +26,7 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
25 | 26 | |
26 | 27 | public ReactiveProperty<IBookmarkDetailListRowViewModel> SelectedItem { get; } |
27 | 28 | |
28 | - public ISynchronizedSingleView<BookmarkDetailListRow, IBookmarkDetailListRowViewModel> Rows { get; private set; } = null; | |
29 | + public INotifyCollectionChangedListSynchronizedSingleView<BookmarkDetailListRow, IBookmarkDetailListRowViewModel> Rows { get; private set; } = null; | |
29 | 30 | |
30 | 31 | public ReactiveCommand CommandOpenBookmark { get; } |
31 | 32 |
@@ -34,9 +35,10 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
34 | 35 | private IAppWindowController WindowController { get; } |
35 | 36 | |
36 | 37 | private IBookmarkDetailListRowViewModel selectedRow; |
37 | - | |
38 | 38 | private readonly IBookmarkDetailListRowViewModelTranslator vmTranslator; |
39 | + | |
39 | 40 | private readonly CompositeDisposable disposables = new(); |
41 | + private bool disposedValue; | |
40 | 42 | |
41 | 43 | public BookmarkDetailListViewModel( |
42 | 44 | IAppWindowController wc, |
@@ -52,6 +54,8 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
52 | 54 | .WithSubscribe(OpenBookmark).AddTo(disposables); |
53 | 55 | } |
54 | 56 | |
57 | + #region event handler | |
58 | + | |
55 | 59 | private void OnSelectedItemChanged(IBookmarkDetailListRowViewModel selectedRow) |
56 | 60 | { |
57 | 61 | this.selectedRow = selectedRow; |
@@ -59,44 +63,77 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
59 | 63 | |
60 | 64 | private void OpenBookmark() |
61 | 65 | { |
66 | + logger.Trace("OpenBookmark: {0}", this.selectedRow?.NCode ?? "item not selected"); | |
67 | + | |
62 | 68 | if (this.selectedRow == null) |
63 | 69 | { |
64 | 70 | return; |
65 | 71 | } |
66 | 72 | |
67 | - logger.Trace("OpenBookmark: {0}", this.selectedRow.NCode); | |
68 | - | |
69 | 73 | // TODO Service |
70 | 74 | |
71 | 75 | string url = "https://ncode.syosetu.com/" + this.selectedRow.NCode.ToLower(); |
72 | 76 | Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); |
73 | 77 | } |
74 | 78 | |
79 | + #endregion | |
80 | + | |
81 | + #region vm operation | |
82 | + | |
75 | 83 | public void SynchronizeWith(BookmarkDetailList source) |
76 | 84 | { |
77 | - if (this.Rows != null) | |
85 | + if (this.Source == null) | |
78 | 86 | { |
79 | - this.Rows.Dispose(); | |
80 | - this.disposables.Remove(this.Rows); | |
81 | - } | |
82 | - | |
83 | 87 | this.Rows = source.Rows |
84 | 88 | .ToSynchronizedCoupleView(r => this.vmTranslator.Translate(r, this)) |
85 | 89 | .ToSynchronizedSingleView() |
90 | + .WithINotifyCollectionChangedList() | |
86 | 91 | .AddTo(disposables); |
87 | 92 | |
88 | - logger.Trace("BookmarkListViewModel.SynchronizeWith: collection view [{0}]", this.Rows.GetType().FullName); | |
89 | - | |
90 | - this.Source = source; | |
93 | + logger.Trace("BookmarkDetailListViewModel.SynchronizeWith: source [{0}], collection view [{1}]", | |
94 | + source.ToHashString(), this.Rows.GetType().FullName); | |
91 | 95 | |
92 | - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(this.Rows))); | |
96 | + this.Source = source; | |
97 | + } | |
98 | + else | |
99 | + { | |
100 | + logger.Trace("BookmarkDetailListViewModel.SynchronizeWith: viewmodel already synchronized to model [{0}]", | |
101 | + this.Source.ToHashString()); | |
102 | + } | |
93 | 103 | } |
94 | 104 | |
105 | + #endregion | |
106 | + | |
107 | + #region IDestructible, IDisposable | |
108 | + | |
95 | 109 | public void Destroy() |
96 | 110 | { |
97 | - this.disposables.Dispose(); | |
111 | + this.Dispose(); | |
98 | 112 | } |
99 | 113 | |
114 | + protected virtual void Dispose(bool disposing) | |
115 | + { | |
116 | + if (!disposedValue) | |
117 | + { | |
118 | + if (disposing) | |
119 | + { | |
120 | + this.disposables.Dispose(); | |
121 | + | |
122 | + logger.Trace("BookmarkDetailListViewModel disposed."); | |
123 | + } | |
124 | + | |
125 | + disposedValue = true; | |
126 | + } | |
127 | + } | |
128 | + | |
129 | + public void Dispose() | |
130 | + { | |
131 | + Dispose(disposing: true); | |
132 | + GC.SuppressFinalize(this); | |
133 | + } | |
134 | + | |
135 | + #endregion | |
136 | + | |
100 | 137 | #region INavigationAware |
101 | 138 | |
102 | 139 | public void OnNavigatedFrom(INavigationParameters parameters) |
@@ -1,23 +1,54 @@ | ||
1 | -using System.ComponentModel; | |
1 | +using NLog; | |
2 | +using System.ComponentModel; | |
2 | 3 | using System.Reactive.Disposables; |
3 | 4 | using TestNarou2.Adaptor.Boundary.Gateway.ViewModel; |
4 | 5 | |
5 | 6 | namespace TestNarou2.Adaptor.Gateway.ViewModel |
6 | 7 | { |
7 | - internal class BookmarkViewModel : IBookmarkViewModel, IDestructible | |
8 | + internal class BookmarkViewModel : IBookmarkViewModel, IDestructible, IDisposable | |
8 | 9 | { |
9 | - //private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
10 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
10 | 11 | |
11 | 12 | #pragma warning disable CS0067 |
12 | 13 | public event PropertyChangedEventHandler PropertyChanged; |
13 | 14 | #pragma warning restore CS0067 |
14 | 15 | |
15 | 16 | private readonly CompositeDisposable disposables = new(); |
17 | + private bool disposedValue; | |
18 | + | |
19 | + #region IDestructible | |
16 | 20 | |
17 | 21 | public void Destroy() |
18 | 22 | { |
23 | + this.Dispose(); | |
24 | + } | |
25 | + | |
26 | + #endregion | |
27 | + | |
28 | + #region IDisposable | |
29 | + | |
30 | + protected virtual void Dispose(bool disposing) | |
31 | + { | |
32 | + if (!disposedValue) | |
33 | + { | |
34 | + if (disposing) | |
35 | + { | |
19 | 36 | this.disposables.Dispose(); |
37 | + | |
38 | + logger.Trace("BookmarkViewModel disposed."); | |
39 | + } | |
40 | + | |
41 | + disposedValue = true; | |
42 | + } | |
43 | + } | |
44 | + | |
45 | + public void Dispose() | |
46 | + { | |
47 | + Dispose(disposing: true); | |
48 | + GC.SuppressFinalize(this); | |
20 | 49 | } |
21 | 50 | |
51 | + #endregion | |
52 | + | |
22 | 53 | } |
23 | 54 | } |
@@ -12,8 +12,6 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
12 | 12 | { |
13 | 13 | d.Name.AddTo(d.disposables); |
14 | 14 | d.Count.AddTo(d.disposables); |
15 | - //d.IsSelected.AddTo(d.disposables); | |
16 | - //d.IsSelected.Subscribe(d.OnSelectedItemChanged).AddTo(d.disposables); | |
17 | 15 | } |
18 | 16 | } |
19 | 17 | } |
@@ -1,4 +1,5 @@ | ||
1 | -using Reactive.Bindings; | |
1 | +using NLog; | |
2 | +using Reactive.Bindings; | |
2 | 3 | using System.Reactive.Disposables; |
3 | 4 | using TestNarou2.Adaptor.Boundary.Gateway.ViewModel; |
4 | 5 | using TestNarou2.Adaptor.Boundary.Gateway.ViewModel.Child; |
@@ -12,11 +13,12 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
12 | 13 | ImageSource ItemImage, |
13 | 14 | ReadOnlyReactiveProperty<string> Name, |
14 | 15 | ReadOnlyReactiveProperty<int> Count, |
15 | - //ReactiveProperty<bool> IsSelected, | |
16 | 16 | IBookmarkCategoryViewModel Parent, |
17 | 17 | BookmarkCategoryRow Source |
18 | 18 | ) : IBookmarkCategoryRowViewModel, IDisposable |
19 | 19 | { |
20 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
21 | + | |
20 | 22 | private readonly CompositeDisposable disposables = new(); |
21 | 23 | private bool disposedValue; |
22 | 24 |
@@ -26,23 +28,12 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
26 | 28 | ItemImage: ImageHelper.FolderImage, |
27 | 29 | Name: null, |
28 | 30 | Count: null, |
29 | - //IsSelected: null, | |
30 | 31 | Parent: parent, |
31 | 32 | Source: row |
32 | 33 | ) |
33 | 34 | { |
34 | 35 | } |
35 | -#if false | |
36 | - private void OnSelectedItemChanged(bool isSelected) | |
37 | - { | |
38 | - if (!isSelected) | |
39 | - { | |
40 | - return; | |
41 | - } | |
42 | 36 | |
43 | - this.Parent.WindowController.NavigateBookmarkListView(this.Index); | |
44 | - } | |
45 | -#endif | |
46 | 37 | protected virtual void Dispose(bool disposing) |
47 | 38 | { |
48 | 39 | if (!disposedValue) |
@@ -50,6 +41,7 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
50 | 41 | if (disposing) |
51 | 42 | { |
52 | 43 | this.disposables.Dispose(); |
44 | + logger.Trace("BookmarkCategoryRowViewModel[{0}] disposed.", this.Index); | |
53 | 45 | } |
54 | 46 | |
55 | 47 | disposedValue = true; |
@@ -28,9 +28,6 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
28 | 28 | d.AllPoint.AddTo(d.disposables); |
29 | 29 | d.AllHyokaCnt.AddTo(d.disposables); |
30 | 30 | d.NovelUpdatedAt.AddTo(d.disposables); |
31 | - | |
32 | - //d.IsSelected.AddTo(d.disposables); | |
33 | - //d.IsSelected.Subscribe(d.OnSelectedItemChanged).AddTo(d.disposables); | |
34 | 31 | } |
35 | 32 | } |
36 | 33 | } |
@@ -1,4 +1,5 @@ | ||
1 | -using Reactive.Bindings; | |
1 | +using NLog; | |
2 | +using Reactive.Bindings; | |
2 | 3 | using System.Reactive.Disposables; |
3 | 4 | using TestNarou2.Adaptor.Boundary.Gateway.ViewModel; |
4 | 5 | using TestNarou2.Adaptor.Boundary.Gateway.ViewModel.Child; |
@@ -9,6 +10,8 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
9 | 10 | internal partial record class BookmarkDetailListRowViewModel |
10 | 11 | : IBookmarkDetailListRowViewModel, IDisposable |
11 | 12 | { |
13 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
14 | + | |
12 | 15 | public string NCode { get; private set; } |
13 | 16 | public ReadOnlyReactiveProperty<string> Summary { get; private set; } |
14 | 17 | public ReadOnlyReactiveProperty<string> Title { get; private set; } |
@@ -32,7 +35,7 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
32 | 35 | public ReadOnlyReactiveProperty<string> GeneralFirstUp { get; private set; } |
33 | 36 | public ReadOnlyReactiveProperty<string> GeneralLastUp { get; private set; } |
34 | 37 | public ReadOnlyReactiveProperty<string> NovelUpdatedAt { get; private set; } |
35 | - //public ReactiveProperty<bool> IsSelected { get; private set; } | |
38 | + | |
36 | 39 | public IBookmarkDetailListViewModel Parent { get; private set; } |
37 | 40 | public BookmarkDetailListRow Source { get; private set; } |
38 | 41 |
@@ -46,18 +49,6 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
46 | 49 | this.Parent = parent; |
47 | 50 | } |
48 | 51 | |
49 | -#if false | |
50 | - private void OnSelectedItemChanged(bool isSelected) | |
51 | - { | |
52 | - if (!isSelected) | |
53 | - { | |
54 | - return; | |
55 | - } | |
56 | - | |
57 | - this.Parent.NotifySelectedItemChanged(this); | |
58 | - } | |
59 | -#endif | |
60 | - | |
61 | 52 | protected virtual void Dispose(bool disposing) |
62 | 53 | { |
63 | 54 | if (!disposedValue) |
@@ -65,6 +56,7 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel.Child | ||
65 | 56 | if (disposing) |
66 | 57 | { |
67 | 58 | this.disposables.Dispose(); |
59 | + logger.Trace("BookmarkDetailListRowViewModel[{0}] disposed.", this.NCode); | |
68 | 60 | } |
69 | 61 | |
70 | 62 | disposedValue = true; |
@@ -10,7 +10,7 @@ using TestNarou2.UseCase.Request; | ||
10 | 10 | |
11 | 11 | namespace TestNarou2.Adaptor.Gateway.ViewModel |
12 | 12 | { |
13 | - internal class LoginFormViewModel : ILoginFormViewModel, IDestructible | |
13 | + internal class LoginFormViewModel : ILoginFormViewModel, IDestructible, IDisposable | |
14 | 14 | { |
15 | 15 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
16 | 16 |
@@ -25,6 +25,7 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
25 | 25 | private readonly IAppWindowController wc; |
26 | 26 | |
27 | 27 | private readonly CompositeDisposable disposables = new(); |
28 | + private bool disposedValue; | |
28 | 29 | |
29 | 30 | public LoginFormViewModel(IAppWindowController wc) |
30 | 31 | { |
@@ -36,11 +37,37 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
36 | 37 | this.CommandLogin = new ReactiveCommand().WithSubscribe(OnLogin).AddTo(disposables); |
37 | 38 | } |
38 | 39 | |
40 | + #region IDestructible, IDisposable | |
41 | + | |
39 | 42 | public void Destroy() |
40 | 43 | { |
44 | + this.Dispose(); | |
45 | + } | |
46 | + | |
47 | + protected virtual void Dispose(bool disposing) | |
48 | + { | |
49 | + if (!disposedValue) | |
50 | + { | |
51 | + if (disposing) | |
52 | + { | |
41 | 53 | this.disposables.Dispose(); |
54 | + | |
55 | + logger.Trace("LoginFormViewModel disposed."); | |
56 | + } | |
57 | + | |
58 | + disposedValue = true; | |
59 | + } | |
60 | + } | |
61 | + | |
62 | + public void Dispose() | |
63 | + { | |
64 | + // このコードを変更しないでください。クリーンアップ コードを 'Dispose(bool disposing)' メソッドに記述します | |
65 | + Dispose(disposing: true); | |
66 | + GC.SuppressFinalize(this); | |
42 | 67 | } |
43 | 68 | |
69 | + #endregion | |
70 | + | |
44 | 71 | #region event handler |
45 | 72 | |
46 | 73 | private async void OnLogin() |
@@ -71,5 +98,6 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
71 | 98 | } |
72 | 99 | |
73 | 100 | #endregion |
101 | + | |
74 | 102 | } |
75 | 103 | } |
@@ -1,52 +0,0 @@ | ||
1 | -using Reactive.Bindings; | |
2 | -using Reactive.Bindings.Extensions; | |
3 | -using System.Reactive.Disposables; | |
4 | - | |
5 | -namespace TestNarou2.Adaptor.Gateway.ViewModel | |
6 | -{ | |
7 | - public class MainPageViewModel : IDisposable | |
8 | - { | |
9 | - public ReactiveProperty<string> Text { get; } | |
10 | - | |
11 | - public ReactiveCommand CommandClicked { get; } | |
12 | - | |
13 | - private int count = 0; | |
14 | - | |
15 | - private readonly CompositeDisposable disposables = new(); | |
16 | - private bool disposedValue; | |
17 | - | |
18 | - public MainPageViewModel() | |
19 | - { | |
20 | - this.Text = new ReactiveProperty<string>("click me.").AddTo(disposables); | |
21 | - | |
22 | - this.CommandClicked = new ReactiveCommand().WithSubscribe(OnClicked).AddTo(disposables); | |
23 | - } | |
24 | - | |
25 | - private void OnClicked() | |
26 | - { | |
27 | - this.count++; | |
28 | - this.Text.Value = $"clicked {this.count} time(s)."; | |
29 | - | |
30 | - SemanticScreenReader.Announce(this.Text.Value); | |
31 | - } | |
32 | - | |
33 | - protected virtual void Dispose(bool disposing) | |
34 | - { | |
35 | - if (!disposedValue) | |
36 | - { | |
37 | - if (disposing) | |
38 | - { | |
39 | - this.disposables.Dispose(); | |
40 | - } | |
41 | - | |
42 | - disposedValue = true; | |
43 | - } | |
44 | - } | |
45 | - | |
46 | - public void Dispose() | |
47 | - { | |
48 | - Dispose(disposing: true); | |
49 | - GC.SuppressFinalize(this); | |
50 | - } | |
51 | - } | |
52 | -} |
@@ -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.Reactive.Disposables; |
4 | 5 | using TestNarou2.Adaptor.Boundary.Controller; |
@@ -8,15 +9,18 @@ using TestNarou2.UseCase.Request; | ||
8 | 9 | |
9 | 10 | namespace TestNarou2.Adaptor.Gateway.ViewModel |
10 | 11 | { |
11 | - internal class MainWindowViewModel : IMainWindowViewModel, IDestructible | |
12 | + internal class MainWindowViewModel : IMainWindowViewModel, IDestructible, IDisposable | |
12 | 13 | { |
13 | - private IAppWindowController wc; | |
14 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
14 | 15 | |
15 | 16 | public ReactiveProperty<string> Title { get; } |
16 | 17 | |
17 | 18 | public ReactiveCommand CommandClosed { get; } |
18 | 19 | |
20 | + private readonly IAppWindowController wc; | |
21 | + | |
19 | 22 | private readonly CompositeDisposable disposables = new(); |
23 | + private bool disposedValue; | |
20 | 24 | |
21 | 25 | public MainWindowViewModel( |
22 | 26 | IAppCaptionFormatter caption, |
@@ -33,12 +37,38 @@ namespace TestNarou2.Adaptor.Gateway.ViewModel | ||
33 | 37 | { |
34 | 38 | _ = this.wc.Execute(new NarouLogoutRequest()); |
35 | 39 | _ = this.wc.Execute(new AppConfigSaveRequest()); |
40 | + | |
41 | + this.Dispose(); | |
36 | 42 | } |
37 | 43 | |
44 | + #region IDestructible, IDisposable | |
45 | + | |
38 | 46 | public void Destroy() |
39 | 47 | { |
40 | - this.disposables.Dispose(); | |
48 | + this.Dispose(); | |
49 | + } | |
50 | + | |
51 | + protected virtual void Dispose(bool disposing) | |
52 | + { | |
53 | + if (!disposedValue) | |
54 | + { | |
55 | + if (disposing) | |
56 | + { | |
57 | + this.disposables.Dispose(); | |
58 | + | |
59 | + logger.Trace("MainWindowViewModel disposed."); | |
60 | + } | |
61 | + | |
62 | + disposedValue = true; | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + public void Dispose() | |
67 | + { | |
68 | + Dispose(disposing: true); | |
69 | + GC.SuppressFinalize(this); | |
41 | 70 | } |
71 | + #endregion | |
42 | 72 | |
43 | 73 | } |
44 | 74 | } |
@@ -37,11 +37,6 @@ namespace TestNarou2.Adaptor.Translator | ||
37 | 37 | opts => opts.MapFrom(s => s.Name)) |
38 | 38 | .ForMember(d => d.Count, |
39 | 39 | opts => opts.MapFrom(s => s.Count)) |
40 | -#if false | |
41 | - .ForMember(d => d.IsSelected, | |
42 | - opts => opts.MapFrom(s => s.IsSelected | |
43 | - .ToReactivePropertyAsSynchronized(x => x.Value, ReactivePropertyMode.Default, false))) | |
44 | -#endif | |
45 | 40 | .ForMember(d => d.Parent, |
46 | 41 | opts => opts.Ignore()) |
47 | 42 | .ForMember(d => d.Source, |
@@ -92,11 +92,6 @@ namespace TestNarou2.Adaptor.Translator | ||
92 | 92 | opts => opts.ConvertUsing(new SubstringConverter(10), s => s.GeneralLastUp)) |
93 | 93 | .ForMember(d => d.NovelUpdatedAt, |
94 | 94 | opts => opts.ConvertUsing(new SubstringConverter(10), s => s.NovelUpdatedAt)) |
95 | -#if false | |
96 | - .ForMember(d => d.IsSelected, | |
97 | - opts => opts.MapFrom(s => s.IsSelected | |
98 | - .ToReactivePropertyAsSynchronized(x => x.Value, ReactivePropertyMode.Default, false))) | |
99 | -#endif | |
100 | 95 | .ForMember(d => d.Parent, |
101 | 96 | opts => opts.Ignore()) |
102 | 97 | .ForMember(d => d.Source, |
@@ -2,7 +2,7 @@ | ||
2 | 2 | |
3 | 3 | namespace TestNarou2.Domain.Boundary.Repository |
4 | 4 | { |
5 | - public interface INarouRepository : IDestructible | |
5 | + public interface INarouRepository : IDisposable | |
6 | 6 | { |
7 | 7 | string Login(string id, string password); |
8 | 8 | void Logout(string dataToken); |
@@ -1,4 +1,5 @@ | ||
1 | -using ObservableCollections; | |
1 | +using NLog; | |
2 | +using ObservableCollections; | |
2 | 3 | using TestNarou2.Domain.Model.Entity.Child; |
3 | 4 | |
4 | 5 | namespace TestNarou2.Domain.Model.Entity |
@@ -7,31 +8,20 @@ namespace TestNarou2.Domain.Model.Entity | ||
7 | 8 | ObservableList<BookmarkCategoryRow> Rows |
8 | 9 | ) : IDisposable |
9 | 10 | { |
11 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
12 | + | |
10 | 13 | private bool disposedValue; |
11 | 14 | |
12 | 15 | public BookmarkCategory() : this( |
13 | - Rows: new ObservableList<BookmarkCategoryRow>() | |
14 | - ) | |
15 | - { | |
16 | - } | |
17 | - | |
18 | - public BookmarkCategory(IEnumerable<BookmarkCategoryRow> lists) : this( | |
19 | - Rows: CreateRows(lists) | |
16 | + Rows: new() | |
20 | 17 | ) |
21 | 18 | { |
22 | 19 | } |
23 | 20 | |
24 | - private static ObservableList<BookmarkCategoryRow> | |
25 | - CreateRows(IEnumerable<BookmarkCategoryRow> lists) | |
21 | + public void Refresh(IEnumerable<BookmarkCategoryRow> rows) | |
26 | 22 | { |
27 | - ObservableList<BookmarkCategoryRow> rows = new(); | |
28 | - | |
29 | - foreach (var row in lists) | |
30 | - { | |
31 | - rows.Add(row); | |
32 | - } | |
33 | - | |
34 | - return rows; | |
23 | + this.Rows.Clear(); | |
24 | + this.Rows.AddRange(rows); | |
35 | 25 | } |
36 | 26 | |
37 | 27 | protected virtual void Dispose(bool disposing) |
@@ -44,6 +34,8 @@ namespace TestNarou2.Domain.Model.Entity | ||
44 | 34 | { |
45 | 35 | row.Dispose(); |
46 | 36 | } |
37 | + | |
38 | + logger.Trace("BookmarkCategory disposed."); | |
47 | 39 | } |
48 | 40 | |
49 | 41 | disposedValue = true; |
@@ -1,4 +1,5 @@ | ||
1 | -using ObservableCollections; | |
1 | +using NLog; | |
2 | +using ObservableCollections; | |
2 | 3 | using TestNarou2.Domain.Model.Entity.Child; |
3 | 4 | |
4 | 5 | namespace TestNarou2.Domain.Model.Entity |
@@ -7,31 +8,20 @@ namespace TestNarou2.Domain.Model.Entity | ||
7 | 8 | ObservableList<BookmarkDetailListRow> Rows |
8 | 9 | ) : IDisposable |
9 | 10 | { |
11 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
12 | + | |
10 | 13 | private bool disposedValue; |
11 | 14 | |
12 | 15 | public BookmarkDetailList() : this( |
13 | - Rows: new ObservableList<BookmarkDetailListRow>() | |
14 | - ) | |
15 | - { | |
16 | - } | |
17 | - | |
18 | - public BookmarkDetailList(IEnumerable<BookmarkDetailListRow> lists) : this( | |
19 | - Rows: CreateRows(lists) | |
16 | + Rows: new() | |
20 | 17 | ) |
21 | 18 | { |
22 | 19 | } |
23 | 20 | |
24 | - private static ObservableList<BookmarkDetailListRow> | |
25 | - CreateRows(IEnumerable<BookmarkDetailListRow> lists) | |
26 | - { | |
27 | - ObservableList<BookmarkDetailListRow> rows = new(); | |
28 | - | |
29 | - foreach (var row in lists) | |
21 | + public void Refresh(IEnumerable<BookmarkDetailListRow> rows) | |
30 | 22 | { |
31 | - rows.Add(row); | |
32 | - } | |
33 | - | |
34 | - return rows; | |
23 | + this.Rows.Clear(); | |
24 | + this.Rows.AddRange(rows); | |
35 | 25 | } |
36 | 26 | |
37 | 27 | protected virtual void Dispose(bool disposing) |
@@ -44,6 +34,8 @@ namespace TestNarou2.Domain.Model.Entity | ||
44 | 34 | { |
45 | 35 | row.Dispose(); |
46 | 36 | } |
37 | + | |
38 | + logger.Trace("BookmarkDetailList disposed."); | |
47 | 39 | } |
48 | 40 | |
49 | 41 | 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.Reactive.Disposables; |
4 | 5 |
@@ -7,23 +8,22 @@ namespace TestNarou2.Domain.Model.Entity.Child | ||
7 | 8 | public partial record class BookmarkCategoryRow( |
8 | 9 | int Index, |
9 | 10 | ReactivePropertySlim<string> Name, |
10 | - ReactivePropertySlim<int> Count, | |
11 | - ReactivePropertySlim<bool> IsSelected | |
11 | + ReactivePropertySlim<int> Count | |
12 | 12 | ) : IDisposable |
13 | 13 | { |
14 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
15 | + | |
14 | 16 | private readonly CompositeDisposable disposables = new(); |
15 | 17 | private bool disposedValue; |
16 | 18 | |
17 | 19 | public BookmarkCategoryRow(int index): this( |
18 | 20 | Index: index, |
19 | 21 | Name: new(), |
20 | - Count: new(), | |
21 | - IsSelected: new() | |
22 | + Count: new() | |
22 | 23 | ) |
23 | 24 | { |
24 | 25 | this.Name.AddTo(this.disposables); |
25 | 26 | this.Count.AddTo(this.disposables); |
26 | - this.IsSelected.AddTo(this.disposables); | |
27 | 27 | } |
28 | 28 | |
29 | 29 | protected virtual void Dispose(bool disposing) |
@@ -33,6 +33,7 @@ namespace TestNarou2.Domain.Model.Entity.Child | ||
33 | 33 | if (disposing) |
34 | 34 | { |
35 | 35 | this.disposables.Dispose(); |
36 | + logger.Trace("BookmarkCategoryRow[{0}] disposed.", Index); | |
36 | 37 | } |
37 | 38 | |
38 | 39 | 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.Reactive.Disposables; |
4 | 5 |
@@ -36,10 +37,11 @@ namespace TestNarou2.Domain.Model.Entity.Child | ||
36 | 37 | ReactivePropertySlim<int> AllHyokaCnt, |
37 | 38 | ReactivePropertySlim<string> GeneralFirstUp, |
38 | 39 | ReactivePropertySlim<string> GeneralLastUp, |
39 | - ReactivePropertySlim<string> NovelUpdatedAt, | |
40 | - ReactivePropertySlim<bool> IsSelected | |
40 | + ReactivePropertySlim<string> NovelUpdatedAt | |
41 | 41 | ) : IDisposable |
42 | 42 | { |
43 | + private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); | |
44 | + | |
43 | 45 | private readonly CompositeDisposable disposables = new(); |
44 | 46 | private bool disposedValue; |
45 | 47 |
@@ -75,8 +77,7 @@ namespace TestNarou2.Domain.Model.Entity.Child | ||
75 | 77 | AllHyokaCnt: new(), |
76 | 78 | GeneralFirstUp: new(), |
77 | 79 | GeneralLastUp: new(), |
78 | - NovelUpdatedAt: new(), | |
79 | - IsSelected: new() | |
80 | + NovelUpdatedAt: new() | |
80 | 81 | ) |
81 | 82 | { |
82 | 83 | this.Title.AddTo(this.disposables); |
@@ -109,7 +110,6 @@ namespace TestNarou2.Domain.Model.Entity.Child | ||
109 | 110 | this.GeneralFirstUp.AddTo(this.disposables); |
110 | 111 | this.GeneralLastUp.AddTo(this.disposables); |
111 | 112 | this.NovelUpdatedAt.AddTo(this.disposables); |
112 | - this.IsSelected.AddTo(this.disposables); | |
113 | 113 | } |
114 | 114 | |
115 | 115 | protected virtual void Dispose(bool disposing) |
@@ -119,6 +119,7 @@ namespace TestNarou2.Domain.Model.Entity.Child | ||
119 | 119 | if (disposing) |
120 | 120 | { |
121 | 121 | this.disposables.Dispose(); |
122 | + logger.Trace("BookmarkDetailListRow[{0}] disposed.", NCode); | |
122 | 123 | } |
123 | 124 | |
124 | 125 | disposedValue = true; |
@@ -8,20 +8,22 @@ using TestNarou2.Domain.Translator; | ||
8 | 8 | |
9 | 9 | namespace TestNarou2.Domain.Service |
10 | 10 | { |
11 | - internal class NarouService : INarouService, IDestructible | |
11 | + internal class NarouService : INarouService, IDisposable | |
12 | 12 | { |
13 | 13 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
14 | 14 | |
15 | 15 | private string DataToken { get; set; } |
16 | 16 | |
17 | - private BookmarkCategory Categeory { get; set; } | |
18 | - private BookmarkDetailList DetailList { get; set; } | |
17 | + private BookmarkCategory Categeory { get; } | |
18 | + private BookmarkDetailList DetailList { get; } | |
19 | 19 | |
20 | 20 | private readonly INarouRepository repo; |
21 | 21 | |
22 | 22 | private readonly IBookmarkCategoryRowTranslator vmCategoryRowTranslator; |
23 | 23 | private readonly IBookmarkDetailListRowTranslator vmDetailRowTranslator; |
24 | 24 | |
25 | + private bool disposedValue; | |
26 | + | |
25 | 27 | public NarouService( |
26 | 28 | INarouRepository repo, |
27 | 29 | IBookmarkCategoryRowTranslator vmCategoryRowTranslator, |
@@ -32,6 +34,9 @@ namespace TestNarou2.Domain.Service | ||
32 | 34 | |
33 | 35 | this.vmCategoryRowTranslator = vmCategoryRowTranslator; |
34 | 36 | this.vmDetailRowTranslator = vmDetailRowTranslator; |
37 | + | |
38 | + this.Categeory = new(); | |
39 | + this.DetailList = new(); | |
35 | 40 | } |
36 | 41 | |
37 | 42 | public void Login(string id, string password) |
@@ -60,8 +65,7 @@ namespace TestNarou2.Domain.Service | ||
60 | 65 | pair => this.vmCategoryRowTranslator.Translate(pair.category, pair.no) |
61 | 66 | ); |
62 | 67 | |
63 | - this.Categeory?.Dispose(); | |
64 | - this.Categeory = new(rows); | |
68 | + this.Categeory.Refresh(rows); | |
65 | 69 | |
66 | 70 | return this.Categeory; |
67 | 71 | } |
@@ -75,18 +79,37 @@ namespace TestNarou2.Domain.Service | ||
75 | 79 | IEnumerable<BookmarkDetailListRow> detailRows = |
76 | 80 | novelInfos.Skip(1).Select(v => vmDetailRowTranslator.Translate(v)); |
77 | 81 | |
78 | - this.DetailList?.Dispose(); | |
79 | - this.DetailList = new(detailRows); | |
82 | + this.DetailList.Refresh(detailRows); | |
80 | 83 | |
81 | 84 | return this.DetailList; |
82 | 85 | } |
83 | 86 | |
84 | - public void Destroy() | |
87 | + #region IDisposable | |
88 | + | |
89 | + protected virtual void Dispose(bool disposing) | |
85 | 90 | { |
86 | - this.Categeory?.Dispose(); | |
87 | - this.DetailList?.Dispose(); | |
91 | + if (!disposedValue) | |
92 | + { | |
93 | + if (disposing) | |
94 | + { | |
95 | + this.Categeory?.Dispose(); | |
96 | + this.DetailList?.Dispose(); | |
97 | + | |
98 | + this.repo?.Dispose(); | |
99 | + | |
100 | + logger.Trace("NarouService disposed."); | |
101 | + } | |
88 | 102 | |
89 | - this.repo?.Destroy(); | |
103 | + disposedValue = true; | |
104 | + } | |
90 | 105 | } |
106 | + | |
107 | + public void Dispose() | |
108 | + { | |
109 | + Dispose(disposing: true); | |
110 | + GC.SuppressFinalize(this); | |
111 | + } | |
112 | + | |
113 | + #endregion | |
91 | 114 | } |
92 | 115 | } |
@@ -29,7 +29,6 @@ namespace TestNarou2.Domain.Translator | ||
29 | 29 | .ForMember(d => d.Index, opts => opts.Ignore()) |
30 | 30 | .ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name)) |
31 | 31 | .ForMember(d => d.Count, opts => opts.MapFrom(s => s.Count)) |
32 | - .ForMember(d => d.IsSelected, opts => opts.Ignore()) | |
33 | 32 | .DisableCtorValidation(); |
34 | 33 | } |
35 | 34 | } |
@@ -58,7 +58,6 @@ namespace TestNarou2.Domain.Translator | ||
58 | 58 | .ForMember(d => d.GeneralFirstUp, opts => opts.MapFrom(s => s.GeneralFirstUp)) |
59 | 59 | .ForMember(d => d.GeneralLastUp, opts => opts.MapFrom(s => s.GeneralLastUp)) |
60 | 60 | .ForMember(d => d.NovelUpdatedAt, opts => opts.MapFrom(s => s.NovelUpdatedAt)) |
61 | - .ForMember(d => d.IsSelected, opts => opts.Ignore()) | |
62 | 61 | .DisableCtorValidation(); |
63 | 62 | } |
64 | 63 | } |
@@ -5,7 +5,7 @@ using System.Text; | ||
5 | 5 | |
6 | 6 | namespace TestNarou2.OuterEdge.Repository.API |
7 | 7 | { |
8 | - internal class HttpClientHelper : IDestructible | |
8 | + internal class HttpClientHelper : IDisposable | |
9 | 9 | { |
10 | 10 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
11 | 11 |
@@ -20,6 +20,8 @@ namespace TestNarou2.OuterEdge.Repository.API | ||
20 | 20 | private readonly HttpClientHandler httpClientHandler; |
21 | 21 | private readonly HttpClient httpClient; |
22 | 22 | |
23 | + private bool disposedValue; | |
24 | + | |
23 | 25 | public HttpClientHelper() |
24 | 26 | { |
25 | 27 | cookies = new(); |
@@ -60,6 +62,30 @@ namespace TestNarou2.OuterEdge.Repository.API | ||
60 | 62 | } |
61 | 63 | } |
62 | 64 | |
65 | + #region IDisposable | |
66 | + | |
67 | + protected virtual void Dispose(bool disposing) | |
68 | + { | |
69 | + if (!disposedValue) | |
70 | + { | |
71 | + if (disposing) | |
72 | + { | |
73 | + httpClient.Dispose(); | |
74 | + logger.Trace("HttpClientHelper disposed."); | |
75 | + } | |
76 | + | |
77 | + disposedValue = true; | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + public void Dispose() | |
82 | + { | |
83 | + Dispose(disposing: true); | |
84 | + GC.SuppressFinalize(this); | |
85 | + } | |
86 | + | |
87 | + #endregion | |
88 | + | |
63 | 89 | public async Task<HttpResponseMessage> GetAsync(string url, string referer) |
64 | 90 | { |
65 | 91 | var request = CreateRequestMessage(url, referer, HttpMethod.Post); |
@@ -169,10 +195,5 @@ namespace TestNarou2.OuterEdge.Repository.API | ||
169 | 195 | |
170 | 196 | return Encoding.UTF8.GetString(raw); |
171 | 197 | } |
172 | - | |
173 | - public void Destroy() | |
174 | - { | |
175 | - httpClient.Dispose(); | |
176 | - } | |
177 | 198 | } |
178 | 199 | } |
@@ -45,6 +45,32 @@ namespace TestNarou2.OuterEdge.Repository.API | ||
45 | 45 | |
46 | 46 | private readonly HttpClientHelper httpClient = new(); |
47 | 47 | |
48 | + private bool disposedValue; | |
49 | + | |
50 | + #region IDisposable | |
51 | + | |
52 | + protected virtual void Dispose(bool disposing) | |
53 | + { | |
54 | + if (!disposedValue) | |
55 | + { | |
56 | + if (disposing) | |
57 | + { | |
58 | + this.httpClient?.Dispose(); | |
59 | + logger.Trace("NarouRepository disposed."); | |
60 | + } | |
61 | + | |
62 | + disposedValue = true; | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + public void Dispose() | |
67 | + { | |
68 | + Dispose(disposing: true); | |
69 | + System.GC.SuppressFinalize(this); | |
70 | + } | |
71 | + | |
72 | + #endregion | |
73 | + | |
48 | 74 | public string Login(string id, string password) |
49 | 75 | { |
50 | 76 | var form = new Dictionary<string, string>() |
@@ -252,11 +278,5 @@ namespace TestNarou2.OuterEdge.Repository.API | ||
252 | 278 | |
253 | 279 | return json; |
254 | 280 | } |
255 | - | |
256 | - public void Destroy() | |
257 | - { | |
258 | - this.httpClient?.Destroy(); | |
259 | - } | |
260 | - | |
261 | 281 | } |
262 | 282 | } |
@@ -6,7 +6,7 @@ | ||
6 | 6 | xmlns:vm="http://schemas.drillion.net/testnarou2/viewmodel"> |
7 | 7 | |
8 | 8 | <ListView ItemsSource="{Binding Rows}" |
9 | - SelectedItem="{Binding SelectedItem.Value}" SelectionMode="Single"> | |
9 | + SelectedItem="{Binding SelectedItem.Value, Mode=TwoWay}" SelectionMode="Single"> | |
10 | 10 | |
11 | 11 | <!-- |
12 | 12 | <ListView.Resources> |
@@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait.Prism", "..\Cle | ||
26 | 26 | EndProject |
27 | 27 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait.ObservableCollectionsMod", "..\CleanAuLait.ObservableCollectionsMod\CleanAuLait.ObservableCollectionsMod.csproj", "{6901733E-1944-48C0-8C61-2418ACE94AD3}" |
28 | 28 | EndProject |
29 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObservableCollections", "D:\Repo\gitroot\ObservableCollectionsMod\src\ObservableCollections\ObservableCollections.csproj", "{6A4ED2F0-C62A-49FC-8189-5217A5E0EE6A}" | |
30 | +EndProject | |
29 | 31 | Global |
30 | 32 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
31 | 33 | Debug|Any CPU = Debug|Any CPU |
@@ -74,6 +76,10 @@ Global | ||
74 | 76 | {6901733E-1944-48C0-8C61-2418ACE94AD3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
75 | 77 | {6901733E-1944-48C0-8C61-2418ACE94AD3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
76 | 78 | {6901733E-1944-48C0-8C61-2418ACE94AD3}.Release|Any CPU.Build.0 = Release|Any CPU |
79 | + {6A4ED2F0-C62A-49FC-8189-5217A5E0EE6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
80 | + {6A4ED2F0-C62A-49FC-8189-5217A5E0EE6A}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
81 | + {6A4ED2F0-C62A-49FC-8189-5217A5E0EE6A}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
82 | + {6A4ED2F0-C62A-49FC-8189-5217A5E0EE6A}.Release|Any CPU.Build.0 = Release|Any CPU | |
77 | 83 | EndGlobalSection |
78 | 84 | GlobalSection(SolutionProperties) = preSolution |
79 | 85 | HideSolutionNode = FALSE |