Example #1
0
        private void AddTaskMeasurementIfNeeded(IWorkTask task, List <TaskMeasurement> tasksMeasurements)
        {
            if (mOpenTasksMeasurementsDict.TryGetValue(task.ID, out TaskMeasurementInfo taskMeasurementInfo))
            {
                if (!taskMeasurementInfo.TaskMeasurement.Triangle.ShouldNotifyExact())
                {
                    return;
                }

                int currentProgressPercentage =
                    taskMeasurementInfo.TaskMeasurement.Triangle.GetCurrentTimeProgressPercentage();

                if (taskMeasurementInfo.PercentageProgress < currentProgressPercentage)
                {
                    AddOrUpdateNewTaskMeasurement(taskMeasurementInfo, tasksMeasurements);
                }

                return;
            }

            TaskMeasurement taskMeasurement = new TaskMeasurement(task.ID, task.Description, task.TaskMeasurement);

            taskMeasurementInfo = new TaskMeasurementInfo(taskMeasurement);
            AddOrUpdateNewTaskMeasurement(taskMeasurementInfo, tasksMeasurements);
        }
Example #2
0
        private void AddOrUpdateNewTaskMeasurement(TaskMeasurementInfo taskMeasurementInfo,
                                                   List <TaskMeasurement> TasksMeasurements)
        {
            mLogger.LogDebug($"Adding or updating task {taskMeasurementInfo.TaskMeasurement.Id} to dictionary");

            mOpenTasksMeasurementsDict.AddOrUpdate(
                taskMeasurementInfo.TaskMeasurement.Id, taskMeasurementInfo, (key, value) => value);

            TasksMeasurements.Add(taskMeasurementInfo.TaskMeasurement);
        }