コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: xyicheng/Stocks
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IStockProvider dataService)
        {
            _dataService = dataService;
            BVM = new BasicViewModel(dataService);
            GVM = new GroupViewModel(dataService);
            GHVM = new GroupHistoryViewModel(dataService);

            var loStreamQuote = _dataService.StockQuoteStream.ObserveOnDispatcher()
                .Scan((quoteA, quoteB) => StockQuote.MinPrice(quoteA, quoteB)).DistinctUntilChanged();
            var hiStreamQuote = _dataService.StockQuoteStream.ObserveOnDispatcher()
                .Scan((quoteA, quoteB) => StockQuote.MaxPrice(quoteA, quoteB)).DistinctUntilChanged();

            loStreamQuote.Subscribe(quote => LoQuote = quote);
            hiStreamQuote.Subscribe(quote => HiQuote = quote);
        }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: srodriguez511/Stocks
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IStockProvider dataService)
        {
            _dataService = dataService;
            BVM          = new BasicViewModel(dataService);
            GVM          = new GroupViewModel(dataService);
            GHVM         = new GroupHistoryViewModel(dataService);

            var loStreamQuote = _dataService.StockQuoteStream.ObserveOnDispatcher()
                                .Scan((quoteA, quoteB) => StockQuote.MinPrice(quoteA, quoteB)).DistinctUntilChanged();
            var hiStreamQuote = _dataService.StockQuoteStream.ObserveOnDispatcher()
                                .Scan((quoteA, quoteB) => StockQuote.MaxPrice(quoteA, quoteB)).DistinctUntilChanged();

            loStreamQuote.Subscribe(quote => LoQuote = quote);
            hiStreamQuote.Subscribe(quote => HiQuote = quote);
        }