Browse Source

clean up the code, add some exception handling

quartznet-1.0
Jay Vilalta 15 years ago
parent
commit
3812838bb5
6 changed files with 41 additions and 99 deletions
  1. +1
    -1
      ClickForensics.Quartz.Manager/AddJobForm.cs
  2. +1
    -2
      ClickForensics.Quartz.Manager/ClickForensics.Quartz.Manager.csproj
  3. +1
    -2
      ClickForensics.Quartz.Manager/JobAssemblies.txt
  4. +21
    -52
      ClickForensics.Quartz.Manager/MainForm.Designer.cs
  5. +4
    -36
      ClickForensics.Quartz.Manager/MainForm.cs
  6. +13
    -6
      ClickForensics.Quartz.Manager/QuartzScheduler.cs

+ 1
- 1
ClickForensics.Quartz.Manager/AddJobForm.cs View File

@@ -39,7 +39,7 @@ namespace ClickForensics.Quartz.Manager
Assembly assembly = Assembly.LoadFile(Environment.CurrentDirectory + "\\" + line); Assembly assembly = Assembly.LoadFile(Environment.CurrentDirectory + "\\" + line);
foreach (Type type in assembly.GetTypes()) foreach (Type type in assembly.GetTypes())
{ {
if (typeof(IJob).IsAssignableFrom(type))
if (typeof(IJob).IsAssignableFrom(type) && type.IsClass)
{ {
jobTypes.Add(type.FullName, assembly.GetName().Name); jobTypes.Add(type.FullName, assembly.GetName().Name);
} }


+ 1
- 2
ClickForensics.Quartz.Manager/ClickForensics.Quartz.Manager.csproj View File

@@ -54,8 +54,7 @@
<Reference Include="Common.Logging"> <Reference Include="Common.Logging">
<HintPath>..\lib\Common.Logging.dll</HintPath> <HintPath>..\lib\Common.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="Quartz, Version=1.0.3.3, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Quartz">
<HintPath>..\lib\Quartz.dll</HintPath> <HintPath>..\lib\Quartz.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />


+ 1
- 2
ClickForensics.Quartz.Manager/JobAssemblies.txt View File

@@ -1,2 +1 @@
ClickForensics.Quartz.Jobs.dll
Quartz.dll
Quartz.dll

+ 21
- 52
ClickForensics.Quartz.Manager/MainForm.Designer.cs View File

@@ -32,7 +32,6 @@
this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
this.schedulerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.schedulerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.connectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.connectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.configureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.jobsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.jobsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addJobToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addJobToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.listenersStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.listenersStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -40,8 +39,6 @@
this.addGlobalJobListenerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addGlobalJobListenerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addTriggerListenerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addTriggerListenerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addJobListenerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addJobListenerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.deleteThemAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.serverConnectStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.serverConnectStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.StripStatusLabel_Job_Groups = new System.Windows.Forms.ToolStripStatusLabel(); this.StripStatusLabel_Job_Groups = new System.Windows.Forms.ToolStripStatusLabel();
@@ -77,8 +74,7 @@
this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.schedulerToolStripMenuItem, this.schedulerToolStripMenuItem,
this.jobsToolStripMenuItem, this.jobsToolStripMenuItem,
this.listenersStripMenuItem,
this.toolStripMenuItem1});
this.listenersStripMenuItem});
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.mainMenuStrip.Name = "mainMenuStrip"; this.mainMenuStrip.Name = "mainMenuStrip";
this.mainMenuStrip.Size = new System.Drawing.Size(913, 24); this.mainMenuStrip.Size = new System.Drawing.Size(913, 24);
@@ -88,8 +84,7 @@
// schedulerToolStripMenuItem // schedulerToolStripMenuItem
// //
this.schedulerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.schedulerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.connectToolStripMenuItem,
this.configureToolStripMenuItem});
this.connectToolStripMenuItem});
this.schedulerToolStripMenuItem.Name = "schedulerToolStripMenuItem"; this.schedulerToolStripMenuItem.Name = "schedulerToolStripMenuItem";
this.schedulerToolStripMenuItem.Size = new System.Drawing.Size(71, 20); this.schedulerToolStripMenuItem.Size = new System.Drawing.Size(71, 20);
this.schedulerToolStripMenuItem.Text = "Scheduler"; this.schedulerToolStripMenuItem.Text = "Scheduler";
@@ -97,17 +92,10 @@
// connectToolStripMenuItem // connectToolStripMenuItem
// //
this.connectToolStripMenuItem.Name = "connectToolStripMenuItem"; this.connectToolStripMenuItem.Name = "connectToolStripMenuItem";
this.connectToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
this.connectToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.connectToolStripMenuItem.Text = "Connect"; this.connectToolStripMenuItem.Text = "Connect";
this.connectToolStripMenuItem.Click += new System.EventHandler(this.connectToolStripMenuItem_Click); this.connectToolStripMenuItem.Click += new System.EventHandler(this.connectToolStripMenuItem_Click);
// //
// configureToolStripMenuItem
//
this.configureToolStripMenuItem.Name = "configureToolStripMenuItem";
this.configureToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
this.configureToolStripMenuItem.Text = "Configure";
this.configureToolStripMenuItem.Click += new System.EventHandler(this.configureToolStripMenuItem_Click);
//
// jobsToolStripMenuItem // jobsToolStripMenuItem
// //
this.jobsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.jobsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -163,21 +151,6 @@
this.addJobListenerToolStripMenuItem.Text = "Add Job Listener"; this.addJobListenerToolStripMenuItem.Text = "Add Job Listener";
this.addJobListenerToolStripMenuItem.Click += new System.EventHandler(this.addJobListenerToolStripMenuItem_Click); this.addJobListenerToolStripMenuItem.Click += new System.EventHandler(this.addJobListenerToolStripMenuItem_Click);
// //
// toolStripMenuItem1
//
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.deleteThemAllToolStripMenuItem});
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(94, 20);
this.toolStripMenuItem1.Text = "Miscellaneous";
//
// deleteThemAllToolStripMenuItem
//
this.deleteThemAllToolStripMenuItem.Name = "deleteThemAllToolStripMenuItem";
this.deleteThemAllToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.deleteThemAllToolStripMenuItem.Text = "DeleteThemAll";
this.deleteThemAllToolStripMenuItem.Click += new System.EventHandler(this.deleteThemAllToolStripMenuItem_Click);
//
// statusStrip1 // statusStrip1
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -261,7 +234,7 @@
// btnDeleteJob // btnDeleteJob
// //
this.btnDeleteJob.Enabled = false; this.btnDeleteJob.Enabled = false;
this.btnDeleteJob.Location = new System.Drawing.Point(665, 309);
this.btnDeleteJob.Location = new System.Drawing.Point(533, 306);
this.btnDeleteJob.Name = "btnDeleteJob"; this.btnDeleteJob.Name = "btnDeleteJob";
this.btnDeleteJob.Size = new System.Drawing.Size(65, 23); this.btnDeleteJob.Size = new System.Drawing.Size(65, 23);
this.btnDeleteJob.TabIndex = 8; this.btnDeleteJob.TabIndex = 8;
@@ -272,7 +245,7 @@
// btnRunJobNow // btnRunJobNow
// //
this.btnRunJobNow.Enabled = false; this.btnRunJobNow.Enabled = false;
this.btnRunJobNow.Location = new System.Drawing.Point(523, 309);
this.btnRunJobNow.Location = new System.Drawing.Point(391, 306);
this.btnRunJobNow.Name = "btnRunJobNow"; this.btnRunJobNow.Name = "btnRunJobNow";
this.btnRunJobNow.Size = new System.Drawing.Size(65, 23); this.btnRunJobNow.Size = new System.Drawing.Size(65, 23);
this.btnRunJobNow.TabIndex = 9; this.btnRunJobNow.TabIndex = 9;
@@ -283,7 +256,7 @@
// btnPause // btnPause
// //
this.btnPause.Enabled = false; this.btnPause.Enabled = false;
this.btnPause.Location = new System.Drawing.Point(594, 309);
this.btnPause.Location = new System.Drawing.Point(462, 306);
this.btnPause.Name = "btnPause"; this.btnPause.Name = "btnPause";
this.btnPause.Size = new System.Drawing.Size(65, 23); this.btnPause.Size = new System.Drawing.Size(65, 23);
this.btnPause.TabIndex = 10; this.btnPause.TabIndex = 10;
@@ -294,7 +267,7 @@
// pnlDetails // pnlDetails
// //
this.pnlDetails.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pnlDetails.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlDetails.Location = new System.Drawing.Point(523, 48);
this.pnlDetails.Location = new System.Drawing.Point(391, 45);
this.pnlDetails.Name = "pnlDetails"; this.pnlDetails.Name = "pnlDetails";
this.pnlDetails.Size = new System.Drawing.Size(342, 252); this.pnlDetails.Size = new System.Drawing.Size(342, 252);
this.pnlDetails.TabIndex = 11; this.pnlDetails.TabIndex = 11;
@@ -302,7 +275,7 @@
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(520, 32);
this.label3.Location = new System.Drawing.Point(388, 29);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(39, 13); this.label3.Size = new System.Drawing.Size(39, 13);
this.label3.TabIndex = 12; this.label3.TabIndex = 12;
@@ -311,7 +284,7 @@
// btnEdit // btnEdit
// //
this.btnEdit.Enabled = false; this.btnEdit.Enabled = false;
this.btnEdit.Location = new System.Drawing.Point(736, 309);
this.btnEdit.Location = new System.Drawing.Point(604, 306);
this.btnEdit.Name = "btnEdit"; this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(65, 23); this.btnEdit.Size = new System.Drawing.Size(65, 23);
this.btnEdit.TabIndex = 13; this.btnEdit.TabIndex = 13;
@@ -344,14 +317,13 @@
this.listView_RunningJobs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.listView_RunningJobs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.JobName, this.JobName,
this.JobDuration}); this.JobDuration});
this.listView_RunningJobs.Location = new System.Drawing.Point(11, 335);
this.listView_RunningJobs.Location = new System.Drawing.Point(8, 335);
this.listView_RunningJobs.Name = "listView_RunningJobs"; this.listView_RunningJobs.Name = "listView_RunningJobs";
this.listView_RunningJobs.Size = new System.Drawing.Size(719, 268);
this.listView_RunningJobs.Size = new System.Drawing.Size(725, 268);
this.listView_RunningJobs.Sorting = System.Windows.Forms.SortOrder.Ascending; this.listView_RunningJobs.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listView_RunningJobs.TabIndex = 14; this.listView_RunningJobs.TabIndex = 14;
this.listView_RunningJobs.UseCompatibleStateImageBehavior = false; this.listView_RunningJobs.UseCompatibleStateImageBehavior = false;
this.listView_RunningJobs.View = System.Windows.Forms.View.Details; this.listView_RunningJobs.View = System.Windows.Forms.View.Details;
this.listView_RunningJobs.SelectedIndexChanged += new System.EventHandler(this.listView_RunningJobs_SelectedIndexChanged);
// //
// JobName // JobName
// //
@@ -364,7 +336,7 @@
// button1 // button1
// //
this.button1.Enabled = false; this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(665, 309);
this.button1.Location = new System.Drawing.Point(533, 306);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(65, 23); this.button1.Size = new System.Drawing.Size(65, 23);
this.button1.TabIndex = 8; this.button1.TabIndex = 8;
@@ -375,7 +347,7 @@
// button2 // button2
// //
this.button2.Enabled = false; this.button2.Enabled = false;
this.button2.Location = new System.Drawing.Point(523, 309);
this.button2.Location = new System.Drawing.Point(391, 306);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(65, 23); this.button2.Size = new System.Drawing.Size(65, 23);
this.button2.TabIndex = 9; this.button2.TabIndex = 9;
@@ -386,7 +358,7 @@
// button3 // button3
// //
this.button3.Enabled = false; this.button3.Enabled = false;
this.button3.Location = new System.Drawing.Point(594, 309);
this.button3.Location = new System.Drawing.Point(462, 306);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(65, 23); this.button3.Size = new System.Drawing.Size(65, 23);
this.button3.TabIndex = 10; this.button3.TabIndex = 10;
@@ -397,7 +369,7 @@
// button4 // button4
// //
this.button4.Enabled = false; this.button4.Enabled = false;
this.button4.Location = new System.Drawing.Point(736, 309);
this.button4.Location = new System.Drawing.Point(604, 306);
this.button4.Name = "button4"; this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(65, 23); this.button4.Size = new System.Drawing.Size(65, 23);
this.button4.TabIndex = 13; this.button4.TabIndex = 13;
@@ -410,24 +382,24 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(913, 661); this.ClientSize = new System.Drawing.Size(913, 661);
this.Controls.Add(this.btnRefreshJobGroups);
this.Controls.Add(this.listView_RunningJobs); this.Controls.Add(this.listView_RunningJobs);
this.Controls.Add(this.pnlDetails); this.Controls.Add(this.pnlDetails);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.btnRefreshJobGroups);
this.Controls.Add(this.label1);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.btnEdit); this.Controls.Add(this.btnEdit);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnRefreshRunningJobs);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.btnPause); this.Controls.Add(this.btnPause);
this.Controls.Add(this.btnRefreshRunningJobs);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.button2);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.btnRunJobNow);
this.Controls.Add(this.button2);
this.Controls.Add(this.mainMenuStrip); this.Controls.Add(this.mainMenuStrip);
this.Controls.Add(this.btnRunJobNow);
this.Controls.Add(this.jobGroupsTreeView);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.btnDeleteJob); this.Controls.Add(this.btnDeleteJob);
this.Controls.Add(this.jobGroupsTreeView);
this.MainMenuStrip = this.mainMenuStrip; this.MainMenuStrip = this.mainMenuStrip;
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "Quartz Manager"; this.Text = "Quartz Manager";
@@ -463,12 +435,9 @@
private System.Windows.Forms.Button btnDeleteJob; private System.Windows.Forms.Button btnDeleteJob;
private System.Windows.Forms.Button btnRunJobNow; private System.Windows.Forms.Button btnRunJobNow;
private System.Windows.Forms.Button btnPause; private System.Windows.Forms.Button btnPause;
private System.Windows.Forms.ToolStripMenuItem configureToolStripMenuItem;
private System.Windows.Forms.Panel pnlDetails; private System.Windows.Forms.Panel pnlDetails;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnEdit; private System.Windows.Forms.Button btnEdit;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem deleteThemAllToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip ctxScheduler; private System.Windows.Forms.ContextMenuStrip ctxScheduler;
private System.Windows.Forms.ToolStripMenuItem backupToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem backupToolStripMenuItem;
private System.Windows.Forms.Timer timer_Refresh_Running_Jobs; private System.Windows.Forms.Timer timer_Refresh_Running_Jobs;


