public MainWindow() { InitializeComponent(); CLog.DayToSave = 100; CLog.InitCLog(); AddLogInfo("DataScalesRepeater", "Start Programm"); LCWeigth = new List <CWeigth>(); if (ConfigurationManager.AppSettings["TYPE_WEIGTH"] == "AMT_LPC_PU8") { TYPE_CURENT_WIGTH = TYPE_WEIGTH.AMT_LPC_PU8; LPC_PU8 = new CWeigth("АМТ. ЛПЦ-1. ПУ-8", TYPE_CURENT_WIGTH, ConfigurationManager.AppSettings["DNS_SERVER"], ConfigurationManager.AppSettings["WEIGTH_PORT_1"]); LPC_PU6 = new CWeigth("АМТ. ЛПЦ-1. ПУ-6", TYPE_CURENT_WIGTH, ConfigurationManager.AppSettings["DNS_SERVER"], ConfigurationManager.AppSettings["WEIGTH_PORT_2"]); LCWeigth.Add(LPC_PU8); LCWeigth.Add(LPC_PU6); } if (ConfigurationManager.AppSettings["DEBUG"] == "1") { debug = true; } DataGridScales.DataContext = LCWeigth; TreadSUiWork = true; TreadUi = new Thread(TreadUiUpdater); TreadUi.Start(); //Автостарт if (ConfigurationManager.AppSettings["AUTOSTART"] == "1") { //Запускаем сервер AddLogInfo("DataScalesRepeater", "Starting Server"); AddLogInfo("DataScalesRepeater", "Reading Config"); DNS_NAME = ConfigurationManager.AppSettings["DNS_SERVER"]; PORT = ConfigurationManager.AppSettings["PORT_SERVER"]; ////Запускаем треды //TreadServiceWork = true; //TreadService = new Thread(TcpService); //TreadService.Start(); TreadServiceListenerWork = true; TreadServiceListener = new Thread(TcpServiceListener); TreadServiceListener.Start(); } }