Last change
on this file since 733 was
733,
checked in by kgrading, 15 years ago
|
implemented a basic first version of the Timer (#346)
|
File size:
860 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Timers;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Hive.Client.Core {
|
---|
8 | public class Heartbeat {
|
---|
9 | public double Interval { get; set; }
|
---|
10 |
|
---|
11 | private Timer heartbeatTimer = null;
|
---|
12 |
|
---|
13 | public Heartbeat() {
|
---|
14 | Interval = 100;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public Heartbeat(double interval) {
|
---|
18 | Interval = interval;
|
---|
19 | }
|
---|
20 |
|
---|
21 | public void StartHeartbeat() {
|
---|
22 | heartbeatTimer = new System.Timers.Timer();
|
---|
23 | heartbeatTimer.Interval = this.Interval;
|
---|
24 | heartbeatTimer.AutoReset = true;
|
---|
25 | heartbeatTimer.Elapsed += new ElapsedEventHandler(heartbeatTimer_Elapsed);
|
---|
26 | heartbeatTimer.Start();
|
---|
27 | }
|
---|
28 |
|
---|
29 | void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) {
|
---|
30 | Console.WriteLine("tick");
|
---|
31 | }
|
---|
32 |
|
---|
33 | }
|
---|
34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.