本文整理汇总了C#中IScheduler.GetTriggerState方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.GetTriggerState方法的具体用法?C# IScheduler.GetTriggerState怎么用?C# IScheduler.GetTriggerState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScheduler
的用法示例。
在下文中一共展示了IScheduler.GetTriggerState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllJobs
private static void GetAllJobs(IScheduler scheduler)
{
IList<string> jobGroups = scheduler.GetJobGroupNames();
IList<string> triggerGroups = scheduler.GetTriggerGroupNames();
foreach (string group in jobGroups)
{
var groupMatcher = GroupMatcher<JobKey>.GroupContains(group);
var jobKeys = scheduler.GetJobKeys(groupMatcher);
foreach (var jobKey in jobKeys)
{
var detail = scheduler.GetJobDetail(jobKey);
var triggers = scheduler.GetTriggersOfJob(jobKey);
foreach (ITrigger trigger in triggers)
{
Console.WriteLine(group);
Console.WriteLine(jobKey.Name);
Console.WriteLine(detail.Description);
Console.WriteLine(trigger.Key.Name);
Console.WriteLine(trigger.Key.Group);
Console.WriteLine(trigger.GetType().Name);
Console.WriteLine(scheduler.GetTriggerState(trigger.Key));
DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
if (nextFireTime.HasValue)
{
Console.WriteLine(nextFireTime.Value.LocalDateTime.ToString());
}
DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
if (previousFireTime.HasValue)
{
Console.WriteLine(previousFireTime.Value.LocalDateTime.ToString());
}
}
}
}
}
示例2: GetAllJobs
private JobGroups GetAllJobs(IScheduler scheduler)
{
int countJobs = 0;
IList<string> jobGroups = scheduler.GetJobGroupNames();
IList<string> triggerGroups = scheduler.GetTriggerGroupNames();
List<JobGroup> entidadeJobGroup = new List<JobGroup>();
foreach (string group in jobGroups)
{
var groupMatcher = GroupMatcher<JobKey>.GroupContains(group);
JobGroup grupoItem = new JobGroup();
grupoItem.Name = group;
grupoItem.Jobs = new List<JobDetails>();
var jobKeys = scheduler.GetJobKeys(groupMatcher);
foreach (var jobKey in jobKeys)
{
countJobs++;
var detail = scheduler.GetJobDetail(jobKey);
var triggers = scheduler.GetTriggersOfJob(jobKey);
foreach (ITrigger trigger in triggers)
{
DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
DateTimeOffset? startFireTime = trigger.StartTimeUtc;
DateTimeOffset? lastFireTime = trigger.FinalFireTimeUtc;
//
grupoItem.Jobs.Add(new JobDetails()
{
Grupo = group,
FirstFire = (startFireTime.HasValue) ? startFireTime.Value.LocalDateTime.ToString() : "",
LastFire = (lastFireTime.HasValue) ? lastFireTime.Value.LocalDateTime.ToString() : "",
Type = trigger.GetType().Name,
NomeLegivel = service.GetWorkflowSistemaName(jobKey.Name),
Name = jobKey.Name,
Description = detail.Description,
NextFire = (nextFireTime.HasValue) ? nextFireTime.Value.LocalDateTime.ToString() : "",
PreviousFire = (previousFireTime.HasValue) ? previousFireTime.Value.LocalDateTime.ToString() : "",
State = scheduler.GetTriggerState(trigger.Key).ToString(),
TriggerId = trigger.Key.Name
});
}
}
entidadeJobGroup.Add(grupoItem);
}
JobGroups entidadeRetorno = new JobGroups();
entidadeRetorno.Grupos = new List<JobGroup>();
entidadeRetorno.Grupos = entidadeJobGroup;
entidadeRetorno.TotalJobs = countJobs;
return entidadeRetorno;
}
示例3: GetTriggerStatus
private static ActivityStatus GetTriggerStatus(string triggerName, string triggerGroup, IScheduler scheduler)
{
var state = scheduler.GetTriggerState(new TriggerKey(triggerName, triggerGroup));
switch (state)
{
case TriggerState.Paused:
return ActivityStatus.Paused;
case TriggerState.Complete:
return ActivityStatus.Complete;
default:
return ActivityStatus.Active;
}
}
示例4: GetTriggerStatus
private static ActivityStatus GetTriggerStatus(TriggerKey triggerKey, IScheduler scheduler)
{
var state = scheduler.GetTriggerState(triggerKey);
switch (state)
{
case TriggerState.Paused:
return ActivityStatus.Paused;
case TriggerState.Complete:
return ActivityStatus.Complete;
default:
return ActivityStatus.Active;
}
}
示例5: GetSchedules
public List<JobSchedule> GetSchedules(IScheduler qScheduler, string groupName)
{
var jcs = new List<JobSchedule>();
var groupMatcher = GroupMatcher<JobKey>.GroupContains(groupName);
var jobKeys = qScheduler.GetJobKeys(groupMatcher);
foreach (var jobKey in jobKeys)
{
var triggers = qScheduler.GetTriggersOfJob(jobKey);
foreach (var trigger in triggers)
{
var js = new JobSchedule();
js.Name = jobKey.Name;
js.Description = trigger.Description;
js.Group = jobKey.Group;
js.TriggerType = trigger.GetType().Name;
js.TriggerState = qScheduler.GetTriggerState(trigger.Key).ToString();
js.Priority = trigger.Priority;
DateTimeOffset? startTime = trigger.StartTimeUtc;
js.StartTime = TimeZone.CurrentTimeZone.ToLocalTime(startTime.Value.DateTime);
DateTimeOffset? nextFireTime = trigger.GetNextFireTimeUtc();
if (nextFireTime.HasValue)
{
js.NextFire = TimeZone.CurrentTimeZone.ToLocalTime(nextFireTime.Value.DateTime);
}
DateTimeOffset? previousFireTime = trigger.GetPreviousFireTimeUtc();
if (previousFireTime.HasValue)
{
js.LastFire = TimeZone.CurrentTimeZone.ToLocalTime(previousFireTime.Value.DateTime);
}
jcs.Add(js);
}
}
return jcs;
}
示例6: CreateTriggerInfo
private List<JobTriggerViewModel> CreateTriggerInfo(IEnumerable<ITrigger> triggersOfJob, IScheduler scheduler)
{
return triggersOfJob.Select(q => new JobTriggerViewModel
{
Status = scheduler.GetTriggerState(q.Key).ToString()
}).ToList();
}