Example #1
0
 public TrainCategoryForm(trainCategory _item, timetable _timetable, bool isNewItem)
     : base(_item, _timetable)
 {
     InitializeComponent();
     EnableCategoryID = isNewItem;
     LoadControls();
 }
Example #2
0
 internal static void SaveFile(string filename, timetable timetable)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(timetable));
     using (TextWriter textWriter = new StreamWriter(filename))
     {
         serializer.Serialize(textWriter, timetable);
     }
 }
Example #3
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 #4
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 #5
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 #6
0
 public BaseEditForm(object _item, timetable _timetable)
 {
     Item = _item;
     Timetable = _timetable;
     InitializeComponent();
 }
Example #7
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ConfirmUnsaved())
            {
                if (wttOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.Cursor = Cursors.WaitCursor;
                    Application.DoEvents();

                    Timetable = WTTData.OpenFile(wttOpenFileDialog.FileName);
                    Timetable.Locations = Locations;
                    LoadControls();
                    LoadListBox();
                    wttSaveFileDialog.FileName = wttOpenFileDialog.FileName;

                    Changed = false;

                    this.Cursor = Cursors.Default;
                }
            }
        }
Example #8
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ConfirmUnsaved())
     {
         Timetable = new timetable();
         LoadControls();
         LoadListBox();
         wttSaveFileDialog.FileName = string.Empty;
         Changed = false;
     }
 }
Example #9
0
        private void CreatePackage()
        {
            string tempPath = System.IO.Path.GetTempPath();
            string tempFile = tempPath + Path.DirectorySeparatorChar + "header.xml";
            string zipName = Path.ChangeExtension(wttSaveFileDialog.FileName, "zip");

            File.Delete(zipName);

            timetable header = new timetable();
            header.description = Timetable.description;
            header.endDate = Timetable.endDate;
            header.endDateSpecified = Timetable.endDateSpecified;
            header.startDate = Timetable.startDate;
            header.startDateSpecified = Timetable.startDateSpecified;
            header.title = Timetable.title;
            WTTData.SaveFile(tempFile, header);
            AddFileToZip(zipName, tempFile);
            File.Delete(tempFile);

            tempFile = tempPath + Path.DirectorySeparatorChar + "tt.xml";
            WTTData.SaveFile(tempFile, Timetable);
            AddFileToZip(zipName, tempFile);
            File.Delete(tempFile);
        }
Example #10
0
 private void cifDataToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CIFImportForm frm = new CIFImportForm();
     if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Timetable = frm.ImportedWTT;
         LoadControls();
         LoadListBox();
     }
 }
Example #11
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;
            }
        }
Example #12
0
 public EditRuleForm(object _item, timetable _timetable)
     : base(_item, _timetable)
 {
     InitializeComponent();
 }