source: trunk/CrypP2P/Worker/WorkerBase.cs @ 1477

Last change on this file since 1477 was 1477, checked in by Paul Lelgemann, 11 years ago

+ Added early version of P2P editor interface

override-bad-extension: CrypWin.exe
override-bad-extension: P2PEditor.dll

File size: 1.4 KB
Line 
1/*
2   Copyright 2010 Paul Lelgemann, University of Duisburg-Essen
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System.ComponentModel;
18
19namespace Cryptool.P2P.Worker
20{
21    public abstract class WorkerBase
22    {
23        public readonly BackgroundWorker BackgroundWorker;
24
25        protected WorkerBase()
26        {
27            BackgroundWorker = new BackgroundWorker();
28            BackgroundWorker.DoWork += PerformWork;
29            BackgroundWorker.RunWorkerCompleted += WorkComplete;
30        }
31
32        public void Start()
33        {
34            PrePerformWork();
35            BackgroundWorker.RunWorkerAsync();
36        }
37
38        protected abstract void WorkComplete(object sender, RunWorkerCompletedEventArgs e);
39
40        protected abstract void PerformWork(object sender, DoWorkEventArgs e);
41
42        protected abstract void PrePerformWork();
43    }
44}
Note: See TracBrowser for help on using the repository browser.