Rev | Line | |
---|
[742] | 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 {
|
---|
[749] | 8 |
|
---|
| 9 | public delegate void Callback();
|
---|
| 10 |
|
---|
[742] | 11 | abstract public class JobBase {
|
---|
| 12 |
|
---|
[749] | 13 | public event Callback JobAborted;
|
---|
| 14 |
|
---|
[742] | 15 | private Thread thread = null;
|
---|
[749] | 16 |
|
---|
[742] | 17 | public int Progress { get; set; }
|
---|
[749] | 18 | private bool abort = false;
|
---|
| 19 | private bool running = false;
|
---|
[742] | 20 |
|
---|
| 21 | abstract public void Run();
|
---|
| 22 |
|
---|
| 23 | public void Start() {
|
---|
| 24 | thread = new Thread(new ThreadStart(Run));
|
---|
| 25 | thread.Start();
|
---|
[749] | 26 | running = true;
|
---|
[742] | 27 | }
|
---|
[749] | 28 |
|
---|
| 29 | public void Stop() {
|
---|
| 30 | abort = true;
|
---|
[742] | 31 | }
|
---|
[749] | 32 |
|
---|
| 33 | public JobBase() {
|
---|
| 34 | }
|
---|
[742] | 35 | }
|
---|
| 36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.