private void DepthClick(object sender, RoutedEventArgs e)
        {
            var trader = MainWindow.Instance.Trader;

            foreach (var security in SecurityPicker.SelectedSecurities)
            {
                var window = _quotesWindows.SafeAdd(security, key =>
                {
                    // create order book window
                    var wnd = new QuotesWindow
                    {
                        Title = security.Id + " " + LocalizedStrings.MarketDepth
                    };
                    wnd.MakeHideable();
                    return(wnd);
                });

                if (window.Visibility == Visibility.Visible)
                {
                    // unsubscribe from order book flow
                    trader.UnRegisterMarketDepth(security);

                    window.Hide();
                }
                else
                {
                    // subscribe on order book flow
                    trader.RegisterMarketDepth(security);

                    window.Show();

                    window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
                }

                if (!_initialized)
                {
                    trader.MarketDepthChanged += TraderOnMarketDepthChanged;
                    _initialized = true;
                }
            }
        }
Пример #2
0
        private void DepthClick(object sender, RoutedEventArgs e)
        {
            var trader = MainWindow.Instance.Trader;

            var security = SecurityPicker.SelectedSecurity;

            var window = _quotesWindows.SafeAdd(security, key =>
            {
                // создаем окно со стаканом
                var wnd = new QuotesWindow {
                    Title = security.Id + " " + LocalizedStrings.MarketDepth
                };
                wnd.MakeHideable();
                return(wnd);
            });

            if (window.Visibility == Visibility.Visible)
            {
                // останавливаем получение стакана
                trader.UnRegisterMarketDepth(security);

                window.Hide();
            }
            else
            {
                // начинаем получать стакан
                trader.RegisterMarketDepth(security);

                window.Show();
            }

            if (!_initialized)
            {
                TraderOnMarketDepthsChanged(new[] { trader.GetMarketDepth(security) });
                trader.MarketDepthsChanged += TraderOnMarketDepthsChanged;
                _initialized = true;
            }
        }
Пример #3
0
		private void DepthClick(object sender, RoutedEventArgs e)
		{
			var trader = MainWindow.Instance.Trader;

			var security = SecurityPicker.SelectedSecurity;

			var window = _quotesWindows.SafeAdd(security, key =>
			{
				// create order book window
				var wnd = new QuotesWindow { Title = security.Id + " " + LocalizedStrings.MarketDepth };
				wnd.MakeHideable();
				return wnd;
			});

			if (window.Visibility == Visibility.Visible)
			{
				// unsubscribe from order book flow
				trader.UnRegisterMarketDepth(security);

				window.Hide();
			}
			else
			{
				// subscribe on order book flow
				trader.RegisterMarketDepth(security);

				window.Show();
			}

			if (!_initialized)
			{
				TraderOnMarketDepthsChanged(new[] { trader.GetMarketDepth(security) });
				trader.MarketDepthsChanged += TraderOnMarketDepthsChanged;
				_initialized = true;
			}
		}