Ejemplo 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;
        }
Ejemplo n.º 2
0
        private void mI_File_NewTrain_Click(object sender, System.EventArgs e)
        {
            dc.isNewFile = true;

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

            dc.OWN_FILL = true;
            trf.bBrowse_Click(this, new EventArgs());
            dc.OWN_FILL = false;

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