Esempio n. 1
0
        private static string ConvertColor(string value, TimetableVersion version)
        {
            var mcolor = ColorFormatter.FromString(value, null);

            if (mcolor != null)
            {
                return(ColorFormatter.ToString(mcolor, version == TimetableVersion.JTG2_x));
            }
            throw new Exception("Found unknown color string " + value);
        }
Esempio n. 2
0
        public TrainColorEditForm(Train train, ISettings settings) : this(settings)
        {
            Train = train;
            style = new TrainStyle(train);
            var attrs = new TimetableStyle(train._parent);

            colorComboBox.SelectedValue = ColorFormatter.ToString(style.TrainColor ?? attrs.TrainColor);
            widthComboBox.SelectedValue = style.TrainWidth ?? attrs.TrainWidth;
            dashComboBox.SelectedValue  = style.LineStyle;
            drawCheckBox.Checked        = style.Show;
        }
Esempio n. 3
0
        public StationStyleEditForm(Station station, ISettings settings) : this(settings)
        {
            Station = station;
            style   = new StationStyle(station);
            var attrs = new TimetableStyle(station._parent);

            colorComboBox.SelectedValue = ColorFormatter.ToString(style.StationColor ?? attrs.StationColor);
            widthComboBox.SelectedValue = style.StationWidth ?? attrs.StationWidth;
            dashComboBox.SelectedValue  = style.LineStyle;
            drawCheckBox.Checked        = style.Show;
        }
Esempio n. 4
0
        public static void Color <T>(ISettings settings, DropDown dropDown, string property)
        {
            var cc = new ColorCollection(settings);

            var p = GetProperty <T>(property);

            dropDown.DataStore       = cc.ColorHexStrings;
            dropDown.ItemTextBinding = ExtBind.ColorBinding(cc);
            dropDown.SelectedValueBinding.BindDataContext <T>(a => ColorFormatter.ToString((MColor)p.GetValue(a)),
                                                              (a, val) => p.SetValue(a, ColorFormatter.FromHexString((string)val)));
        }
Esempio n. 5
0
 protected string ColorToString(MColor color)
 => ColorFormatter.ToString(color, _parent.Version == TimetableVersion.JTG2_x);
Esempio n. 6
0
 protected string ColorToString(MColor color)
 => ColorFormatter.ToString(color);