Пример #1
0
        private async Task ProcessTesting()
        {
            TestingAction action;
            double        multiplier = 80 / tests.Count;

            foreach (var test in tests)
            {
                if (await IsTestPassed(test))
                {
                    action = AddNewAction($"[Пройдений] Тест №{testNumber}");
                    ChangeRowColor(action, Brushes.Green);
                    passedTests++;
                }
                else
                {
                    action = AddNewAction($"[Провалений] Тест №{testNumber}");
                    ChangeRowColor(action, Brushes.Red);
                    failedTests++;
                }
                testNumber++;
                progressBarStatus.Value += multiplier;
            }
            action = AddNewAction($"Провалено {failedTests} із {tests.Count}");
            ChangeRowColor(action, (failedTests == 0 ? Brushes.DarkGreen : Brushes.Red));
            action = AddNewAction($"Пройдено {passedTests} із {tests.Count}");
            ChangeRowColor(action, Brushes.DarkGreen);
            DataGridDetails.ScrollIntoView(action);
            progressBarStatus.Value = 100;
        }
Пример #2
0
        private void ChangeRowColor(TestingAction action, Brush color)
        {
            var dgIndex = ActionList.Count - 1;
            var lastRow = (DataGridRow)DataGridDetails.ItemContainerGenerator.ContainerFromIndex(dgIndex);

            if (lastRow == null)
            {
                DataGridDetails.UpdateLayout();
                DataGridDetails.ScrollIntoView(action);
                lastRow = (DataGridRow)DataGridDetails.ItemContainerGenerator.ContainerFromIndex(dgIndex);
            }
            lastRow.Foreground = color;
        }