forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
36 lines (29 loc) · 926 Bytes
/
Program.cs
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
using System;
using System.Threading;
using System.Windows.Forms;
using QuantConnect.Views.WinForms;
namespace QuantConnect.Views
{
public class Program
{
[STAThread]
static void Main(string[] args)
{
if (args.Length != 1)
{
throw new Exception(
"Error: You must specify the port on which the application will open a TCP socket.");
}
var port = args[0];
var form = new LeanWinForm();
var desktopClient = new DesktopClient();
var thread = new Thread(() => desktopClient.Run(port, form));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
Application.Run(form);
// The above code is blocking.
// Once it finishes, close the NetMQ client
desktopClient.StopServer();
}
}
}