+ 4
- 36
ClickForensics.Quartz.Manager/MainForm.cs View File

@@ -144,7 +144,7 @@ namespace ClickForensics.Quartz.Manager
jobGroupsTreeView.Nodes[0].Expand(); jobGroupsTreeView.Nodes[0].Expand();
jobGroupsNode.Expand(); jobGroupsNode.Expand();


StripStatusLabel_Job_Groups.Text = System.DateTime.Now.ToString("yyyy.MM.dd HH:mm.ss");
StripStatusLabel_Job_Groups.Text = DateTime.Now.ToString("yyyy.MM.dd HH:mm.ss");


} }
finally finally
@@ -155,7 +155,7 @@ namespace ClickForensics.Quartz.Manager


} }


private void jobDetailsToggle(System.Boolean isVisible)
private void jobDetailsToggle(bool isVisible)
{ {
if (isVisible == false) if (isVisible == false)
{ {
@@ -241,10 +241,10 @@ namespace ClickForensics.Quartz.Manager
foreach (DataRow row in table.Rows) foreach (DataRow row in table.Rows)
{ {
//JobName JobDuration //JobName JobDuration
ListViewItem item = new ListViewItem(new string[] { System.Convert.ToString(row["JobName"]), System.Convert.ToString(row["Runtime"]) });
ListViewItem item = new ListViewItem(new string[] { Convert.ToString(row["JobName"]), Convert.ToString(row["Runtime"]) });
listView_RunningJobs.Items.Add(item); listView_RunningJobs.Items.Add(item);
} }
StripStatusLabel_Jobs_Refresh_date.Text = System.DateTime.Now.ToString("yyyy.MM.dd HH:mm.ss");
StripStatusLabel_Jobs_Refresh_date.Text = DateTime.Now.ToString("yyyy.MM.dd HH:mm.ss");




//reset the timer ( documentation not clear if .stop = restart @ 0 in timing, but changing the interval sure should do that. ) //reset the timer ( documentation not clear if .stop = restart @ 0 in timing, but changing the interval sure should do that. )
@@ -351,16 +351,6 @@ namespace ClickForensics.Quartz.Manager
setPauseButtonText(); setPauseButtonText();
} }


private void assembliesToolStripMenuItem_Click(object sender, EventArgs e)
{

}

private void configureToolStripMenuItem_Click(object sender, EventArgs e)
{

}

private void btnEdit_Click(object sender, EventArgs e) private void btnEdit_Click(object sender, EventArgs e)
{ {
TriggerNode node = (TriggerNode)jobGroupsTreeView.SelectedNode; TriggerNode node = (TriggerNode)jobGroupsTreeView.SelectedNode;
@@ -373,18 +363,6 @@ namespace ClickForensics.Quartz.Manager
} }
} }


