Пример #1
0
        public WatchlistViewModel(IEventAggregator events, IWatchlistCache watchlistCache, IMarketDataHelper dataHelper)
        {
            CurWindowState = WindowState.Maximized;
            _events        = events;
            _events.SubscribeOnPublishedThread(this);
            _watchlistCache = watchlistCache;

            List <string> symbols = _watchlistCache.TabWiseData.Values.SelectMany(x => x.Symbols).ToList();

            symbols.AddRange(_watchlistCache.TabWiseData.Values.Select(x => x.Index1));
            symbols.AddRange(_watchlistCache.TabWiseData.Values.Select(x => x.Index2));
            symbols.AddRange(_watchlistCache.TabWiseData.Values.Select(x => x.Index3));
            symbols.AddRange(_watchlistCache.TabWiseData.Values.Select(x => x.Index4));
            symbols.AddRange(_watchlistCache.TabWiseData.Values.Select(x => x.Index5));
            symbols.AddRange(_watchlistCache.TabWiseData.Values.Select(x => x.Index6));


            dataHelper.AddSymbols(symbols);
            Tab1        = new WatchlistTabViewModel(watchlistCache, 1, dataHelper);
            Tab2        = new WatchlistTabViewModel(watchlistCache, 2, dataHelper);
            Tab3        = new WatchlistTabViewModel(watchlistCache, 3, dataHelper);
            Tab4        = new WatchlistTabViewModel(watchlistCache, 4, dataHelper);
            Tab5        = new WatchlistTabViewModel(watchlistCache, 5, dataHelper);
            Tab1Checked = true;
        }
Пример #2
0
 public HomeViewModel(IEventAggregator events, IOrderFieldsCache fieldsCache, IOrderCache orderCache, IWatchlistCache watchlistCache)
 {
     fieldsCache.InitializationCompleted += FieldsCache_InitializationCompleted;
     _fieldsCache = fieldsCache;
     orderCache.InitializationCompleted += OrderCache_InitializationCompleted;
     _orderCache = orderCache;
     watchlistCache.InitializationCompleted += WatchlistCache_InitializationCompleted;
     _watchlistCache = watchlistCache;
     _events         = events;
 }
Пример #3
0
        public WatchlistTabViewModel(IWatchlistCache watchlistCache, int index, IMarketDataHelper dataHelper)
        {
            _watchlistCache = watchlistCache;
            _tabIndex       = index;
            _dataHelper     = dataHelper;
            WatchlistTabModel tabData = _watchlistCache.TabWiseData[_tabIndex];

            Header = tabData.TabName;
            var dataList = tabData.Symbols.Select(x => new LiveFeedDataModel {
                Symbol = x
            });

            LiveFeedData    = new ObservableCollection <LiveFeedDataModel>(dataList);
            _marketDataRows = CollectionViewSource.GetDefaultView(LiveFeedData);
            //_marketDataRows.CurrentChanged += _marketDataRows_CurrentChanged;
            _marketDataRows.Filter = _marketDataRows_Filter;

            Index1 = new WatchlistIndexModel {
                Symbol = tabData.Index1, Name = tabData.Index1
            };
            Index2 = new WatchlistIndexModel {
                Symbol = tabData.Index2, Name = tabData.Index2
            };
            Index3 = new WatchlistIndexModel {
                Symbol = tabData.Index3, Name = tabData.Index3
            };
            Index4 = new WatchlistIndexModel {
                Symbol = tabData.Index4, Name = tabData.Index4
            };
            Index5 = new WatchlistIndexModel {
                Symbol = tabData.Index5, Name = tabData.Index5
            };
            Index6 = new WatchlistIndexModel {
                Symbol = tabData.Index6, Name = tabData.Index6
            };
        }