コード例 #1
0
ファイル: MainWindow.cs プロジェクト: ssh352/ctp-1
 /// <summary>
 /// 刷新行情集合
 /// </summary>
 private void UpdateMarkets()
 {
     while (ChinaMarketValue.isStartMarket)
     {
         try
         {
             object obj = ChinaMarketValue.blkMarketInfo.Take();
             if (obj is TDFMarketData)
             {
                 TDFMarketData data   = (TDFMarketData)obj;
                 MarketInfo    market = null;
                 if (ChinaMarketValue.dicMarketInfo.ContainsKey(data.WindCode))
                 {
                     market = ChinaMarketValue.dicMarketInfo[data.WindCode];
                 }
                 else
                 {
                     market = new MarketInfo();
                     ChinaMarketValue.dicMarketInfo.TryAdd(data.WindCode, market);
                 }
                 ConvertTDFMarketData(data, market);
                 if (market.type == "2")
                 {
                     MarketInfo market2 = new MarketInfo();
                     market2.exchangeCode = market.exchangeCode;
                     market2.code         = market.code;
                     market2.currNumber   = market.currNumber;
                     market2.currPrice    = market2.currPrice;
                     market2.time         = market2.time;
                     SendUDPPacket(market2.MyToString());
                     market.type = "Z";
                 }
                 SendUDPPacket(market.MyToString());
             }
         }
         catch (Exception ex)
         {
             ChinaMarketValue.exceptionLog.log(ChinaMarketValue.logLevel, ex.ToString());
         }
     }
 }