コード例 #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);
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #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)));
        }
コード例 #5
0
 protected string ColorToString(MColor color)
 => ColorFormatter.ToString(color, _parent.Version == TimetableVersion.JTG2_x);
コード例 #6
0
 protected string ColorToString(MColor color)
 => ColorFormatter.ToString(color);