private void SetTabIndex(string displayStr) { int index = 0; foreach (var item in CommHelper.ContractModelGroupList) { if (string.Equals(item.Key, displayStr)) { break; } index++; } var quoteViewModel = TradeQuotesViewModel.GetInstance(null); var tabViewModel = QuotesTabControlViewModel.GetInstance(null); if (quoteViewModel.IsInternationalCheck) { if (!quoteViewModel.IsQuoteCheck) { quoteViewModel.IsQuoteCheck = true; } } else { quoteViewModel.InternationalCheckType = 1; quoteViewModel.IsInternationalCheck = true; } tabViewModel.SelectedIndex = index; }
public static TradeQuotesViewModel GetInstance(MainViewModel mainVM) { if (_instance == null) { _instance = new TradeQuotesViewModel(mainVM); } return(_instance); }
public void ScrollIntoView(SysCodeModel stock) { if (stock == null || (_mainVM.SelectItemViewModel != null && string.Equals(_mainVM.SelectItemViewModel.ContractCode, stock.SystemName))) { return; } if (!TradeQuotesViewModel.GetInstance(null).IsInternationalCheck) { TradeQuotesViewModel.GetInstance(null).InternationalCheckType = 1; TradeQuotesViewModel.GetInstance(null).IsInternationalCheck = true; } ContractChanged?.Invoke(stock, EventArgs.Empty); }
//需要异步根据最新成交量画K图 private void kChartAction() { if (TradeQuotesViewModel.GetInstance(null).CuotesTabControlViewModel != null) { if (TradeQuotesViewModel.GetInstance(null).CuotesTabControlViewModel.tempTime != 0 || TradeQuotesViewModel.GetInstance(null).IsFifteenMinKLineCheck || TradeQuotesViewModel.GetInstance(null).IsFiveMinKLineCheck || TradeQuotesViewModel.GetInstance(null).IsOneMinKLineCheck || TradeQuotesViewModel.GetInstance(null).IsSixtyMinKLineCheck || TradeQuotesViewModel.GetInstance(null).IsThirtyMinKLineCheck || TradeQuotesViewModel.GetInstance(null).IsThreeMinKLineCheck) { TradeQuotesViewModel.GetInstance(null).CuotesTabControlViewModel.SxKChar(); } } if (TradeQuotesViewModel.GetInstance(null).IsRealTimeCheck == true) { TradeQuotesViewModel.GetInstance(null).RealTimeChart.SxFsChar(); } }
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(); }