1010
1111namespace Sharpnado . Presentation . Forms
1212{
13- public enum CompositionAutoResetCondition
13+ public enum ShowRefresherFromChildrenStrategy
1414 {
15- AnyCompleted = 0 ,
16- AllCompleted ,
15+ Never = 0 ,
16+ WhenAll ,
17+ WhenAny ,
1718 }
1819
1920 public class CompositeTaskLoaderNotifier : ITaskLoaderNotifier
2021 {
2122 protected const string Tag = "CompositeNotifier" ;
2223
24+ private readonly ShowRefresherFromChildrenStrategy _showRefresherFromChildrenStrategy ;
25+
2326 private readonly ITaskLoaderNotifier [ ] _loaders ;
2427
2528 private bool _showLoader ;
@@ -35,9 +38,16 @@ public class CompositeTaskLoaderNotifier : ITaskLoaderNotifier
3538
3639 private Exception _lastError ;
3740
41+ public CompositeTaskLoaderNotifier ( params ITaskLoaderNotifier [ ] taskLoaderNotifiers )
42+ : this ( ShowRefresherFromChildrenStrategy . Never , taskLoaderNotifiers )
43+ {
44+ }
45+
3846 public CompositeTaskLoaderNotifier (
47+ ShowRefresherFromChildrenStrategy showRefresherFromChildrenStrategy ,
3948 params ITaskLoaderNotifier [ ] taskLoaderNotifiers )
4049 {
50+ _showRefresherFromChildrenStrategy = showRefresherFromChildrenStrategy ;
4151 _loaders = taskLoaderNotifiers ;
4252
4353 Subscribe ( ) ;
@@ -169,6 +179,11 @@ public Exception LastError
169179
170180 public TimeSpan AutoResetDelay { get ; } = TimeSpan . Zero ;
171181
182+ public void OnTaskOverloaded ( )
183+ {
184+ InternalLogger . Debug ( Tag , ( ) => $ "OnTaskOverloaded() : let the child tasks handle their states") ;
185+ }
186+
172187 public void Load ( bool isRefreshing = false )
173188 {
174189 InternalLogger . Debug ( Tag , ( ) => $ "Load()") ;
@@ -262,7 +277,16 @@ private void LoaderOnPropertyChanged(object sender, PropertyChangedEventArgs e)
262277 break ;
263278
264279 case nameof ( ShowRefresher ) :
265- ShowRefresher = _loaders . Any ( l => l . ShowRefresher ) ;
280+ switch ( _showRefresherFromChildrenStrategy )
281+ {
282+ case ShowRefresherFromChildrenStrategy . WhenAny :
283+ ShowLoader = _loaders . Any ( l => l . ShowLoader ) ;
284+ break ;
285+ case ShowRefresherFromChildrenStrategy . WhenAll :
286+ ShowLoader = _loaders . All ( l => l . ShowLoader ) ;
287+ break ;
288+ }
289+
266290 break ;
267291
268292 case nameof ( ShowResult ) :
0 commit comments