SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 61 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

timer.Tick += new EventHandler(timer_Tick);
1 The Controller class does use the .NET Timer class from System.Windows.Forms.
Overview 35
namespace ReactiveImpl
{
using System;
public enum ControlEvent { Timeout, Message, Command, Exit }
public enum WaitFor { Timeout, Message }
public enum Sensor { OK, Error }
public class Controller
{
public const int MessageTimeout = 3000; // msec, plenty of time
public const int PollingInterval = 3000; // msec
ControlEvent cevent;
WaitFor waitfor = WaitFor.Timeout; // enable Reset
Sensor sensor = Sensor.Error; // enable Reset
string buffer;
double previous = Double.MaxValue; // missing value flag
public System.Windows.Forms.Timer timer =
new System.Windows.Forms.Timer();
public void ReceiveEvent(ControlEvent cevent, string buffer)
{
bool msgevent = (cevent == ControlEvent.Message);
Console.WriteLine("?{0}{1}, {2}, {3}",
cevent, msgevent ? " ??™"+buffer+"??™" : "",
waitfor, sensor);
this.cevent = cevent;
if (msgevent) this.buffer = buffer; // else ignore buffer arg.
}
public void DispatchHandler()
{
if (ResetEnabled()) Reset();
else if (PollEnabled()) Poll();
else if (CheckMessageEnabled()) CheckMessage();
else if (ReportLostMessageEnabled()) ReportLostMessage();
else if (CalibrateEnabled()) Calibrate();
}
// to be continued ...
Figure 3.2. Process controller class with dispatcher and handlers (1).


Pages:
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6