Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs @ 733

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 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Timers;
6
7namespace 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.