//出现错误右键修复,自动添加包usingQuartz;usingQuartz.Impl;usingQuartz.Logging;usingSystem;usingSystem.Threading.Tasks;namespaceConsoleSkWork{classProgram{privatestaticasyncTaskMain(string[] args){
LogProvider.SetCurrentLogProvider(newConsoleLogProvider());// Grab the Scheduler instance from the FactoryStdSchedulerFactory factory =newStdSchedulerFactory();IScheduler scheduler =await factory.GetScheduler();// and start it offawait scheduler.Start();// define the job and tie it to our HelloJob classIJobDetail job = JobBuilder.Create<HelloJob>().WithIdentity("job1","group1").Build();// Trigger the job to run now, and then repeat every 10 secondsITrigger trigger = TriggerBuilder.Create().WithIdentity("trigger1","group1").StartNow().WithSimpleSchedule(x => x
.WithIntervalInSeconds(10).RepeatForever()).Build();// Tell Quartz to schedule the job using our triggerawait scheduler.ScheduleJob(job, trigger);// some sleep to show what's happeningawait Task.Delay(TimeSpan.FromSeconds(60));// and last shut down the scheduler when you are ready to close your programawait scheduler.Shutdown();
Console.WriteLine("Press any key to close the application");
Console.ReadKey();}// simple log provider to get something to the console//https://www.quartz-scheduler.net/documentation/quartz-3.x/quick-start.html#trying-out-the-applicationprivateclassConsoleLogProvider:ILogProvider{publicLoggerGetLogger(string name){return(level, func, exception, parameters)=>{if(level >= LogLevel.Info && func !=null){
Console.WriteLine("["+ DateTime.Now.ToLongTimeString()+"] ["+ level +"] "+func(), parameters);}returntrue;};}publicIDisposableOpenNestedContext(string message){thrownewNotImplementedException();}publicIDisposableOpenMappedContext(string key,objectvalue,bool destructure =false){thrownewNotImplementedException();}}}publicclassHelloJob:IJob{publicasyncTaskExecute(IJobExecutionContext context){await Console.Out.WriteLineAsync("Greetings from HelloJob!");}}}
usingSystem;usingSystem.Threading.Tasks;usingQuartz;usingQuartz.Impl;usingQuartz.Logging;namespaceConsoleApp1{publicclassProgram{privatestaticasyncTaskMain(string[] args){
LogProvider.SetCurrentLogProvider(newConsoleLogProvider());// Grab the Scheduler instance from the FactoryStdSchedulerFactory factory =newStdSchedulerFactory();IScheduler scheduler =await factory.GetScheduler();// and start it offawait scheduler.Start();// define the job and tie it to our HelloJob classIJobDetail job = JobBuilder.Create<HelloJob>().WithIdentity("job1","group1").Build();// Trigger the job to run now, and then repeat every 10 secondsITrigger trigger = TriggerBuilder.Create().WithIdentity("trigger1","group1").StartNow().WithSimpleSchedule(x => x
.WithIntervalInSeconds(10).RepeatForever()).Build();// 将trigger监听器注册到调度器
scheduler.ListenerManager.AddTriggerListener(newCustomTriggerListener());// Tell Quartz to schedule the job using our triggerawait scheduler.ScheduleJob(job, trigger);// some sleep to show what's happeningawait Task.Delay(TimeSpan.FromSeconds(60));// and last shut down the scheduler when you are ready to close your programawait scheduler.Shutdown();
Console.WriteLine("Press any key to close the application");
Console.ReadKey();}// simple log provider to get something to the consoleprivateclassConsoleLogProvider:ILogProvider{publicLoggerGetLogger(string name){return(level, func, exception, parameters)=>{if(level >= LogLevel.Info && func !=null){
Console.WriteLine("["+ DateTime.Now.ToLongTimeString()+"] ["+ level +"] "+func(), parameters);}returntrue;};}publicIDisposableOpenNestedContext(string message){thrownewNotImplementedException();}publicIDisposableOpenMappedContext(string key,objectvalue,bool destructure =false){thrownewNotImplementedException();}}}publicclassHelloJob:IJob{publicasyncTaskExecute(IJobExecutionContext context){//获取当前时间DateTime currentDateTime = DateTime.UtcNow;await Console.Out.WriteLineAsync("当前日期和时间:"+ currentDateTime.AddHours(8));}}}
一、单项选择题(本大题共15小题,每小题3分,共45分。在每小题给出的四个备选项中,选出一个正确的答案。 1.当运算结果的最高位为1时,标志位() A. CF1 B. OF1 C. SF1 D. ZF1 2、汇编语言源程序中,每个语句由四项组成,如语句要完成一定功能,那么该语句中不可…