public ConnectorUi(Connector connectorBot) { try { InitializeComponent(); List <IServer> servers = ServerMaster.GetServers(); if (servers == null) {// если сервер для подключения к бирже ещё не создан Close(); return; } // сохраняем коннекторы _connectorBot = connectorBot; // загружаем настройки в контролы for (int i = 0; i < servers.Count; i++) { ComboBoxTypeServer.Items.Add(servers[i].ServerType); } if (connectorBot.ServerType != ServerType.Unknown) { ComboBoxTypeServer.SelectedItem = connectorBot.ServerType; _selectedType = connectorBot.ServerType; } else { ComboBoxTypeServer.SelectedItem = servers[0].ServerType; _selectedType = servers[0].ServerType; } if (ServerMaster.IsTester) { ComboBoxTypeServer.IsEnabled = false; CheckBoxIsEmulator.IsEnabled = false; CheckBoxSetForeign.IsEnabled = false; ComboBoxTypeServer.SelectedItem = ServerType.Tester; connectorBot.ServerType = ServerType.Tester; _selectedType = ServerType.Tester; } LoadClassOnBox(); LoadSecurityOnBox(); LoadPortfolioOnBox(); ComboBoxClass.SelectionChanged += ComboBoxClass_SelectionChanged; CheckBoxIsEmulator.IsChecked = _connectorBot.EmulatorIsOn; CheckBoxSetForeign.IsChecked = _connectorBot.SetForeign; ComboBoxTypeServer.SelectionChanged += ComboBoxTypeServer_SelectionChanged; BoxTimeFrame.SelectionChanged += BoxTimeFrame_SelectionChanged; CreateTimeFrameBox(); BoxTimeFrame.ToolTip = "ТФ Delta не имеет чёткого критерия закрытия и закрывает свечи по изменению дельты (разницы между объёмом текущих покупок и продаж прошедших с утра) на N(настраивается отдельно) пунктов"; BoxTimeCandleCreateType.Items.Add(CandleSeriesCreateDataType.Tick); BoxTimeCandleCreateType.Items.Add(CandleSeriesCreateDataType.MarketDepth); BoxTimeCandleCreateType.SelectedItem = _connectorBot.CandleCreateType; BoxTimeCandleCreateType.SelectionChanged += BoxTimeCandleCreateType_SelectionChanged; TextBoxCountTradesInCandle.Text = _connectorBot.CountTradeInCandle.ToString(); TextBoxCountTradesInCandle.TextChanged += TextBoxCountTradesInCandle_TextChanged; } catch (Exception error) { MessageBox.Show("Ошибка в конструкторе " + error); } }
public ConnectorUi(Connector connectorBot) { try { InitializeComponent(); List <IServer> servers = ServerMaster.GetServers(); if (servers == null) {// если сервер для подключения к бирже ещё не создан Close(); return; } // сохраняем коннекторы _connectorBot = connectorBot; // загружаем настройки в контролы for (int i = 0; i < servers.Count; i++) { ComboBoxTypeServer.Items.Add(servers[i].ServerType); } if (connectorBot.ServerType != ServerType.Unknown) { ComboBoxTypeServer.SelectedItem = connectorBot.ServerType; _selectedType = connectorBot.ServerType; } else { ComboBoxTypeServer.SelectedItem = servers[0].ServerType; _selectedType = servers[0].ServerType; } if (ServerMaster.StartProgram == ServerStartProgramm.IsTester) { ComboBoxTypeServer.IsEnabled = false; CheckBoxIsEmulator.IsEnabled = false; CheckBoxSetForeign.IsEnabled = false; ComboBoxTypeServer.SelectedItem = ServerType.Tester; //ComboBoxClass.SelectedItem = ServerMaster.GetServers()[0].Securities[0].NameClass; //ComboBoxPortfolio.SelectedItem = ServerMaster.GetServers()[0].Portfolios[0].Number; connectorBot.ServerType = ServerType.Tester; _selectedType = ServerType.Tester; } LoadClassOnBox(); LoadSecurityOnBox(); LoadPortfolioOnBox(); ComboBoxClass.SelectionChanged += ComboBoxClass_SelectionChanged; CheckBoxIsEmulator.IsChecked = _connectorBot.EmulatorIsOn; ComboBoxTypeServer.SelectionChanged += ComboBoxTypeServer_SelectionChanged; ComboBoxCandleMarketDataType.Items.Add(CandleMarketDataType.Tick); ComboBoxCandleMarketDataType.Items.Add(CandleMarketDataType.MarketDepth); ComboBoxCandleMarketDataType.SelectedItem = _connectorBot.CandleMarketDataType; ComboBoxCandleCreateMethodType.Items.Add(CandleCreateMethodType.Simple); ComboBoxCandleCreateMethodType.Items.Add(CandleCreateMethodType.Ticks); ComboBoxCandleCreateMethodType.Items.Add(CandleCreateMethodType.Volume); ComboBoxCandleCreateMethodType.Items.Add(CandleCreateMethodType.Renko); ComboBoxCandleCreateMethodType.Items.Add(CandleCreateMethodType.Delta); ComboBoxCandleCreateMethodType.SelectedItem = _connectorBot.CandleCreateMethodType; CheckBoxSetForeign.IsChecked = _connectorBot.SetForeign; LoadTimeFrameBox(); TextBoxCountTradesInCandle.Text = _connectorBot.CountTradeInCandle.ToString(); _countTradesInCandle = _connectorBot.CountTradeInCandle; TextBoxCountTradesInCandle.TextChanged += TextBoxCountTradesInCandle_TextChanged; TextBoxVolumeToClose.Text = _connectorBot.VolumeToCloseCandleInVolumeType.ToString(); _volumeToClose = _connectorBot.VolumeToCloseCandleInVolumeType; TextBoxVolumeToClose.TextChanged += TextBoxVolumeToClose_TextChanged; TextBoxRencoPunkts.Text = _connectorBot.RencoPunktsToCloseCandleInRencoType.ToString(); _rencoPuncts = _connectorBot.RencoPunktsToCloseCandleInRencoType; TextBoxRencoPunkts.TextChanged += TextBoxRencoPunkts_TextChanged; TextBoxDeltaPeriods.Text = _connectorBot.DeltaPeriods.ToString(); TextBoxDeltaPeriods.TextChanged += TextBoxDeltaPeriods_TextChanged; _deltaPeriods = _connectorBot.DeltaPeriods; ShowDopCandleSettings(); ComboBoxCandleCreateMethodType.SelectionChanged += ComboBoxCandleCreateMethodType_SelectionChanged; } catch (Exception error) { MessageBox.Show("Ошибка в конструкторе " + error); } }