Ejemplo n.º 1
0
#pragma warning restore CS0649

        public TrainStyleForm(IPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;
            var tt    = pluginInterface.Timetable;
            var attrs = new TimetableStyle(tt);

            backupHandle = pluginInterface.BackupTimetable();

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

            var cc = new ColorCollection(pluginInterface.Settings);
            var ds = new DashStyleHelper();

            var lineWidths = Enumerable.Range(1, 5).Cast <object>().ToArray();

            gridView.AddColumn <TrainStyle>(t => t.Train.TName, "Zugnummer");
            gridView.AddDropDownColumn <TrainStyle>(t => t.HexColor, cc.ColorHexStrings, EtoBindingExtensions.ColorBinding(cc), "Farbe", true);
            gridView.AddDropDownColumn <TrainStyle>(t => t.TrainWidthInt, lineWidths, Binding.Delegate <int, string>(i => i.ToString()), "Linienstärke", true);
            gridView.AddDropDownColumn <TrainStyle>(t => t.LineStyle, ds.Indices.Cast <object>(), Binding.Delegate <int, string>(i => ds.GetDescription(i)), "Linientyp", true);
            gridView.AddCheckColumn <TrainStyle>(t => t.Show, "Zug zeichnen", true);

            gridView.DataStore = tt.Trains.Select(t => new TrainStyle(t, attrs));

            this.AddCloseHandler();
        }
Ejemplo n.º 2
0
        public ShuntForm(ArrDep arrDep, Station sta)
        {
            Eto.Serialization.Xaml.XamlReader.Load(this);

            this.arrDep  = arrDep;
            this.station = sta;

            arrivalLabel.Font   = new Font(arrivalLabel.Font.FamilyName, arrivalLabel.Font.Size, FontStyle.Bold);
            departureLabel.Font = new Font(departureLabel.Font.FamilyName, departureLabel.Font.Size, FontStyle.Bold);
            arrivalLabel.Text   = arrivalLabel.Text.Replace("{time}", arrDep.Arrival != default ? arrDep.Arrival.ToShortTimeString() : "-");
            arrivalLabel.Text   = arrivalLabel.Text.Replace("{track}", arrDep.ArrivalTrack);
            departureLabel.Text = departureLabel.Text.Replace("{time}", arrDep.Departure != default ? arrDep.Departure.ToShortTimeString() : "-");
            departureLabel.Text = departureLabel.Text.Replace("{track}", arrDep.DepartureTrack);

            Title = Title.Replace("{station}", station.SName);

            var tracks = sta.Tracks.Select(t => t.Name);

            gridView.AddColumn <ShuntMove, TimeSpan>(s => s.Time, ts => ts.ToShortTimeString(), s => { TimeSpan.TryParse(s, out var res); return(res); }, "Zeit", editable: true);
            gridView.AddDropDownColumn <ShuntMove>(s => s.SourceTrack, tracks, "Startgleis", editable: true);
            gridView.AddDropDownColumn <ShuntMove>(s => s.TargetTrack, tracks, "Zielgleis", editable: true);
            gridView.AddCheckColumn <ShuntMove>(s => s.EmptyAfterwards, "Alle Wagen?", editable: true);

            gridView.SelectedItemsChanged += (s, e) => removeButton.Enabled = gridView.SelectedItem != null;


            this.AddSizeStateHandler();

            shuntBackup = arrDep.ShuntMoves.Select(s => s.Clone <ShuntMove>()).ToList();

            RefreshList();
        }