Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于调度器停止某个作业的实例 #12

Open
zhuovi opened this issue May 18, 2023 · 0 comments
Open

关于调度器停止某个作业的实例 #12

zhuovi opened this issue May 18, 2023 · 0 comments

Comments

@zhuovi
Copy link
Owner

zhuovi commented May 18, 2023

var list1 = new List<IJob>();
var list2 = new List<Guid>();
var list3 = new List<string>();
var job1 = new Job()
{
    Name="job1",
     TimerType= TimerType.Interval,
      Period=30*60*1000,
    SuccessCallBack = j =>
    {
        Console.WriteLine("执行");
    }
};
list1.Add(job1);
list2.Add(job1.ID);
list3.Add(job1.Name);

job1.Start();

/*
 * 第一种方法 通过job自己停止
 */
job1.Stop();
/*
 * 第二种方法 通过 作业ID或Name停止
 */
JobScheduler.Default.Remove(job1.ID);
JobScheduler.Default.Remove(job1.Name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant