示例#1
0
文件: Plugin.cs 项目: fadoe/FPLedit
        private void StartLinear()
        {
            var backupHandle = info.BackupTimetable();

            try
            {
                bool showMessage = info.Settings.Get("jTGStarter.show-message", true);

                if (showMessage)
                {
                    DialogResult res = MessageBox.Show("Dies speichert die Fahrplandatei am letzten Speicherort und öffnet dann jTrainGraph (>= 2.02). Nachdem Sie die Arbeit in jTrainGraph beendet haben, speichern Sie damit die Datei und schließen das jTrainGraph-Hauptfenster, damit werden die Änderungen übernommen. Aktion fortsetzen?" + Environment.NewLine + Environment.NewLine + "Diese Meldung kann unter jTrainGraph > Einstellungen deaktiviert werden.",
                                                       "jTrainGraph starten", MessageBoxButtons.YesNo, MessageBoxType.Warning);

                    if (res != DialogResult.Yes)
                    {
                        return;
                    }
                }

                info.Save(false);

                StartJtg(info.FileState.FileName, () => info.Reload());
                info.ClearBackup(backupHandle);
            }
            catch (Exception e)
            {
                info.Logger.Error("Beim Verwenden von jTrainGraph ist ein unerwarteter Fehler aufgetreten! " + e);
                info.Logger.LogException(e);
                info.RestoreTimetable(backupHandle);
            }
        }
示例#2
0
#pragma warning restore CS0649

        public TrainsEditingForm(IInfo info) : base(info.Timetable)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.info    = info;
            tt           = info.Timetable;
            backupHandle = info.BackupTimetable();

            gridView.AddColumn <Train>(t => t.TName, "Zugnummer");
            gridView.AddColumn <Train>(t => t.Locomotive, "Tfz");
            gridView.AddColumn <Train>(t => t.Mbr, "Mbr");
            gridView.AddColumn <Train>(t => t.Last, "Last");
            gridView.AddColumn <Train>(t => t.Days.DaysToString(false), "Verkehrstage");
            gridView.AddColumn <Train>(t => BuildPath(t), "Laufweg");
            gridView.AddColumn <Train>(t => t.Comment, "Kommentar");

            gridView.MouseDoubleClick += (s, e) => EditTrain(gridView, TrainDirection.tr, false);

            UpdateListView(gridView, TrainDirection.tr);

            if (Eto.Platform.Instance.IsWpf)
            {
                KeyDown += HandleKeystroke;
            }
            else
            {
                gridView.KeyDown += HandleKeystroke;
            }

            this.AddCloseHandler();
            this.AddSizeStateHandler();
        }
示例#3
0
        public LineEditForm(IInfo info, int route)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.info  = info;
            tt         = info.Timetable;
            this.route = route;

            backupHandle = info.BackupTimetable();

            if (tt.Type == TimetableType.Network)
            {
                loadLineButton.Visible = false;
            }

            gridView.AddColumn <Station>(s => s.SName, "Bahnhof");
            gridView.AddColumn <Station>(s => s.Positions.GetPosition(route).ToString(), "Position");

            gridView.MouseDoubleClick += (s, e) => EditStation(false);

            if (Eto.Platform.Instance.IsWpf)
            {
                KeyDown += HandleKeystroke;
            }
            else
            {
                gridView.KeyDown += HandleKeystroke;
            }

            UpdateStations();

            this.AddCloseHandler();
            this.AddSizeStateHandler();
        }
示例#4
0
        public TrainsEditForm(IInfo info) : base(info.Timetable)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);
            this.info    = info;
            tt           = info.Timetable;
            backupHandle = info.BackupTimetable();

            InitListView(topGridView);
            InitListView(bottomGridView);

            topLineLabel.Text    = "Züge " + tt.GetLineName(TOP_DIRECTION);
            bottomLineLabel.Text = "Züge " + tt.GetLineName(BOTTOM_DIRECTION);
            UpdateListView(topGridView, TOP_DIRECTION);
            UpdateListView(bottomGridView, BOTTOM_DIRECTION);

            bottomGridView.MouseDoubleClick += (s, e) => EditTrain(bottomGridView, BOTTOM_DIRECTION, false);
            topGridView.MouseDoubleClick    += (s, e) => EditTrain(topGridView, TOP_DIRECTION, false);

            if (Eto.Platform.Instance.IsWpf)
            {
                KeyDown += HandleKeystroke;
            }

            this.AddCloseHandler();
            this.AddSizeStateHandler();
        }
        public SingleTimetableEditForm(IInfo info, Train t) : this()
        {
            this.info    = info;
            backupHandle = info.BackupTimetable();

            editor.Initialize(info.Timetable, t);
            Title = Title.Replace("{train}", t.TName);
        }
示例#6
0
        public MultipleTimetableEditForm(IInfo info) : this()
        {
            this.info    = info;
            backupHandle = info.BackupTimetable();

            //editor.Initialize(info.Timetable, t);
            //Title = Title.Replace("{train}", t.TName);

            trainDropDown.ItemTextBinding       = Binding.Property <Train, string>(tr => tr.TName);
            trainDropDown.DataStore             = info.Timetable.Trains;
            trainDropDown.SelectedIndexChanged += TrainDropDown_SelectedIndexChanged;
            trainDropDown.SelectedIndex         = 0;
        }
示例#7
0
        public VelocityForm(IInfo info, Route route) : this()
        {
            this.info  = info;
            tt         = info.Timetable;
            this.route = route;

            attrs = BfplAttrs.GetAttrs(tt);
            if (attrs == null)
            {
                attrs = new BfplAttrs(tt);
                tt.Children.Add(attrs.XMLEntity);
            }

            backupHandle = info.BackupTimetable();
            UpdateListView();
        }
        public LineTimetableEditForm(IInfo info)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.info    = info;
            backupHandle = info.BackupTimetable();

            editor.Initialize(info.Timetable);

            KeyDown += editor.HandleControlKeystroke;

            this.AddCloseHandler();
            this.AddSizeStateHandler();

            if (!Platform.IsWpf)
            {
                DefaultButton = null; // Bugfix, Window closes on [Enter]
            }
            // Important: After AddCloseHandler, otherwise it will destroy Timetable instance in mpmode!
        }
示例#9
0
#pragma warning restore CS0649

        public StationStyleForm(IInfo info)
        {
            this.info    = info;
            tt           = info.Timetable;
            attrs        = new TimetableStyle(tt);
            backupHandle = info.BackupTimetable();

            Eto.Serialization.Xaml.XamlReader.Load(this);

            cc = new ColorCollection(info.Settings);
            ds = new DashStyleHelper();

            gridView.AddColumn <Station>(t => t.SName, "Name");
            gridView.AddColumn <Station>(t => cc.ToName(new StationStyle(t).StationColor ?? attrs.StationColor), "Farbe");
            gridView.AddColumn <Station>(t => (new StationStyle(t).StationWidth ?? attrs.StationWidth).ToString(), "Linienstärke");
            gridView.AddColumn <Station>(t => ds.GetDescription(new StationStyle(t).LineStyle), "Linientyp");
            gridView.AddColumn <Station>(t => new StationStyle(t).Show.ToString(), "Station zeichnen");

            gridView.CellDoubleClick += (s, e) => EditColor(false);

            UpdateStations();

            this.AddCloseHandler();
        }