Esempio n. 1
0
        private void mI_File_Open_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Alle EBuLa Dateien (track_*.xml;train_*.xml)|track_*.xml;train_*.xml|Geschwindigkeitshefte (track_*.xml)|track_*.xml|Fahrpläne (train_*.xml)|train_*.xml|Alle Dateien (*.*)|*.*";
            dialog.RestoreDirectory = true;
            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.Cancel) return;

            if (tf != null) this.Controls.Remove(tf);
            else if (trf != null) this.Controls.Remove(trf);
            tf = null; trf = null;
            dc.route = null;

            string filename = dialog.FileName;

            string h = System.IO.Path.GetFileNameWithoutExtension(filename);
            dc.isNewFile = false;
            if (h.IndexOf("track_") >= 0)
            {
                // it is a track
                dc.ReadTrack(filename);
                tf = new TrackForm(this);
                this.Controls.Add(tf);

                dc.OWN_FILL = true;
                dc.AddEntriesToTrack(ref tf);
                dc.OWN_FILL = false;
            }
            else if (h.IndexOf("train_") >= 0)
            {
                // it is a train
                dc.ReadTrain(filename);

                trf = new TrainForm(this);
                this.Controls.Add(trf);

                dc.OWN_FILL = true;
                dc.AddEntriesToTrain(ref trf);
                dc.OWN_FILL = false;
            }
            else
            {
                MessageBox.Show("Die Datei beginnt nicht mit 'track_' oder 'train_'!");
                return;
            }
            mI_File_Save.Enabled = true;
            mI_File_SaveAs.Enabled = true;
        }
Esempio n. 2
0
        private void mI_File_New_Click(object sender, System.EventArgs e)
        {
            // NEW TRACK
            dc.isNewFile = true;

            dc.route = new EBuLa.Route("","");
            EBuLa.Entry entry = new EBuLa.Entry(EBuLa.EntryType.OPS_MARKER, "", "", "", "", "", "", new char(), "", new char());
            dc.route.Entrys.Add(entry);
            tf = new TrackForm(this);
            this.Controls.Add(tf);

            dc.OWN_FILL = true;
            dc.AddEntriesToTrack(ref tf);
            dc.OWN_FILL = false;

            mI_File_Save.Enabled = true;
            mI_File_SaveAs.Enabled = true;
        }