Exemple #1
0
        /// <summary>
        /// Загрузка расписания и станций из XML файла с диска.
        /// </summary>
        public async void LoadXmlDataInDb(string tableName, string railwayStationName, int ecpCode)
        {
            string pathShedule  = null;
            string pathStations = null;

            var fbd = new OpenFileDialog
            {
                Filter = @"XML Files (.xml)|*.xml|All Files (*.*)|*.*",
                Title  = "Файл регулярного расписания"
            };
            var result = fbd.ShowDialog();

            if ((result == DialogResult.OK) && (!string.IsNullOrWhiteSpace(fbd.FileName)))
            {
                pathShedule = fbd.FileName;

                fbd = new OpenFileDialog
                {
                    Filter = @"XML Files (.xml)|*.xml|All Files (*.*)|*.*",
                    Title  = "Файл со станциями"
                };
                result = fbd.ShowDialog();
                if ((result == DialogResult.OK) && (!string.IsNullOrWhiteSpace(fbd.FileName)))
                {
                    pathStations = fbd.FileName;
                }
            }

            if (string.IsNullOrEmpty(pathShedule) || string.IsNullOrEmpty(pathStations))
            {
                return;
            }

            var stationOwner = new Station {
                Name = railwayStationName, EcpCode = ecpCode
            };

            var processViewModel = new ProcessViewModel(_eventAggregator, stationOwner);

            _windowManager.ShowWindow(processViewModel);

            await ApkDk.LoadXmlDataInDb(pathShedule, pathStations, tableName, stationOwner);
        }