@@ -17,6 +17,9 @@ namespace ByteSync.ViewModels.Sessions.Inventories;
1717
1818public class InventoryGlobalStatusViewModel : ActivatableViewModelBase
1919{
20+ private const string MainSecondaryColorBrushKey = "MainSecondaryColor" ;
21+ private const string HomeCloudSynchronizationBackGroundBrushKey = "HomeCloudSynchronizationBackGround" ;
22+
2023 private readonly IInventoryService _inventoryService = null ! ;
2124 private readonly ISessionService _sessionService = null ! ;
2225 private readonly IDialogService _dialogService = null ! ;
@@ -79,10 +82,15 @@ public InventoryGlobalStatusViewModel(IInventoryService inventoryService, ISessi
7982
8083 [ Reactive ]
8184 public int ? GlobalIdentificationErrors { get ; set ; }
85+
86+ [ Reactive ]
87+ public int ? GlobalSkippedEntries { get ; set ; }
8288
8389 public extern bool HasErrors { [ ObservableAsProperty ] get ; }
8490
8591 public extern bool HasIdentificationErrors { [ ObservableAsProperty ] get ; }
92+
93+ public extern bool HasGlobalSkippedEntries { [ ObservableAsProperty ] get ; }
8694
8795 [ Reactive ]
8896 public string GlobalMainIcon { get ; set ; } = "None" ;
@@ -112,6 +120,11 @@ private void SetupBasicProperties(CompositeDisposable disposables)
112120 . Select ( e => ( e ?? 0 ) > 0 )
113121 . ToPropertyEx ( this , x => x . HasIdentificationErrors )
114122 . DisposeWith ( disposables ) ;
123+
124+ this . WhenAnyValue ( x => x . GlobalSkippedEntries )
125+ . Select ( e => ( e ?? 0 ) > 0 )
126+ . ToPropertyEx ( this , x => x . HasGlobalSkippedEntries )
127+ . DisposeWith ( disposables ) ;
115128 }
116129
117130 private ReactiveStreams CreateStreams ( IInventoryStatisticsService inventoryStatisticsService , CompositeDisposable disposables )
@@ -200,7 +213,7 @@ private void SetupVisualElements(ReactiveStreams streams, CompositeDisposable di
200213 . DisposeWith ( disposables ) ;
201214 }
202215
203- private IObservable < ( string Icon , string Text , string BrushKey ) > CreateNonSuccessVisual (
216+ private static IObservable < ( string Icon , string Text , string BrushKey ) > CreateNonSuccessVisual (
204217 IObservable < InventoryTaskStatus > statusStream )
205218 {
206219 return statusStream
@@ -210,7 +223,7 @@ private void SetupVisualElements(ReactiveStreams streams, CompositeDisposable di
210223 InventoryTaskStatus . Cancelled => Resources . InventoryProcess_InventoryCancelled ,
211224 InventoryTaskStatus . Error => Resources . InventoryProcess_InventoryError ,
212225 _ => Resources . InventoryProcess_InventoryError
213- } , BrushKey : "MainSecondaryColor" ) ) ;
226+ } , BrushKey : MainSecondaryColorBrushKey ) ) ;
214227 }
215228
216229 private IObservable < ( string Icon , string Text , string BrushKey ) > CreateSuccessVisual ( ReactiveStreams streams )
@@ -231,18 +244,18 @@ private void SetupVisualElements(ReactiveStreams streams, CompositeDisposable di
231244 . Select ( t => GetSuccessVisualState ( t . s . AnalyzeErrors ) ) ;
232245 }
233246
234- private ( string Icon , string Text , string BrushKey ) GetSuccessVisualState ( int ? errors )
247+ private static ( string Icon , string Text , string BrushKey ) GetSuccessVisualState ( int ? errors )
235248 {
236249 if ( errors is > 0 )
237250 {
238251 var text = Resources . ResourceManager . GetString ( "InventoryProcess_InventorySuccessWithErrors" , Resources . Culture )
239252 ?? Resources . InventoryProcess_InventorySuccess ;
240253
241- return ( Icon : "RegularError" , Text : text , BrushKey : "MainSecondaryColor" ) ;
254+ return ( Icon : "RegularError" , Text : text , BrushKey : MainSecondaryColorBrushKey ) ;
242255 }
243256
244257 return ( Icon : "SolidCheckCircle" , Text : Resources . InventoryProcess_InventorySuccess ,
245- BrushKey : "HomeCloudSynchronizationBackGround" ) ;
258+ BrushKey : HomeCloudSynchronizationBackGroundBrushKey ) ;
246259 }
247260
248261 private void SetupStatisticsSubscription ( IInventoryStatisticsService inventoryStatisticsService ,
@@ -270,6 +283,7 @@ private void UpdateStatisticsValues(InventoryStatistics? stats)
270283 GlobalAnalyzeSuccess = stats ? . AnalyzeSuccess ;
271284 GlobalAnalyzeErrors = stats ? . AnalyzeErrors ;
272285 GlobalIdentificationErrors = stats ? . IdentificationErrors ;
286+ GlobalSkippedEntries = stats ? . TotalSkippedEntries ;
273287 }
274288
275289 private void ApplySuccessState ( int ? errors , int ? identificationErrors = null )
@@ -282,13 +296,13 @@ private void ApplySuccessState(int? errors, int? identificationErrors = null)
282296 ?? Resources . InventoryProcess_InventorySuccess ;
283297 GlobalMainIcon = "RegularError" ;
284298 GlobalMainStatusText = text ;
285- GlobalMainIconBrush = _themeService . GetBrush ( "MainSecondaryColor" ) ;
299+ GlobalMainIconBrush = _themeService . GetBrush ( MainSecondaryColorBrushKey ) ;
286300 }
287301 else
288302 {
289303 GlobalMainIcon = "SolidCheckCircle" ;
290304 GlobalMainStatusText = Resources . InventoryProcess_InventorySuccess ;
291- GlobalMainIconBrush = _themeService . GetBrush ( "HomeCloudSynchronizationBackGround" ) ;
305+ GlobalMainIconBrush = _themeService . GetBrush ( HomeCloudSynchronizationBackGroundBrushKey ) ;
292306 }
293307 }
294308
@@ -332,6 +346,7 @@ private void ResetStatistics()
332346 GlobalAnalyzeSuccess = null ;
333347 GlobalAnalyzeErrors = null ;
334348 GlobalIdentificationErrors = null ;
349+ GlobalSkippedEntries = null ;
335350 GlobalMainIcon = "None" ;
336351 GlobalMainStatusText = string . Empty ;
337352 GlobalMainIconBrush = null ;
@@ -363,21 +378,19 @@ private void UpdateGlobalMainIconBrush()
363378 case InventoryTaskStatus . Error :
364379 case InventoryTaskStatus . Cancelled :
365380 case InventoryTaskStatus . NotLaunched :
366- GlobalMainIconBrush = _themeService . GetBrush ( "MainSecondaryColor" ) ;
381+ GlobalMainIconBrush = _themeService . GetBrush ( MainSecondaryColorBrushKey ) ;
367382
368383 break ;
369384 case InventoryTaskStatus . Success :
370385 var errors = GlobalAnalyzeErrors ?? 0 ;
371386 var identificationErrors = GlobalIdentificationErrors ?? 0 ;
372387 GlobalMainIconBrush = ( errors + identificationErrors ) > 0
373- ? _themeService . GetBrush ( "MainSecondaryColor" )
374- : _themeService . GetBrush ( "HomeCloudSynchronizationBackGround" ) ;
388+ ? _themeService . GetBrush ( MainSecondaryColorBrushKey )
389+ : _themeService . GetBrush ( HomeCloudSynchronizationBackGroundBrushKey ) ;
375390
376391 break ;
377- case InventoryTaskStatus . Pending :
378- case InventoryTaskStatus . Running :
379392 default :
380- GlobalMainIconBrush = _themeService . GetBrush ( "HomeCloudSynchronizationBackGround" ) ;
393+ GlobalMainIconBrush = _themeService . GetBrush ( HomeCloudSynchronizationBackGroundBrushKey ) ;
381394
382395 break ;
383396 }
@@ -398,7 +411,7 @@ private async Task AbortInventory()
398411 }
399412 }
400413
401- private record ReactiveStreams (
414+ private sealed record ReactiveStreams (
402415 IObservable < InventoryTaskStatus > StatusStream ,
403416 IObservable < SessionStatus > SessionPreparation ,
404417 IObservable < InventoryStatistics ? > StatsStream ,
0 commit comments