forked from quickfix/quickfix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationImpl.cs
More file actions
78 lines (66 loc) · 1.4 KB
/
Copy pathApplicationImpl.cs
File metadata and controls
78 lines (66 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
74
75
76
77
78
using System;
using System.Threading;
using QuickFix;
public class ApplicationImpl : Application
{
private bool loggedOn = false;
private bool created = false;
private bool stopRunning = false;
private Message message = null;
public void onCreate(SessionID sessionId)
{
created = true;
}
public void onLogon(SessionID sessionId)
{
loggedOn = true;
}
public void onLogout(SessionID sessionId)
{
loggedOn = false;
}
public void toAdmin(Message message, SessionID sessionId) {}
public void toApp(Message message, SessionID sessionId) {}
public void fromAdmin(Message message, SessionID sessionId) {}
public void fromApp(Message message, SessionID sessionId)
{
this.message = message;
}
public void run()
{
while(true)
{
try
{
if(stopRunning) return;
Thread.Sleep(1000);
}
catch(Exception) {}
}
}
public void stop() { stopRunning = true; }
public bool isLoggedOn()
{
return loggedOn;
}
public bool isCreated()
{
return created;
}
public Message getMessage()
{
try
{
for(int i = 0; i < 50; ++i)
{
if(message != null)
{
return message;
}
Thread.Sleep(100);
}
}
catch(Exception) {}
return message;
}
}