66
77namespace App . Presenters . Controls
88{
9- public class BeatmapListingPresenter : IBeatmapListingPresenter
9+ public class BeatmapListingPresenter
1010 {
1111 readonly IBeatmapListingView _view ;
1212 readonly IBeatmapListingModel _model ;
1313
14- private Beatmaps _beatmaps ;
15-
16- public Beatmaps Beatmaps
17- {
18- get
19- {
20- return _beatmaps ;
21- }
22- set
23- {
24- _beatmaps = value ;
25- _view . SetBeatmaps ( value ) ;
26- }
27- }
2814 public BeatmapListingPresenter ( IBeatmapListingView view , IBeatmapListingModel model )
2915 {
3016 _view = view ;
@@ -36,11 +22,11 @@ public BeatmapListingPresenter(IBeatmapListingView view, IBeatmapListingModel mo
3622 _view . BeatmapOperation += ( s , a ) => _model . EmitBeatmapOperation ( a ) ;
3723
3824 _model = model ;
39- _model . BeatmapsChanged += _model_BeatmapsChanged ;
25+ _model . BeatmapsChanged += ( _ , _ ) => RefreshBeatmapsInViewFromModel ( ) ;
4026 _model . FilteringStarted += ModelOnFilteringStarted ;
4127 _model . FilteringFinished += _model_FilteringFinished ;
4228 _view . SetFilter ( _model . GetFilter ( ) ) ;
43- Beatmaps = _model . GetBeatmaps ( ) ;
29+ RefreshBeatmapsInViewFromModel ( ) ;
4430 }
4531
4632 private void _model_FilteringFinished ( object sender , EventArgs e )
@@ -63,9 +49,15 @@ private void ViewOnSearchTextChanged(object sender, EventArgs eventArgs)
6349 _model . FilterBeatmaps ( _view . SearchText ) ;
6450 }
6551
66- private void _model_BeatmapsChanged ( object sender , System . EventArgs e )
52+ private void RefreshBeatmapsInViewFromModel ( )
6753 {
68- Beatmaps = _model . GetBeatmaps ( ) ;
54+ _view . SetBeatmaps ( _model . GetBeatmaps ( ) ) ;
55+ _view . ClearCustomFieldDefinitions ( ) ;
56+ var curCol = _model . CurrentCollection ;
57+ if ( curCol != null && curCol . CustomFieldDefinitions != null )
58+ {
59+ _view . SetCustomFieldDefinitions ( curCol . CustomFieldDefinitions ) ;
60+ }
6961 }
7062
7163
0 commit comments