private void deleteThemAllToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (var job in Scheduler.GetScheduler().GetJobNames("Cube"))
{
if (job.Contains("CreateCubeFor"))
{

Scheduler.GetScheduler().DeleteJob(job, "Cube");
}
}
}

private void backupToolStripMenuItem_Click(object sender, EventArgs e) private void backupToolStripMenuItem_Click(object sender, EventArgs e)
{ {
QuartzScheduler scheduler = ((SchedulerNode)((TreeView)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl).SelectedNode).Scheduler; QuartzScheduler scheduler = ((SchedulerNode)((TreeView)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl).SelectedNode).Scheduler;
@@ -398,15 +376,5 @@ namespace ClickForensics.Quartz.Manager
{ {
updateRunningJobs(); updateRunningJobs();
} }

private void runningJobsListView_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void listView_RunningJobs_SelectedIndexChanged(object sender, EventArgs e)
{

}
} }
} }

+ 13
- 6
ClickForensics.Quartz.Manager/QuartzScheduler.cs View File

@@ -123,13 +123,20 @@ namespace ClickForensics.Quartz.Manager
DataTable table = new DataTable(); DataTable table = new DataTable();
table.Columns.Add("JobName", typeof(string)); table.Columns.Add("JobName", typeof(string));
table.Columns.Add("RunTime", typeof(int)); table.Columns.Add("RunTime", typeof(int));
IList jobs = GetScheduler().GetCurrentlyExecutingJobs();
foreach (JobExecutionContext context in jobs)
try
{
IList jobs = GetScheduler().GetCurrentlyExecutingJobs();
foreach (JobExecutionContext context in jobs)
{
DataRow row = table.NewRow();
row["JobName"] = context.JobDetail.Name;
row["RunTime"] = (DateTime.Now.ToUniversalTime() - (DateTime)context.FireTimeUtc).TotalMinutes;
table.Rows.Add(row);
}
}
catch (Exception ex)
{ {
DataRow row = table.NewRow();
row["JobName"] = context.JobDetail.Name;
row["RunTime"] = (DateTime.Now.ToUniversalTime() - (DateTime)context.FireTimeUtc).TotalMinutes;
table.Rows.Add(row);
//TODO: Let the user know we couldn't load the running jobs.
} }


return table; return table;


Loading…
Cancel
Save