Ejemplo n.º 1
0
        private void importButton_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            try
            {
                CIFXMLDatabase db = new CIFXMLDatabase();
                CIFImporter cifImporter = new CIFImporter();
                cifImporter.Import(db, filenameTextBox.Text);
                timetable ImportedWTT = db.GetWTT();
                ImportLocations locImporter = new ImportLocations();
                Locations = locImporter.Import(ImportedWTT, db.GetLocations(), db.GetLocationDescriptions());

                string filename = Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDocuments);
                filename += Path.DirectorySeparatorChar + "SimSig" + Path.DirectorySeparatorChar + "SimSigWTTLocations.xml";
                LocationData.SaveFile(filename, Locations);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        private void importButton_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            Application.DoEvents();

            try
            {
                CIFXMLDatabase db = new CIFXMLDatabase();
                CIFImporter cifImporter = new CIFImporter();

                // Filter by ATOC code
                if (atocCheckBox.Checked)
                    cifImporter.FilterATOC = atocTextBox.Text;
                else
                    cifImporter.FilterATOC = string.Empty;

                // Filter by date range
                if (dateCheckBox.Checked)
                {
                    cifImporter.FilterByDates = true;
                    cifImporter.FilterFrom = fromDateTimePicker.Value;
                    cifImporter.FilterTo = toDateTimePicker.Value;
                }
                else
                {
                    cifImporter.FilterByDates = false;
                }

                // Filter by days
                if (daysCheckBox.Checked)
                {
                    cifImporter.FilterDays.monday = daysCheckedListBox.GetItemChecked(0);
                    cifImporter.FilterDays.tuesday = daysCheckedListBox.GetItemChecked(1);
                    cifImporter.FilterDays.wednesday = daysCheckedListBox.GetItemChecked(2);
                    cifImporter.FilterDays.thursday = daysCheckedListBox.GetItemChecked(3);
                    cifImporter.FilterDays.friday = daysCheckedListBox.GetItemChecked(4);
                    cifImporter.FilterDays.saturday = daysCheckedListBox.GetItemChecked(5);
                    cifImporter.FilterDays.sunday = daysCheckedListBox.GetItemChecked(6);
                    cifImporter.FilterByDays = true;
                }
                else
                {
                    cifImporter.FilterByDays = false;
                }

                // Filter by TIPLOCs
                if (TIPLOCCheckBox.Checked)
                {
                    cifImporter.FilterTIPLOC = TIPLOCTextBox.Text;
                    cifImporter.FilterAllTIPLOC = TIPLOCAllCheckBox.Checked;
                }

                cifImporter.Import(db, filenameTextBox.Text);
                ImportedWTT = db.GetWTT();
                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }