You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/modules/background-jobs/app/Volo.Abp.BackgroundJobs.Dem.../Jobs/WriteToConsoleYellowJob.cs

28 lines
949 B

using System;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs
{
public class WriteToConsoleYellowJob : BackgroundJob<WriteToConsoleYellowJobArgs>, ITransientDependency
{
public override void Execute(WriteToConsoleYellowJobArgs args)
{
if (RandomHelper.GetRandom(0, 100) < 70)
{
//throw new ApplicationException("A sample exception from the WriteToConsoleYellowJob!");
}
lock (Console.Out)
{
var oldColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine();
Console.WriteLine($"############### WriteToConsoleYellowJob: {args.Value} - {args.Time:HH:mm:ss} ###############");
Console.WriteLine();
Console.ForegroundColor = oldColor;
}
}
}
}