|
|
Job Component |
StopJob method |
|
StopJob() |
Returns: None |
|
The StopJob method sets a flag in the job's control file signaling the job to stop execution immediately. Each job is designed to check the control file at regular intervals, if it detects the stop flag in the control file, the job makes every attempt to stop execution and end cleanly by closing all open connections and/or files.
Example:
[Visual Basic .NET]
|
Imports VisualIntegrationStudio.SharedDomain |
|
|
|
Public Class Form1 |
|
Inherits System.Windows.Forms.Form |
|
|
|
Private myExportBudgetJob As ExportBudget |
|
|
|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
|
myExportBudgetJob = New ExportBudget() |
|
myExportBudgetJob.JobPaths.JobStatusFileName = "ExportJobStatus.xml" |
|
|
|
AddHandler myExportBudgetJob.JobCompleted, AddressOf JobIsDone |
|
End Sub |
|
|
|
Private Sub btnRunJob_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunJob.Click |
|
myExportBudgetJob.RunJobThreaded() |
|
End Sub |
|
|
|
Private Sub btnStopJob_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStopJob.Click |
|
' ** The user clicked the Stop button! |
|
myExportBudgetJob.StopJob() |
|
End Sub |
|
|
|
Private Sub JobIsDone(ByVal obj As Object) |
|
|
|
If Not (obj Is Nothing) Then |
|
MsgBox("Job is done, Status: " + CType(obj, ExportBudget.ReturnStatusTypes).ToString) |
|
Else |
|
MsgBox("Job is done") |
|
End If |
|
|
|
End Sub |
|
|
|
End Class |
|
|
[C#]
|
using System; |
|
using System.Drawing; |
|
using System.Collections; |
|
using System.ComponentModel; |
|
using System.Windows.Forms; |
|
using System.Data; |
|
using VisualIntegrationStudio.SharedDomain; |
|
|
|
namespace MyApplicationCs |
|
{ |
|
public class Form1 : System.Windows.Forms.Form |
|
{ |
|
private System.Windows.Forms.Button btnRunJob; |
|
private System.ComponentModel.Container components = null; |
|
|
|
private ExportBudget myExportBudgetJob; |
|
|
|
public Form1() |
|
{ |
|
InitializeComponent(); |
|
} |
|
|
|
protected override void Dispose( bool disposing ) |
|
{ |
|
if( disposing ) |
|
{ |
|
if (components != null) |
|
{ |
|
components.Dispose(); |
|
} |
|
} |
|
base.Dispose( disposing ); |
|
} |
|
|
|
[STAThread] |
|
static void Main() |
|
{ |
|
Application.Run(new Form1()); |
|
} |
|
|
|
private void Form1_Load(object sender, System.EventArgs e) |
|
{ |
|
myExportBudgetJob = new ExportBudget(); |
|
myExportBudgetJob.JobPaths.JobStatusFileName = "ExportJobStatus.xml"; |
|
|
|
myExportBudgetJob.JobCompleted += new ExportBudget.JobCompletedEventHandler(JobIsDone); |
|
} |
|
|
|
private void btnRunJob_Click(object sender, System.EventArgs e) |
|
{ |
|
myExportBudgetJob.RunJobThreaded(); |
|
} |
|
|
|
private void btnRunJob_Click(object sender, System.EventArgs e) |
|
{ |
|
// ** The user clicked the Stop button! |
|
myExportBudgetJob.StopJob(); |
|
} |
|
|
|
private void JobIsDone(object obj, System.EventArgs e) |
|
{ |
|
MessageBox.Show("Job is done, Status: " + ((ExportBudget.ReturnStatusTypes)obj).ToString()); |
|
} |
|
|
|
} |
|
} |
|
|
© 2003 - 2007 Relational Solutions, Inc. - All rights reserved