private async void setPersistedImage() { UIImage rightImage = LoadImage("right"); if (rightImage != null) { Right.SetBackgroundImage(rightImage, UIControlState.Normal); Right.TintColor = UIColor.Clear; AppDelegate.appDelegate.RightCarImageUploaded = true; Right.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("right"); rightImage = LoadImage("right"); if (rightImage != null) { rightImage = LoadImage("right"); Right.SetBackgroundImage(rightImage, UIControlState.Normal); Right.TintColor = UIColor.Clear; AppDelegate.appDelegate.RightCarImageUploaded = true; Right.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage leftImage = LoadImage("left"); if (leftImage != null) { Left.TintColor = UIColor.Clear; Left.SetBackgroundImage(leftImage, UIControlState.Normal); AppDelegate.appDelegate.LeftCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("left"); leftImage = LoadImage("left"); if (leftImage != null) { leftImage = LoadImage("left"); Left.SetBackgroundImage(leftImage, UIControlState.Normal); Left.TintColor = UIColor.Clear; AppDelegate.appDelegate.LeftCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage frontImage = LoadImage("front"); if (frontImage != null) { Front.TintColor = UIColor.Clear; Front.SetBackgroundImage(frontImage, UIControlState.Normal); AppDelegate.appDelegate.FrontCarImageUploaded = true; Front.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("front"); frontImage = LoadImage("front"); if (frontImage != null) { frontImage = LoadImage("front"); Front.SetBackgroundImage(frontImage, UIControlState.Normal); Front.TintColor = UIColor.Clear; AppDelegate.appDelegate.FrontCarImageUploaded = true; Front.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage backImage = LoadImage("back"); if (backImage != null) { Back.TintColor = UIColor.Clear; Back.SetBackgroundImage(backImage, UIControlState.Normal); AppDelegate.appDelegate.BackCarImageUploaded = true; Back.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("back"); backImage = LoadImage("back"); if (backImage != null) { backImage = LoadImage("back"); Back.SetBackgroundImage(backImage, UIControlState.Normal); Back.TintColor = UIColor.Clear; AppDelegate.appDelegate.BackCarImageUploaded = true; Back.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage seatImage = LoadImage("seat"); if (seatImage != null) { Seat.TintColor = UIColor.Clear; Seat.SetBackgroundImage(seatImage, UIControlState.Normal); AppDelegate.appDelegate.SeatCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("seat"); seatImage = LoadImage("seat"); if (seatImage != null) { seatImage = LoadImage("seat"); Seat.SetBackgroundImage(seatImage, UIControlState.Normal); Seat.TintColor = UIColor.Clear; AppDelegate.appDelegate.SeatCarImageUploaded = true; Seat.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage seatsImage = LoadImage("seats"); if (seatsImage != null) { Seats.TintColor = UIColor.Clear; Seats.SetBackgroundImage(seatsImage, UIControlState.Normal); AppDelegate.appDelegate.BackSeatImageUploaded = true; Seats.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("seats"); seatsImage = LoadImage("seats"); if (seatsImage != null) { seatsImage = LoadImage("seats"); Seats.SetBackgroundImage(seatsImage, UIControlState.Normal); Seats.TintColor = UIColor.Clear; AppDelegate.appDelegate.BackSeatImageUploaded = true; Seats.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage dashImage = LoadImage("dashboard"); if (dashImage != null) { Dashboard.TintColor = UIColor.Clear; Dashboard.SetBackgroundImage(dashImage, UIControlState.Normal); AppDelegate.appDelegate.DashBoardImageUploaded = true; Dashboard.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("dashboard"); dashImage = LoadImage("dashboard"); if (dashImage != null) { dashImage = LoadImage("dashboard"); Dashboard.SetBackgroundImage(dashImage, UIControlState.Normal); Dashboard.TintColor = UIColor.Clear; AppDelegate.appDelegate.DashBoardImageUploaded = true; Dashboard.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage odoImage = LoadImage("odometer"); if (odoImage != null) { Odometer.TintColor = UIColor.Clear; Odometer.SetBackgroundImage(odoImage, UIControlState.Normal); AppDelegate.appDelegate.OdometerImageUploaded = true; Odometer.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("odometer"); odoImage = LoadImage("odometer"); if (odoImage != null) { odoImage = LoadImage("odometer"); Odometer.SetBackgroundImage(odoImage, UIControlState.Normal); Odometer.TintColor = UIColor.Clear; AppDelegate.appDelegate.OdometerImageUploaded = true; Odometer.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage rimImage = LoadImage("rim"); if (rimImage != null) { Rim.TintColor = UIColor.Clear; Rim.SetBackgroundImage(rimImage, UIControlState.Normal); AppDelegate.appDelegate.RimImageUploaded = true; Rim.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("rim"); rimImage = LoadImage("rim"); if (rimImage != null) { rimImage = LoadImage("rim"); Rim.SetBackgroundImage(rimImage, UIControlState.Normal); Rim.TintColor = UIColor.Clear; AppDelegate.appDelegate.RimImageUploaded = true; Rim.Layer.BorderColor = UIColor.Black.CGColor; } } UIImage vinImage = LoadImage("VIN"); if (vinImage != null) { VIN.TintColor = UIColor.Clear; VIN.SetBackgroundImage(vinImage, UIControlState.Normal); AppDelegate.appDelegate.VINImageUplaoded = true; VIN.Layer.BorderColor = UIColor.Black.CGColor; } else { await setPersistImageOnlineAsync("VIN"); vinImage = LoadImage("VIN"); if (vinImage != null) { vinImage = LoadImage("VIN"); VIN.SetBackgroundImage(vinImage, UIControlState.Normal); VIN.TintColor = UIColor.Clear; AppDelegate.appDelegate.VINImageUplaoded = true; VIN.Layer.BorderColor = UIColor.Black.CGColor; } } InvokeOnMainThread(() => { var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController; Utility.HideLoadingIndicator(splitViewController.View); }); }
public void setImage(UIImage Image) { switch (currentButton) { case "front": Front.TintColor = UIColor.Clear; Front.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.FrontCarImageUploaded = true; Front.Layer.BorderColor = UIColor.Black.CGColor; // Right_Image.SizeToFit(); break; case "back": Back.TintColor = UIColor.Clear; Back.SetBackgroundImage(Image, UIControlState.Normal); // Left_Image.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.BackCarImageUploaded = true; Back.Layer.BorderColor = UIColor.Black.CGColor; break; case "right": Right.TintColor = UIColor.Clear; Right.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.RightCarImageUploaded = true; Right.Layer.BorderColor = UIColor.Black.CGColor; /// Front.SetBackgroundImage(Image, UIControlState.Normal); break; case "left": Left.TintColor = UIColor.Clear; Left.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.LeftCarImageUploaded = true; Left.Layer.BorderColor = UIColor.Black.CGColor; /// Odometer.SetBackgroundImage(Image, UIControlState.Normal); break; case "seat": Seat.TintColor = UIColor.Clear; Seat.SetBackgroundImage(Image, UIControlState.Normal); ///Seat.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.SeatCarImageUploaded = true; Seat.Layer.BorderColor = UIColor.Black.CGColor; break; case "seats": Seats.TintColor = UIColor.Clear; Seats.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.BackSeatImageUploaded = true; Seats.Layer.BorderColor = UIColor.Black.CGColor; ///Seat.SetBackgroundImage(Image, UIControlState.Normal); break; case "dashboard": Dashboard.TintColor = UIColor.Clear; Dashboard.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.DashBoardImageUploaded = true; Dashboard.Layer.BorderColor = UIColor.Black.CGColor; break; case "odometer": Odometer.TintColor = UIColor.Clear; Odometer.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.OdometerImageUploaded = true; Odometer.Layer.BorderColor = UIColor.Black.CGColor; break; case "rim": Rim.TintColor = UIColor.Clear; Rim.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.RimImageUploaded = true; Rim.Layer.BorderColor = UIColor.Black.CGColor; break; case "VIN": VIN.TintColor = UIColor.Clear; VIN.SetBackgroundImage(Image, UIControlState.Normal); AppDelegate.appDelegate.VINImageUplaoded = true; VIN.Layer.BorderColor = UIColor.Black.CGColor; break; default: Console.WriteLine("Invalid selection. Please select 1, 2, or 3."); break; } }