}//Service_ServiceStateChanged() /// <summary> /// When the market tt api is connected, request the exchanges. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void MarketHub_MarketStatusChanged(object sender, EventArgs eventArgs) { MarketStatusChangedEventArg marketStatusChangedEventArg = (MarketStatusChangedEventArg)eventArgs; if (this.InvokeRequired) { EventHandler <MarketStatusChangedEventArg> marketStatusDelegate = new EventHandler <MarketStatusChangedEventArg>(MarketHub_MarketStatusChanged); this.Invoke(marketStatusDelegate, new object[] { sender, marketStatusChangedEventArg }); } else { // Add the TT market to the list. It returns multiple markets at multiple times. List <string> ttMarketNameList = marketStatusChangedEventArg.MarketNameList; if (ttMarketNameList != null && ttMarketNameList.Count > 0) { foreach (string ttMarketName in ttMarketNameList) { if (!m_MarketList.Contains(ttMarketName)) { m_MarketList.Add(ttMarketName); } } } // Update the GUI. This is required by invoke function. listBoxMarkets.BeginUpdate(); listBoxMarkets.Items.Clear(); foreach (string market in m_MarketList) { listBoxMarkets.Items.Add(market); } listBoxMarkets.EndUpdate(); } }//MarketHub_MarketStatusChanged()
// /// <summary> /// Call-back from MarketHub every time the status of a market changes. /// All Markets will be returned in this call. /// </summary> /// <param name="sender"></param> /// <param name="eArg"></param> private void Market_MarketStatusChanged(object sender, EventArgs eArg) { MarketStatusChangedEventArg eventArg = (MarketStatusChangedEventArg)eArg; if (this.InvokeRequired) { EventHandler <MarketStatusChangedEventArg> d = new EventHandler <MarketStatusChangedEventArg>(Market_MarketStatusChanged); this.Invoke(d, new object[] { sender, eventArg }); } else { if (eventArg.MarketNameList.Count > 0) { listBoxMarkets.BeginUpdate(); listBoxMarkets.Items.Clear(); foreach (string marketName in eventArg.MarketNameList) { listBoxMarkets.Items.Add(marketName); } listBoxMarkets.EndUpdate(); } } }
} // ProcessProductsToRecord // // // ********************************************************* // **** ProcessMarketStatusChangedEvent() **** // ********************************************************* /// <summary> /// Not Yet Implemented! /// </summary> /// <param name="eventArg"></param> private void ProcessMarketStatusChangedEvent(MarketStatusChangedEventArg eventArg) { //TODO: Add Functionality }