예제 #1
0
 public void SetOptionalList()
 {
     if (TradeInfoHelper.OptionalModelList.Count > 0)
     {
         List <FuturesViewModel> list = new List <FuturesViewModel>();
         int seq = 0;
         foreach (var item in TradeInfoHelper.OptionalModelList)
         {
             var datamodel = TradeInfoHelper.ContractModelList.FirstOrDefault(o => string.Equals(o.contractCode, item.contract_id));
             if (datamodel != null)
             {
                 seq++;
                 var viewModel = new FuturesViewModel(datamodel);
                 viewModel.Seq                  = seq;
                 viewModel.IsOptionalStock      = true;
                 viewModel.OptionalSerialNumber = item.serial_number;
                 QuotationEntity quotesmodel = null;
                 lock (TradeInfoHelper.SubscribedContractList)
                 {
                     quotesmodel = TradeInfoHelper.SubscribedContractList.FirstOrDefault(o => string.Equals(o.cd, item.contract_id));
                 }
                 if (quotesmodel != null)
                 {
                     scoketManager.UpdateModelInfo(viewModel, quotesmodel);
                 }
                 list.Add(viewModel);
             }
         }
         TradeQuotesViewModel.GetInstance(null).OptionalList = list;
     }
     else
     {
         TradeQuotesViewModel.GetInstance(null).OptionalList.Clear();
     }
     TradeQuotesViewModel.GetInstance(null).SetOptionalList();
 }
예제 #2
0
        public void AddOptionalData(OptionalContractModel item)
        {
            int seq       = TradeInfoHelper.OptionalModelList.Count;
            var datamodel = TradeInfoHelper.ContractModelList.FirstOrDefault(o => string.Equals(o.contractCode, item.contract_id));

            if (datamodel != null)
            {
                var viewModel = new FuturesViewModel(datamodel);
                viewModel.Seq                  = seq;
                viewModel.IsOptionalStock      = true;
                viewModel.OptionalSerialNumber = item.serial_number;
                QuotationEntity quotesmodel = null;
                lock (TradeInfoHelper.SubscribedContractList)
                {
                    quotesmodel = TradeInfoHelper.SubscribedContractList.FirstOrDefault(o => string.Equals(o.cd, item.contract_id));
                }
                if (quotesmodel != null)
                {
                    ScoketManager.GetInstance().UpdateModelInfo(viewModel, quotesmodel);
                }
                OptionalList.Add(viewModel);
                SetOptionalList();
            }
        }