/// <summary> /// create bot /// создать бота /// </summary> public void CreateNewBot() { try { BotCreateUi ui = new BotCreateUi(BotFactory.GetNamesStrategy(), BotFactory.GetScriptsNamesStrategy(), StartProgram.IsOsTrader); ui.ShowDialog(); if (ui.IsAccepted == false) { return; } if (ui.NameStrategy == "Martingale") { if (ui.NameBot.Split('h').Length != 1) { MessageBox.Show(OsLocalization.Trader.Label6); return; } if (ui.NameBot.Split('l').Length != 1) { MessageBox.Show(OsLocalization.Trader.Label7); return; } } if (File.Exists(@"Engine\" + @"SettingsRealKeeper.txt")) { using (StreamReader reader = new StreamReader(@"Engine\" + @"SettingsRealKeeper.txt")) { while (!reader.EndOfStream) { string[] str = reader.ReadLine().Split('@'); if (str[0] == ui.NameBot) { MessageBox.Show(OsLocalization.Trader.Label8); return; } } } } if (File.Exists(@"Engine\" + @"SettingsTesterKeeper.txt")) { using (StreamReader reader = new StreamReader(@"Engine\" + @"SettingsTesterKeeper.txt")) { while (!reader.EndOfStream) { string[] str = reader.ReadLine().Split('@'); if (str[0] == ui.NameBot) { MessageBox.Show(OsLocalization.Trader.Label8); return; } } } } BotPanel newRobot = BotFactory.GetStrategyForName(ui.NameStrategy, ui.NameBot, _startProgram, ui.IsScript); if (PanelsArray == null) { PanelsArray = new List <BotPanel>(); } PanelsArray.Add(newRobot); if (BotCreateEvent != null) { BotCreateEvent(newRobot); } SendNewLogMessage(OsLocalization.Trader.Label9 + newRobot.NameStrategyUniq, LogMessageType.System); ReloadActivBot(newRobot); Save(); ReloadRiskJournals(); } catch (Exception error) { SendNewLogMessage(error.ToString(), LogMessageType.Error); } }