11using System ;
22using System . Collections . ObjectModel ;
33
4- using Nullinside . TwitchStreamingTools . ViewModels ;
4+ using CommunityToolkit . Mvvm . ComponentModel ;
55
6- using ReactiveUI ;
6+ using Nullinside . TwitchStreamingTools . ViewModels ;
77
88namespace Nullinside . TwitchStreamingTools . Controls . ViewModels ;
99
1010/// <summary>
1111/// Handles maintaining two lists and moving items between them.
1212/// </summary>
13- public class TwoListViewModel : ViewModelBase {
13+ public partial class TwoListViewModel : ViewModelBase {
1414 /// <summary>
1515 /// The behavior to maintain when double clicking
1616 /// </summary>
@@ -26,44 +26,50 @@ public enum DoubleClickBehavior {
2626 DELETE_FROM_LIST
2727 }
2828
29- private string ? _leftHeader ;
29+ /// <summary>
30+ /// The header on the left list.
31+ /// </summary>
32+ [ ObservableProperty ] private string ? _leftHeader ;
3033
3134 /// <summary>
3235 /// The collection of items in the left list.
3336 /// </summary>
34- private ObservableCollection < string > _leftList ;
37+ [ ObservableProperty ] private ObservableCollection < string > _leftList ;
3538
3639 /// <summary>
3740 /// The method to call when an item in the left list is double clicked.
3841 /// </summary>
39- private Action < string ? > ? _onLeftDoubleClick ;
42+ [ ObservableProperty ] private Action < string ? > ? _onLeftDoubleClick ;
4043
4144 /// <summary>
4245 /// The method to call when an item in the right list is double clicked.
4346 /// </summary>
44- private Action < string ? > ? _onRightDoubleClick ;
47+ [ ObservableProperty ] private Action < string ? > ? _onRightDoubleClick ;
4548
46- private string ? _rightHeader ;
49+ /// <summary>
50+ /// The header on the right list.
51+ /// </summary>
52+ [ ObservableProperty ] private string ? _rightHeader ;
4753
4854 /// <summary>
4955 /// The collection of items in the right list.
5056 /// </summary>
51- private ObservableCollection < string > _rightList ;
57+ [ ObservableProperty ] private ObservableCollection < string > _rightList ;
5258
5359 /// <summary>
5460 /// The behavior of how to handle double clicking on items in the right list.
5561 /// </summary>
56- private DoubleClickBehavior _rightListBehavior ;
62+ [ ObservableProperty ] private DoubleClickBehavior _rightListBehavior ;
5763
5864 /// <summary>
5965 /// A value indicating whether the left list should be sorted.
6066 /// </summary>
61- private bool _sortLeftList ;
67+ [ ObservableProperty ] private bool _sortLeftList ;
6268
6369 /// <summary>
6470 /// A value indicating whether the right list should be sorted.
6571 /// </summary>
66- private bool _sortRightList ;
72+ [ ObservableProperty ] private bool _sortRightList ;
6773
6874 /// <summary>
6975 /// Initializes a new instance of the <see cref="TwoListViewModel" /> class.
@@ -75,78 +81,6 @@ public TwoListViewModel() {
7581 OnRightDoubleClick += OnRightDoubleClicked ;
7682 }
7783
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-
15084 /// <summary>
15185 /// Adds an item to the left list.
15286 /// </summary>
0 commit comments