Example #1
0
        private void ProcessFile(string path)
        {
            if (!File.Exists(path))
            {
                throw new FileNotFoundException(string.Format("Файлът {0} не може да бъде намерен!", path));
            }

            string extension = Path.GetExtension(path);

            IImportableFile document = Factories.InputFileFactory.Create(extension, Properties.Settings.Default.ValidateInputFile);

            try
            {
                document.Open(path, Databases.DefaultDatabase.GetInstance().Stations);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
                throw;
            }

            MessageBox.Show(string.Format("Добавени станции: {0}; Добавени измервания: {1}", Databases.DefaultDatabase.GetInstance().Stations.Count, Databases.DefaultDatabase.GetInstance().Stations.SelectMany(x => x.Observations).Count()), "Четене на файл:", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.stationsBindingSource.ResetBindings(false);

            this.uxMenuItemSaveFile.Enabled           = true;
            this.uxButtonCalculateIndexErrors.Enabled = true;
        }
Example #2
0
        public void Create_ShouldReturnLandXmlFile_WhenXmlFileExtension()
        {
            IImportableFile file = InputFileFactory.Create(".xml");

            Assert.IsInstanceOf(file.GetType(), typeof(LandXmlFile));
        }