public async Task BrickCarGetter() { CarServices serv = new CarServices(); var ResBack = await serv.GetAllBrickCars(); BrickCars = new ObservableCollection <Car>(ResBack); foreach (var item in BrickCars) { item.Position = new Position(Convert.ToDouble(item.Member.lat), Convert.ToDouble(item.Member.lng)); if (item.cartypename == null) { switch (item.Member.cartype) { case "1": item.cartypename = "لانسر"; break; case "2": item.cartypename = "تيوتا"; break; case "3": item.cartypename = "نيسان"; break; case "4": item.cartypename = "هيونداي"; break; case "17": item.cartypename = "أودي"; break; } } item.Title = item.Member.name; item.ShowCallout = true; if (item.Order != null) { item.Image = "privatecarred.png"; } else { item.Image = "privatecargreen.png"; } } }
public async Task BrickCarGetter() { CarServices serv = new CarServices(); var ResBack = await serv.GetAllBrickCars(); BrickCars = new ObservableCollection <Car>(ResBack); foreach (var item in BrickCars) { item.Position = new Position(Convert.ToDouble(item.Member.lat), Convert.ToDouble(item.Member.lng)); if (item.cartypename == null) { if (item.Member.cartype == "5") { item.cartypename = "لانسر"; } else if (item.Member.cartype == "6") { item.cartypename = "تيوتا"; } else if (item.Member.cartype == "7") { item.cartypename = "نيسان"; } else if (item.Member.cartype == "8") { item.cartypename = "هيونداي"; } else if (item.Member.cartype == "0") { item.cartypename = "أودي"; } } item.Title = item.Member.name; item.ShowCallout = true; if (item.Order != null) { if (item.Order.weight != null) { if (item.Order.weight >= (0.9 * int.Parse(item.Member.load)) && item.cartypename == "لانسر") { item.Image = "lancerred.png"; } else if (item.Order.weight >= (0.25 * int.Parse(item.Member.load)) && item.Order.weight < (0.9 * int.Parse(item.Member.load)) && item.cartypename == "لانسر") { item.Image = "lancerblue.png"; } else if (item.Order.weight >= (0.9 * int.Parse(item.Member.load)) && item.cartypename == "تيوتا") { item.Image = "toyotared.png"; } else if (item.Order.weight >= (0.25 * int.Parse(item.Member.load)) && item.Order.weight < (0.9 * int.Parse(item.Member.load)) && item.cartypename == "تيوتا") { item.Image = "toyotablue.png"; } else if (item.Order.weight >= (0.9 * int.Parse(item.Member.load)) && item.cartypename == "نيسان") { item.Image = "nissanred.png"; } else if (item.Order.weight >= (0.25 * int.Parse(item.Member.load)) && item.Order.weight < 0.9 * int.Parse(item.Member.load) && item.cartypename == "نيسان") { item.Image = "nissanblue.png"; } else if (item.Order.weight >= 0.9 * double.Parse(item.Member.load) && item.cartypename == "هيونداي") { item.Image = "hyundaired.png"; } else if (item.Order.weight >= 0.25 * double.Parse(item.Member.load) && item.Order.weight < 0.9 * double.Parse(item.Member.load) && item.cartypename == "هيونداي") { item.Image = "hyundaiblue.png"; } else if (item.Order.weight >= 0.9 * double.Parse(item.Member.load) && item.cartypename == "أودي") { item.Image = "hyundaired.png"; } else if (item.Order.weight >= 0.25 * double.Parse(item.Member.load) && item.Order.weight < 0.9 * double.Parse(item.Member.load) && item.cartypename == "أودي") { item.Image = "hyundaiblue.png"; } else { if (item.Order.weight < 0.25 * double.Parse(item.Member.load) && item.cartypename == "لانسر") { item.Image = "lancergreen.png"; } else if (item.Order.weight < 0.25 * double.Parse(item.Member.load) && item.cartypename == "تيوتا") { item.Image = "toyotagreen.png"; } else if (item.Order.weight < 0.25 * double.Parse(item.Member.load) && item.cartypename == "نيسان") { item.Image = "nissangreen.png"; } else if (item.Order.weight < 0.25 * double.Parse(item.Member.load) && item.cartypename == "هيونداي") { item.Image = "hyundaigreen.png"; } else { item.Image = "hyundaigreen.png"; } } } else { if (item.cartypename == "لانسر") { item.Image = "lancergreen.png"; } else if (item.cartypename == "تيوتا") { item.Image = "toyotagreen.png"; } else if (item.cartypename == "نيسان") { item.Image = "nissangreen.png"; } else if (item.cartypename == "هيونداي") { item.Image = "hyundaigreen.png"; } else if (item.cartypename == "أودي") { item.Image = "hyundaigreen.png"; } } } else { if (item.cartypename == "لانسر") { item.Image = "lancergreen.png"; } else if (item.cartypename == "تيوتا") { item.Image = "toyotagreen.png"; } else if (item.cartypename == "نيسان") { item.Image = "nissangreen.png"; } else if (item.cartypename == "هيونداي") { item.Image = "hyundaigreen.png"; } else if (item.cartypename == "أودي") { item.Image = "hyundaigreen.png"; } } } }