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

Last change on this file since 1374 was 1374, checked in by Paul Lelgemann, 12 years ago

+ Added P2P connection to CrypP2P based on PeerToPeerBase plugin (using default settings)
+ Added MD5Collider to CoreDeveloper solution

File size: 1.5 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;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using System.ComponentModel;
22
23namespace Cryptool.P2P.Worker
24{
25
26    abstract class WorkerBase
27    {
28        protected BackgroundWorker backgroundWorker;
29
30        public WorkerBase()
31        {
32            backgroundWorker = new BackgroundWorker();
33            backgroundWorker.DoWork += new DoWorkEventHandler(PerformWork);
34            backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkComplete);
35        }
36
37        public void Start()
38        {
39            PrePerformWork();
40            backgroundWorker.RunWorkerAsync();
41        }
42
43        protected abstract void WorkComplete(object sender, RunWorkerCompletedEventArgs e);
44
45        protected abstract void PerformWork(object sender, DoWorkEventArgs e);
46
47        protected abstract void PrePerformWork();
48    }
49}
Note: See TracBrowser for help on using the repository browser.