1
1
using System ;
2
2
using System . Collections . ObjectModel ;
3
3
4
- using Nullinside . TwitchStreamingTools . ViewModels ;
4
+ using CommunityToolkit . Mvvm . ComponentModel ;
5
5
6
- using ReactiveUI ;
6
+ using Nullinside . TwitchStreamingTools . ViewModels ;
7
7
8
8
namespace Nullinside . TwitchStreamingTools . Controls . ViewModels ;
9
9
10
10
/// <summary>
11
11
/// Handles maintaining two lists and moving items between them.
12
12
/// </summary>
13
- public class TwoListViewModel : ViewModelBase {
13
+ public partial class TwoListViewModel : ViewModelBase {
14
14
/// <summary>
15
15
/// The behavior to maintain when double clicking
16
16
/// </summary>
@@ -26,44 +26,50 @@ public enum DoubleClickBehavior {
26
26
DELETE_FROM_LIST
27
27
}
28
28
29
- private string ? _leftHeader ;
29
+ /// <summary>
30
+ /// The header on the left list.
31
+ /// </summary>
32
+ [ ObservableProperty ] private string ? _leftHeader ;
30
33
31
34
/// <summary>
32
35
/// The collection of items in the left list.
33
36
/// </summary>
34
- private ObservableCollection < string > _leftList ;
37
+ [ ObservableProperty ] private ObservableCollection < string > _leftList ;
35
38
36
39
/// <summary>
37
40
/// The method to call when an item in the left list is double clicked.
38
41
/// </summary>
39
- private Action < string ? > ? _onLeftDoubleClick ;
42
+ [ ObservableProperty ] private Action < string ? > ? _onLeftDoubleClick ;
40
43
41
44
/// <summary>
42
45
/// The method to call when an item in the right list is double clicked.
43
46
/// </summary>
44
- private Action < string ? > ? _onRightDoubleClick ;
47
+ [ ObservableProperty ] private Action < string ? > ? _onRightDoubleClick ;
45
48
46
- private string ? _rightHeader ;
49
+ /// <summary>
50
+ /// The header on the right list.
51
+ /// </summary>
52
+ [ ObservableProperty ] private string ? _rightHeader ;
47
53
48
54
/// <summary>
49
55
/// The collection of items in the right list.
50
56
/// </summary>
51
- private ObservableCollection < string > _rightList ;
57
+ [ ObservableProperty ] private ObservableCollection < string > _rightList ;
52
58
53
59
/// <summary>
54
60
/// The behavior of how to handle double clicking on items in the right list.
55
61
/// </summary>
56
- private DoubleClickBehavior _rightListBehavior ;
62
+ [ ObservableProperty ] private DoubleClickBehavior _rightListBehavior ;
57
63
58
64
/// <summary>
59
65
/// A value indicating whether the left list should be sorted.
60
66
/// </summary>
61
- private bool _sortLeftList ;
67
+ [ ObservableProperty ] private bool _sortLeftList ;
62
68
63
69
/// <summary>
64
70
/// A value indicating whether the right list should be sorted.
65
71
/// </summary>
66
- private bool _sortRightList ;
72
+ [ ObservableProperty ] private bool _sortRightList ;
67
73
68
74
/// <summary>
69
75
/// Initializes a new instance of the <see cref="TwoListViewModel" /> class.
@@ -75,78 +81,6 @@ public TwoListViewModel() {
75
81
OnRightDoubleClick += OnRightDoubleClicked ;
76
82
}
77
83
78
- /// <summary>
79
- /// Gets or sets the collection of items in the left list.
80
- /// </summary>
81
- public ObservableCollection < string > LeftList {
82
- get => _leftList ;
83
- set => this . RaiseAndSetIfChanged ( ref _leftList , value ) ;
84
- }
85
-
86
- /// <summary>
87
- /// Gets or sets the collection of items in the right list.
88
- /// </summary>
89
- public Action < string ? > ? OnLeftDoubleClick {
90
- get => _onLeftDoubleClick ;
91
- set => this . RaiseAndSetIfChanged ( ref _onLeftDoubleClick , value ) ;
92
- }
93
-
94
- /// <summary>
95
- /// Gets or sets the method to call when an item in the left list is double clicked.
96
- /// </summary>
97
- public Action < string ? > ? OnRightDoubleClick {
98
- get => _onRightDoubleClick ;
99
- set => this . RaiseAndSetIfChanged ( ref _onRightDoubleClick , value ) ;
100
- }
101
-
102
- /// <summary>
103
- /// Gets or sets the method to call when an item in the right list is double clicked.
104
- /// </summary>
105
- public ObservableCollection < string > RightList {
106
- get => _rightList ;
107
- set => this . RaiseAndSetIfChanged ( ref _rightList , value ) ;
108
- }
109
-
110
- /// <summary>
111
- /// Gets or sets the behavior of how to handle double clicking on items in the right list.
112
- /// </summary>
113
- public DoubleClickBehavior RightListBehavior {
114
- get => _rightListBehavior ;
115
- set => this . RaiseAndSetIfChanged ( ref _rightListBehavior , value ) ;
116
- }
117
-
118
- /// <summary>
119
- /// Gets or sets a value indicating whether the left list should be sorted.
120
- /// </summary>
121
- public bool SortLeftList {
122
- get => _sortLeftList ;
123
- set => this . RaiseAndSetIfChanged ( ref _sortLeftList , value ) ;
124
- }
125
-
126
- /// <summary>
127
- /// Gets or sets a value indicating whether the right list should be sorted.
128
- /// </summary>
129
- public bool SortRightList {
130
- get => _sortRightList ;
131
- set => this . RaiseAndSetIfChanged ( ref _sortRightList , value ) ;
132
- }
133
-
134
- /// <summary>
135
- /// The left header.
136
- /// </summary>
137
- public string ? LeftHeader {
138
- get => _leftHeader ;
139
- set => this . RaiseAndSetIfChanged ( ref _leftHeader , value ) ;
140
- }
141
-
142
- /// <summary>
143
- /// The right header.
144
- /// </summary>
145
- public string ? RightHeader {
146
- get => _rightHeader ;
147
- set => this . RaiseAndSetIfChanged ( ref _rightHeader , value ) ;
148
- }
149
-
150
84
/// <summary>
151
85
/// Adds an item to the left list.
152
86
/// </summary>
0 commit comments