private void PerformExecution() { //Run all tasks to determine current status var isGlobalyFailed = false; foreach (var executableTask in _taskRepository.GetAllExecutableTasks()) { executableTask.IsFailed = !IsExecutionSuccessful(executableTask); if (executableTask.IsFailed) { if (_globalStatus == TasksGlobalStatusEnum.IsOk) { TasksGlobalStatusChanged?.BeginInvoke(TasksGlobalStatusEnum.IsFailed, null, null); _globalStatus = TasksGlobalStatusEnum.IsFailed; } isGlobalyFailed = true; } } //If global status came back to normal if (!isGlobalyFailed && _globalStatus == TasksGlobalStatusEnum.IsFailed) { TasksGlobalStatusChanged?.BeginInvoke(TasksGlobalStatusEnum.IsOk, null, null); _globalStatus = TasksGlobalStatusEnum.IsOk; } }
private void AppStatusChanged(TasksGlobalStatusEnum status) { if (status == TasksGlobalStatusEnum.IsOk) { _currentErrorStatus = TasksGlobalStatusEnum.IsOk; _sysTrayWrapper.StopWarningAnimation(); } else if (status == TasksGlobalStatusEnum.IsFailed) { _currentErrorStatus = TasksGlobalStatusEnum.IsFailed; //Desactivate working animation if running if (_currentWorkingStatus == AppWorkingStatusEnum.IsWorking) { _sysTrayWrapper.StopWorkingAnimation(); } _sysTrayWrapper.StartWarningAnimation(); } }
public TaskHandler(ExecutableTaskRepository taskRepository) { _globalStatus = TasksGlobalStatusEnum.IsOk; _taskRepository = taskRepository; }