Esempio n. 1
0
        private void btnRunJobNow_Click(object sender, EventArgs e)
        {
            JobNode         node      = (JobNode)jobGroupsTreeView.SelectedNode;
            QuartzScheduler scheduler = getScheduler(node);

            scheduler.GetScheduler().TriggerJob(node.Detail.Key);
        }
Esempio n. 2
0
        private void addJobNodes(TreeNode node)
        {
            string group        = node.Parent.Text;
            var    groupMatcher = GroupMatcher <JobKey> .GroupContains(group);

            QuartzScheduler scheduler = getScheduler(node);
            var             jobKeys   = scheduler.GetScheduler().GetJobKeys(groupMatcher);

            foreach (var jobKey in jobKeys)
            {
                try
                {
                    IJobDetail detail  = scheduler.GetScheduler().GetJobDetail(jobKey);
                    JobNode    jobNode = new JobNode(detail);
                    node.Nodes.Add(jobNode);
                    addTriggerNodes(jobNode);
                }
                catch (Exception ex)
                {
                    node.Nodes.Add(string.Format("Unknown Job Type ({0})", jobKey.Name));
                    //TODO: Do something useful with this exception. Most likely cause is the client does not have a copy of a given dll and can't load the type.
                    _Log.Error("Error loading jobs.", ex);
                }
            }
        }
Esempio n. 3
0
        private void btnDeleteJob_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = jobGroupsTreeView.SelectedNode;

            if (selectedNode is JobNode)
            {
                JobNode         node      = (JobNode)jobGroupsTreeView.SelectedNode;
                QuartzScheduler scheduler = getScheduler(selectedNode);
                scheduler.GetScheduler().DeleteJob(node.Detail.Key);
                jobGroupsTreeView.SelectedNode.Remove();
            }
            if (selectedNode is TriggerNode)
            {
                QuartzScheduler scheduler = getScheduler(selectedNode);
                scheduler.GetScheduler().UnscheduleJob(((TriggerNode)selectedNode).Trigger.Key);
            }
        }
Esempio n. 4
0
 private void addJobNodes(TreeNode node)
 {
     string group = node.Parent.Text;
     var groupMatcher = GroupMatcher<JobKey>.GroupContains(group);
     QuartzScheduler scheduler = getScheduler(node);
     var jobKeys = scheduler.GetScheduler().GetJobKeys(groupMatcher);
     foreach (var jobKey in jobKeys)
     {
         try
         {
             IJobDetail detail = scheduler.GetScheduler().GetJobDetail(jobKey);
             JobNode jobNode = new JobNode(detail);
             node.Nodes.Add(jobNode);
             addTriggerNodes(jobNode);
         }
         catch (Exception ex)
         {
             node.Nodes.Add(string.Format("Unknown Job Type ({0})", jobKey.Name));
             //TODO: Do something useful with this exception. Most likely cause is the client does not have a copy of a given dll and can't load the type.
             _Log.Error("Error loading jobs.", ex);
         }
     }
 }