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); }
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; }
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; }
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))); }
protected string ColorToString(MColor color) => ColorFormatter.ToString(color, _parent.Version == TimetableVersion.JTG2_x);
protected string ColorToString(MColor color) => ColorFormatter.ToString(color);