예제 #1
0
        public void CalcRandom(int count)
        {
            try
            {
                var number1  = new Random().Next(0, 10000);
                var number2  = new Random().Next(0, 10000);
                var taskList = new List <Task>();
                Parallel.For(1, count, index =>
                {
                    logger.Info($"Start task {index}");
                    var task = App.EvaluateExAsync($"{number1}+{number2}");
                    taskList.Add(task);
                    taskList.Add(App.AbortModalAsync(false));
                });

                Task.WaitAll(taskList.ToArray());
            }
            catch (Exception ex)
            {
                logger.Error(ex, $"***** The method {nameof(CalcRandom)} was failed.", ex);
            }
        }