private NotifierState GetNotifierState() { var orderedList = NotifierStateList.Enum().Where(x => x.Notifier.Guid == _notifier.Guid).Enum().OrderByDescending(x => x.Level); if (orderedList.IsNullOrEmpty()) { throw new Exception("Reporter progress, il n'existe pas de notifier state"); } return(NotifierStateList.Where(x => x.Notifier.Guid == _notifier.Guid).OrderByDescending(x => x.Level).First()); }
public SubLevel(ProgressCancelNotifier iNotifier, int iProgressCount, int iThreadCount) { lock (_notifierStateListLocker) { _notifier = iNotifier; var theLastState = NotifierStateList.Where(x => x.Notifier.Guid == iNotifier.Guid); int level = 1; if (theLastState.IsNotNullAndNotEmpty()) { level = theLastState.OrderByDescending(x => x.Level).First().Level + 1; } var newState = new NotifierState(); newState.Level = level; newState.Notifier = iNotifier; newState.ProgressCounter = 0; newState.ProgressCount = iProgressCount; newState.ThreadCount = iThreadCount; NotifierStateList.Add(newState); } }