public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length < 3 || values[0] == null || values[1] == null || values[2] == null) { return(null); } string product = values[0].ToString(); string gleis = values[1].ToString(); string station = values[2].ToString().ToUpperInvariant(); if (string.Compare(product.ToUpperInvariant(), Common.HeaderProduct) == 0) { if (string.Compare(gleis.ToUpperInvariant(), Common.HeaderTitles["PlatformT"].ToUpperInvariant()) == 0) { return(Common.icons[Common.GleisIconKey[0]]); } if (string.Compare(gleis.ToUpperInvariant(), Common.HeaderTitles["PlatformS"].ToUpperInvariant()) == 0) { return(Common.icons[Common.SGleisIconKey[0]]); } } else { if (Common.MultiplatformTramStations.Contains(station) && ParseDestination.IsMarkerPresent(product, Common.TramMarkers) && !string.IsNullOrEmpty(gleis)) { if (int.TryParse(Regex.Match(gleis, @"\d+").Value, out int index) && index > 0 && index < Common.GleisIconKey.Length) { string iconKey = Common.GleisIconKey[index].ToUpperInvariant(); if (!string.IsNullOrEmpty(iconKey) && Common.icons.ContainsKey(iconKey)) { return(Common.icons[iconKey]); } } } if (Common.MultiplatformSbahnStations.Contains(station) && ParseDestination.IsMarkerPresent(product, Common.SBahnMarkers) && !string.IsNullOrEmpty(gleis)) { if (int.TryParse(Regex.Match(gleis, @"\d+").Value, out int index) && index > 0 && index < Common.SGleisIconKey.Length) { string iconKey = Common.SGleisIconKey[index].ToUpperInvariant(); if (!string.IsNullOrEmpty(iconKey) && Common.icons.ContainsKey(iconKey)) { return(Common.icons[iconKey]); } } } } return(null); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length < 3 || values[0] == null || values[1] == null || values[2] == null) { return(null); } return(ParseDestination.GetDestinationImage(ParseDestination.GetMainDestination(values[0].ToString()), values[1].ToString(), values[2].ToString())); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length == 0 || values[0] == null) { return(""); } return(ParseDestination.GetAdditionalDestination(values[0].ToString(), remove_U_S: true)); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length == 0 || values[0] == null) { return(null); } return(ParseDestination.GetDestinationImage(ParseDestination.GetAdditionalDestination(values[0].ToString()), "", "", false)); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length < 2 || values[0] == null) { return(""); } string mainDestination = ParseDestination.GetMainDestination(values[0].ToString(), removeUS: true, removeSplitMarkers: true); string label = values[1].ToString(); if (ParseDestination.IsMarkerPresent(label.ToUpperInvariant(), Common.LufthansaMarkers)) { mainDestination = label + ": " + mainDestination; } return(mainDestination); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length < 2 || values[0] == null || values[1] == null) { return(""); } string product = values[0].ToString().ToUpperInvariant(); string label = values[1].ToString().ToUpperInvariant(); if (product.Contains(Common.WarnMessageType[MessageType.NoConnection]) || product.Contains(Common.WarnMessageType[MessageType.Warning]) || product.Contains(Common.WarnMessageType[MessageType.Waiting])) { return(""); } if (ParseDestination.IsMarkerPresent(label, Common.LufthansaMarkers)) { return(""); } if (ParseDestination.IsMarkerPresent(product, Common.BusMarkers)) { return(label); } if (ParseDestination.IsMarkerPresent(product, Common.TramMarkers)) { return(string.IsNullOrEmpty(Array.Find(Common.TramIconKey, str => str.Contains(Common.DefaultTramIconKey.ToUpperInvariant() + label))) ? label : ""); } if (ParseDestination.IsMarkerPresent(product, Common.UBahnMarkers)) { return(string.IsNullOrEmpty(Array.Find(Common.UBahnIconKey, str => str.Contains(label))) ? label : ""); } if (ParseDestination.IsMarkerPresent(product, Common.SBahnMarkers)) { return(string.IsNullOrEmpty(Array.Find(Common.SBahnIconKey, str => str.Contains(label))) ? label : ""); } return(values[1].ToString()); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null || values.Length < 4 || values[0] == null || values[1] == null || values[2] == null || values[3] == null) { return(null); } string iconKey = null; string product = values[0].ToString().ToUpperInvariant(); string label = values[1].ToString().ToUpperInvariant(); string destination = values[2].ToString().ToUpperInvariant(); bool sev = (bool)values[3]; bool bus = ParseDestination.IsMarkerPresent(product, Common.BusMarkers); bool night = label.Length > 0 && ParseDestination.IsMarkerPresent(label[0].ToString(), Common.NightLineMarkers); bool tram = ParseDestination.IsMarkerPresent(product, Common.TramMarkers); bool ubahn = ParseDestination.IsMarkerPresent(product, Common.UBahnMarkers); bool sbahn = ParseDestination.IsMarkerPresent(product, Common.SBahnMarkers); bool xbus = ParseDestination.IsMarkerPresent(label, Common.ExpressLineMarkers) && ParseDestination.IsMarkerPresent(label[0].ToString(), Common.ExpressLineMarkers); bool noConnection = product.Contains(Common.WarnMessageType[MessageType.NoConnection]); bool warning = product.Contains(Common.WarnMessageType[MessageType.Warning]); bool wait = product.Contains(Common.WarnMessageType[MessageType.Waiting]); bool lufthansa = ParseDestination.IsMarkerPresent(label, Common.LufthansaMarkers); if (bus) { iconKey = sev ? (night ? Common.NSevBusIconKey : Common.SevBusIconKey) : (night ? Common.NBusIconKey : (xbus ? Common.ExpressBusIconKey : Common.BusIconKey) ); } if (tram) { iconKey = Array.Find(Common.TramIconKey, str => str.Contains(Common.DefaultTramIconKey.ToUpperInvariant() + label)) ?? (night ? Common.NTramIconKey : (sev ? Common.SevTramIconKey : Common.DefaultTramIconKey)); } if (ubahn) { iconKey = Array.Find(Common.UBahnIconKey, str => str.Contains(label)) ?? Common.DefaultUBahnIconKey; } if (sbahn) { iconKey = Array.Find(Common.SBahnIconKey, str => str.Contains(label)) ?? Common.DefaultSBahnIconKey; } if (ParseDestination.IsMarkerPresent(destination, Common.AirportMarkers)) { if (Common.AirportIconKeys.ContainsKey(label)) { iconKey = Common.AirportIconKeys[label]; } } if (lufthansa) { iconKey = Common.LufthansaBusIconKey; } if (wait) { iconKey = Common.WaitingIconKey; } if (warning) { iconKey = Common.WarningIconKey; } if (noConnection) { iconKey = Common.NoConnectionIconKey; } if (!string.IsNullOrEmpty(iconKey) && Common.icons.ContainsKey(iconKey = iconKey.ToUpperInvariant())) { return(Common.icons[iconKey]); } else { return(null); } }