public LeanEngineWinFormPresenter(ILeanEngineWinFormView view, LeanEngineWinFormModel model, EventMessagingHandler messageHandler) { _view = view; _model = model; view.ExitApplication += ExitApplication; view.TickerTick += TimerOnTick; view.ConsoleOnKeyUp += ConsoleOnKeyUp; messageHandler.DebugEvent += HandleDebugPacket; messageHandler.LogEvent += HandleLogPacket; messageHandler.RuntimeErrorEvent += HandleRuntimeErrorPacket; messageHandler.HandledErrorEvent += HandleHandledErrorPacket; messageHandler.BacktestResultEvent += HandleBacktestResultPacket; }
//private GeckoWebBrowser _geckoBrowser; /// <summary> /// Create the UX. /// </summary> /// <param name="notificationHandler">Messaging system</param> /// <param name="job">Job to use for URL generation</param> public LeanWinForm(IMessagingHandler notificationHandler, AlgorithmNodePacket job) { InitializeComponent(); //Form Setup: CenterToScreen(); WindowState = FormWindowState.Maximized; Text = "QuantConnect Lean Algorithmic Trading Engine: v" + Globals.Version; //Save off the messaging event handler we need: _job = job; _liveMode = job is LiveNodePacket; _messaging = (EventMessagingHandler)notificationHandler; var url = GetUrl(job, _liveMode); //GECKO WEB BROWSER: Create the browser control // https://www.nuget.org/packages/GeckoFX/ // -> If you don't have IE. //_geckoBrowser = new GeckoWebBrowser { Dock = DockStyle.Fill, Name = "browser" }; //_geckoBrowser.DOMContentLoaded += BrowserOnDomContentLoaded; //_geckoBrowser.Navigate(url); //splitPanel.Panel1.Controls.Add(_geckoBrowser); // MONO WEB BROWSER: Create the browser control // Default shipped with VS and Mono. Works OK in Windows, and compiles in linux. _monoBrowser = new WebBrowser() {Dock = DockStyle.Fill, Name = "Browser"}; _monoBrowser.DocumentCompleted += MonoBrowserOnDocumentCompleted; _monoBrowser.Navigate(url); splitPanel.Panel1.Controls.Add(_monoBrowser); //Setup Event Handlers: _messaging.DebugEvent += MessagingOnDebugEvent; _messaging.LogEvent += MessagingOnLogEvent; _messaging.RuntimeErrorEvent += MessagingOnRuntimeErrorEvent; _messaging.HandledErrorEvent += MessagingOnHandledErrorEvent; _messaging.BacktestResultEvent += MessagingOnBacktestResultEvent; _logging = Log.LogHandler as QueueLogHandler; //Show warnings if the API token and UID aren't set. if (_job.UserId == 0) { MessageBox.Show("Your user id is not set. Please check your config.json file 'job-user-id' property.", "LEAN Algorithmic Trading", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (_job.Channel == "") { MessageBox.Show("Your API token is not set. Please check your config.json file 'api-access-token' property.", "LEAN Algorithmic Trading", MessageBoxButtons.OK, MessageBoxIcon.Error); } }