Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Hive.Client.Common {
|
---|
8 |
|
---|
9 | public delegate void Callback();
|
---|
10 |
|
---|
11 | abstract public class JobBase {
|
---|
12 |
|
---|
13 | public event Callback JobAborted;
|
---|
14 |
|
---|
15 | private Thread thread = null;
|
---|
16 |
|
---|
17 | public int Progress { get; set; }
|
---|
18 | private bool abort = false;
|
---|
19 | private bool running = false;
|
---|
20 |
|
---|
21 | abstract public void Run();
|
---|
22 |
|
---|
23 | public void Start() {
|
---|
24 | thread = new Thread(new ThreadStart(Run));
|
---|
25 | thread.Start();
|
---|
26 | running = true;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public void Stop() {
|
---|
30 | abort = true;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public JobBase() {
|
---|
34 | }
|
---|
35 | }
|
---|
36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.