From 353003efbcfd0f461b393d7242f1ef2d401c39fe Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 28 May 2020 12:22:01 +0300 Subject: Updated original job handler with Vica's work. --- .../Tango.JobProgressTester.UI/JobHandler2.cs | 36 +++++++++------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'Software/Visual_Studio/Utilities') diff --git a/Software/Visual_Studio/Utilities/Tango.JobProgressTester.UI/JobHandler2.cs b/Software/Visual_Studio/Utilities/Tango.JobProgressTester.UI/JobHandler2.cs index 27dfa2ebe..e646ee51e 100644 --- a/Software/Visual_Studio/Utilities/Tango.JobProgressTester.UI/JobHandler2.cs +++ b/Software/Visual_Studio/Utilities/Tango.JobProgressTester.UI/JobHandler2.cs @@ -20,44 +20,36 @@ namespace Tango.JobProgressTester.UI protected override void InvalidateJobProgress(JobStatus s) { - //base.InvalidateJobProgress(s); //Vica: Remove this and create new implementation. JobStatus = s; - bool invalidProgress = false; - // if (_last_progress != s.Progress) - // { - if (s.Progress <= PROGRESS_REPORT_RANGE_METERS || s.Progress >= Status.TotalProgress - PROGRESS_REPORT_RANGE_METERS) + if (_last_progress != s.Progress) { - LogManager.Log($"Updating job progress {s.Progress}/{Status.TotalProgress}..."); - } - else if (!loggedContinueMessage) - { - loggedContinueMessage = true; - LogManager.Log($"Progress logging will continue {PROGRESS_REPORT_RANGE_METERS} meters before completion..."); + if (s.Progress <= PROGRESS_REPORT_RANGE_METERS || s.Progress >= Status.TotalProgress - PROGRESS_REPORT_RANGE_METERS) + { + LogManager.Log($"Updating job progress {s.Progress}/{Status.TotalProgress}..."); + } + else if (!loggedContinueMessage) + { + loggedContinueMessage = true; + LogManager.Log($"Progress logging will continue {PROGRESS_REPORT_RANGE_METERS} meters before completion..."); + } } - //} if (s.Progress < 0) { LogManager.Log($"Invalid job progress received '{s.Progress}'.", LogCategory.Error); - invalidProgress = true; + return; } if (s.Progress > Status.TotalProgress) { LogManager.Log($"Invalid job progress received '{s.Progress}' while total progress is '{Status.TotalProgress}'.", LogCategory.Error); - invalidProgress = true; + return; } - //if (s.Progress < _last_progress) - //{ - // LogManager.Log($"Invalid job progress received '{s.Progress}' while last progress was '{_last_progress}'."); - // invalidProgress = true; - //} - - if (invalidProgress) + if (s.Progress < _last_progress) { - return; + LogManager.Log($"Invalid job progress received '{s.Progress}' while last progress was '{_last_progress}'."); } _last_progress = s.Progress; -- cgit v1.3.1