private void InitializeQuoteHistory() { DisposeQuoteHistory(); _historyClient = new QuoteHistoryClient("QuoteHistoryCache"); _historyClient.Connected += HistoryClientOnConnected; _historyClient.ConnectError += HistoryClientOnConnectError; _historyClient.Disconnected += HistoryClientOnDisconnected; _historyClient.Connect(textAddress.Text); _historyCacheManager = new HistoryCacheManager(_historyClient); _historyCacheManager.Initialize(); var symbols = _historyCacheManager.GetSymbols(); foreach (var symbol in symbols) { comboboxSymbol.Items.Add(symbol); } comboboxSymbol.SelectedIndex = 0; var periodicities = _historyCacheManager.GetPeriodicities(); foreach (var periodicity in periodicities) { comboboxPeriodicity.Items.Add(periodicity.ToString()); } comboboxPeriodicity.SelectedIndex = 0; comboboxPriceType.Items.Add("Bid"); comboboxPriceType.Items.Add("Ask"); comboboxPriceType.Items.Add("Ticks"); comboboxPriceType.Items.Add("Level2"); comboboxPriceType.SelectedIndex = 0; }
private void DisposeQuoteHistory() { if (_historyCacheManager != null) { _historyCacheManager.Close(); _historyCacheManager = null; } if (_historyClient != null) { _historyClient.Connected -= HistoryClientOnConnected; _historyClient.ConnectError -= HistoryClientOnConnectError; _historyClient.Disconnected -= HistoryClientOnDisconnected; _historyClient.Dispose(); _historyClient = null; } comboboxSymbol.Items.Clear(); comboboxSymbol.SelectedIndex = -1; comboboxPeriodicity.Items.Clear(); comboboxPeriodicity.SelectedIndex = -1; comboboxPriceType.Items.Clear(); comboboxPriceType.SelectedIndex = -1; textHistory.Text = ""; textIntervals.Text = ""; }