public void m_ComMgr_OnHealthUpdate(enumServerIndex index, enumConnectionState state) { NameThread("MBTradingSDK"); switch (index) { case enumServerIndex.siPerms: permsHealth = state; lastChangePerms = Environment.TickCount; break; case enumServerIndex.siOrders: ordersHealth = state; lastChangeOrders = Environment.TickCount; break; case enumServerIndex.siQuotes: quotesHealth = state; lastChangeQuotes = Environment.TickCount; break; default: log.Error("Health Update: ERROR: Unknown: " + index.ToString() + ":" + state.ToString()); break; } log.Debug("Health Update: " + index.ToString() + ":" + state.ToString()); }
public void Start(Receiver receiver) { log.Info("MBTInterface Startup"); this.receiver = (Receiver)receiver; Initialize(); string appDataFolder = Factory.Settings["AppDataFolder"]; if (appDataFolder == null) { throw new ApplicationException("Sorry, AppDataFolder must be set in the app.config file."); } string configFile = appDataFolder + @"/Providers/MBTradingService.config"; LoadProperties(configFile); string liveOrDemo = GetProperty("LiveOrDemo"); liveOrDemo = UpperFirst(liveOrDemo.ToLower()); log.Info("Found live or demo selection = " + liveOrDemo); string equityOrForex = GetProperty("EquityOrForex"); equityOrForex = UpperFirst(equityOrForex.ToLower()); log.Info("Found equity or forex selection = " + equityOrForex); string prefix = equityOrForex + liveOrDemo; string memberIdStr = GetProperty("ClientId"); int _memberId = Convert.ToInt32(memberIdStr); string _username = GetProperty(prefix + "UserName"); string _password = GetProperty(prefix + "Password"); memberId = _memberId; username = _username; password = _password; closePending = false; monitorThread = new Thread(new ThreadStart(MonitorThread)); monitorThread.IsBackground = true; monitorThread.Priority = ThreadPriority.AboveNormal; monitorThread.Name = "MBTMonitor"; monitorThread.Start(); // Wait for connection. while (permsHealth != enumConnectionState.csLoggedIn) { Application.DoEvents(); Thread.Sleep(5); permsHealth = m_ComMgr.get_CurrentHealth(enumServerIndex.siPerms); } }
void m_ComMgr_OnHealthUpdate(enumServerIndex index, enumConnectionState state) { debug(String.Format("m_ComMgr_OnHealthUpdate: {0} {1}", index, state)); }