private void DepthClick(object sender, RoutedEventArgs e) { var connector = Connector; foreach (var security in SecurityPicker.SelectedSecurities) { var window = _quotesWindows.SafeAdd(security, s => { // subscribe on order book flow connector.SubscribeMarketDepth(security); // create order book window var wnd = new QuotesWindow { Title = security.Id + " " + LocalizedStrings.MarketDepth }; wnd.MakeHideable(); return(wnd); }); if (window.Visibility == Visibility.Visible) { window.Hide(); } else { window.Show(); //window.DepthCtrl.UpdateDepth(connector.GetMarketDepth(security)); } if (!_initialized) { connector.MarketDepthReceived += TraderOnMarketDepthReceived; _initialized = true; } } }