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

            foreach (var security in SecurityPicker.SelectedSecurities)
            {
                var window = _quotesWindows.SafeAdd(security, s =>
                {
                    // начинаем получать котировки стакана
                    trader.RegisterMarketDepth(security);

                    // создаем окно со стаканом
                    var wnd = new QuotesWindow
                    {
                        Title     = security.Id + " " + LocalizedStrings.MarketDepth,
                        DepthCtrl =
                        {
                            MaxDepth = MainWindow.Instance.Trader.OrderBookDepth ?? 100
                        }
                    };
                    wnd.MakeHideable();
                    return(wnd);
                });

                if (window.Visibility == Visibility.Visible)
                {
                    window.Hide();
                }
                else
                {
                    window.Show();
                    window.DepthCtrl.UpdateDepth(trader.GetMarketDepth(security));
                }

                if (!_initialized)
                {
                    trader.MarketDepthChanged += TraderOnMarketDepthChanged;
                    _initialized = true;
                }
            }
        }
Example #2
0
        private void QuotesClick(object sender, RoutedEventArgs e)
        {
            var trader = MainWindow.Instance.Trader;

            var window = _quotesWindows.SafeAdd(SecurityPicker.SelectedSecurity, security =>
            {
                // начинаем получать котировки стакана
                trader.RegisterMarketDepth(security);

                // создаем окно со стаканом
                var wnd = new QuotesWindow
                {
                    Title     = security.Id + " " + LocalizedStrings.MarketDepth,
                    DepthCtrl =
                    {
                        MaxDepth = MainWindow.Instance.Depth.Text.To <int>()
                    }
                };
                wnd.MakeHideable();
                return(wnd);
            });

            if (window.Visibility == Visibility.Visible)
            {
                window.Hide();
            }
            else
            {
                window.Show();
            }

            if (!_initialized)
            {
                TraderOnMarketDepthsChanged(new[] { trader.GetMarketDepth(SecurityPicker.SelectedSecurity) });
                trader.MarketDepthsChanged += TraderOnMarketDepthsChanged;
                _initialized = true;
            }
        }
		private void QuotesClick(object sender, RoutedEventArgs e)
		{
			var trader = MainWindow.Instance.Trader;

			var window = _quotesWindows.SafeAdd(SecurityPicker.SelectedSecurity, security =>
			{
				// начинаем получать котировки стакана
				trader.RegisterMarketDepth(security);

				// создаем окно со стаканом
				var wnd = new QuotesWindow
				{
					Title = security.Id + " " + LocalizedStrings.MarketDepth,
					DepthCtrl =
					{
						MaxDepth = MainWindow.Instance.Depth.Text.To<int>()
					}
				};
				wnd.MakeHideable();
				return wnd;
			});

			if (window.Visibility == Visibility.Visible)
				window.Hide();
			else
				window.Show();

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