I get an error in this line saying:
Cannot implicitly convert type 'System.Threading.Tasks.Task' to 'Quartz.IScheduler'. An explicit conversion exists (are you missing a cast?)
How to solve it; I don't understand? Please help!
IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
public static void Start()
{
try
{
//Construct scheduler factory
//IScheduler scheduler = schedulerFactory.GetScheduler();
// IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
scheduler.Start();
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("jobName", "jobGroup")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithSimpleSchedule(s => s.WithIntervalInSeconds(60).RepeatForever())
.StartNow()
.Build();
scheduler.ScheduleJob(job, trigger);
// scheduler.Start();
}
catch (SchedulerException se)
{
//Console.WriteLine(se);
}
}
}
public class HelloJob : IJob
{
private TBPESContext db = new TBPESContext();
public void Execute(IJobExecutionContext context)
{
var AuthorName = from twitterAccount in db.Twitter_Account
from c in twitterAccount.Courses
select twitterAccount.Author_Name;
foreach (var item in AuthorName)
{
TweetCrawler.SaveTweets(item);
}
throw new NotImplementedException();
}
}