public async Task LoadXmlDataInDb(string pathShedule, string pathStations, string tableName, Station stationOwner) { var initDb = new InitDbFromXml(_windsorContainer, _eventAggregator, stationOwner); try { switch (tableName) { case "regular": var sheduleGetter = new GetterXmlFromDisk(pathShedule, stationOwner); var stationsGetter = new GetterXmlFromDisk(pathStations, stationOwner); await initDb.InitRegulatorySh(sheduleGetter, stationsGetter); // await TestLeekMemory();//DEBUG break; case "operative": break; case "info": break; } } catch (Exception) //TODO: более точно определять тип исключения и выводить его в окно. { // MessageBox.Show($"Ошибка работы с БД."); } }
//---------------DEBUG //public async Task<bool> TestLeekMemory() //{ // List<Station> stations= new List<Station>(); // for (int i = 0; i < 10000000; i++) // { // stations.Add(new Station {Description = "fdsfs", Name = "dsfsdfasgs", EcpCode = 4352,}); // } // return true; //} //----------------- public async Task LoadHttpDataInDb(string tableName, Station stationOwner) { string httpAdr = ConfigurationManager.AppSettings.Get("httpAddress"); string intetfacesShedule = string.Empty; string uriShedule = string.Empty; string intetfacesStations = ConfigurationManager.AppSettings.Get("Stations"); string uriStations = $"{httpAdr}/{intetfacesStations}"; var stationsGetter = new GetterXmlFromHttp(uriStations, stationOwner); var initDb = new InitDbFromXml(_windsorContainer, _eventAggregator, stationOwner); try { switch (tableName) { case "regular": intetfacesShedule = ConfigurationManager.AppSettings.Get("Regular"); uriShedule = $"{httpAdr}/{intetfacesShedule}"; var sheduleGetter = new GetterXmlFromHttp(uriShedule, stationOwner); await initDb.InitRegulatorySh(sheduleGetter, stationsGetter); break; case "operative": intetfacesShedule = ConfigurationManager.AppSettings.Get("Operat"); uriShedule = $"{httpAdr}/{intetfacesShedule}"; sheduleGetter = new GetterXmlFromHttp(uriShedule, stationOwner); //await initDb.InitOperativeSh(sheduleGetter, stationsGetter); break; case "info": intetfacesShedule = ConfigurationManager.AppSettings.Get("Info"); uriShedule = $"{httpAdr}/{intetfacesShedule}"; sheduleGetter = new GetterXmlFromHttp(uriShedule, stationOwner); //await initDb.InitinfoSh(sheduleGetter, stationsGetter); break; } } catch (Exception ex) //TODO: более точно определять тип исключения и выводить его в окно. { } }