Example #1
0
 internal static void SaveFile(string filename, locationData detail)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(locationData));
     using (TextWriter textWriter = new StreamWriter(filename))
     {
         serializer.Serialize(textWriter, detail);
     }
 }
Example #2
0
 public EditScheduleForm(object _item, timetable _timetable, locationData _locations, bool _isNewItem)
     : base(_item, _timetable)
 {
     InitializeComponent();
     isNewItem = _isNewItem;
     Locations = _locations;
     schedule.Owner = _timetable;
     _timetable.Locations = _locations;
     LoadControls();
 }
Example #3
0
        public MasterForm()
        {
            InitializeComponent();

            this.Text = Application.ProductName;
            string filename = Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDocuments);
            filename += Path.DirectorySeparatorChar + "SimSig" + Path.DirectorySeparatorChar + "SimSigWTTLocations.xml";
            Locations = LocationData.OpenFile(filename);
            Timetable = new timetable();
            LoadControls();
            selectComboBox.SelectedIndex = 1;
            filterLabel.Text = string.Empty;
        }
Example #4
0
        public locationData Import(timetable source, StringCollection locs, StringCollection desc)
        {
            Locations = new locationData();
            Locations.locationDetail = new locationDetail[0];

            for (int idx = 0; idx < locs.Count; idx++)
            {
                AddLocation(locs[idx], desc[idx]);
            }

            foreach (schedule sched in source.schedule)
            {
                foreach (scheduleLocation schedloc in sched.scheduleLocation)
                {
                    locationDetail detail = AddLocation(schedloc.locationID, string.Empty);
                    if (!string.IsNullOrWhiteSpace(schedloc.pathCode)) AddPath(detail, schedloc.pathCode);
                    if (!string.IsNullOrWhiteSpace(schedloc.platformCode)) AddPlatform(detail, schedloc.platformCode);
                    if (!string.IsNullOrWhiteSpace(schedloc.lineCode)) AddLine(detail, schedloc.lineCode);
                }
            }
            return Locations;
        }
Example #5
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;
            }
        }
Example #6
0
 private void locationDetailToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LocationImportForm frm = new LocationImportForm();
     frm.Locations = Locations;
     frm.ShowDialog();
     Locations = frm.Locations;
 }