public override void ViewDidLoad() { base.ViewDidLoad(); var ad3 = DataObject.Ads[0]; var ad2 = DataObject.Ads[1]; var ad1 = DataObject.Ads[2]; //Hide text button if broker doesn't have a cell phone if (string.IsNullOrEmpty(ad1.BrokerCellPhone)) { Ad1MessageButton.Alpha = 0f; } ; if (string.IsNullOrEmpty(ad2.BrokerCellPhone)) { Ad2MessageButton.Alpha = 0f; } ; if (string.IsNullOrEmpty(ad3.BrokerCellPhone)) { Ad3MessageButton.Alpha = 0f; } ; AdImage1.SetImage( url: new NSUrl(ad1.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); Ad1BrokerButton.SetTitle("", UIControlState.Normal); Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser; AdPrice1.Text = (ad1.Price.Length == 0 ? "Call" : ad1.Price); var ad2AircraftDetails = new AircraftDetails[] { new AircraftDetails("", "Technical Specifications", false, true, false), new AircraftDetails("", "Aircraft Range", false, false, true), new AircraftDetails("Price:", (ad2.Price.Length == 0 ? "Call" : ad2.Price), false), new AircraftDetails("Offered by:", ad2.BrokerName, true), new AircraftDetails("Registration:", ad2.RegistrationNumber, false), new AircraftDetails("Serial Number:", ad2.SerialNumber, false), new AircraftDetails("Time:", ad2.TotalTime, false), new AircraftDetails("Location:", ad2.Location, false), new AircraftDetails("Summary:", ad2.Teaser == string.Empty ? "Inquire for Details" : ad2.Teaser, false), }; var ad3AircraftDetails = new AircraftDetails[] { new AircraftDetails("", "Technical Specifications", false, true, false), new AircraftDetails("", "Aircraft Range", false, false, true), new AircraftDetails("Price:", (ad3.Price.Length == 0 ? "Call" : ad3.Price), false), new AircraftDetails("Offered by:", ad3.BrokerName, true), new AircraftDetails("Registration:", ad3.RegistrationNumber, false), new AircraftDetails("Serial Number:", ad3.SerialNumber, false), new AircraftDetails("Time:", ad3.TotalTime, false), new AircraftDetails("Location:", ad3.Location, false), new AircraftDetails("Summary:", ad3.Teaser == string.Empty ? "Inquire for Details" : ad3.Teaser, false), }; Ad2TableView.Source = new AircraftDetailsTableSource(ad2AircraftDetails, ad2); Ad3TableView.Source = new AircraftDetailsTableSource(ad3AircraftDetails, ad3); Ad1BrokerLabel.Text = ad1.BrokerName; Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal); Ad1NameButton.Layer.BorderColor = UIColor.White.CGColor; Ad1NameButton.Layer.BorderWidth = 1f; AdImage2.SetImage( url: new NSUrl(ad2.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); Ad2NameButton.SetTitle(ad2.Name, UIControlState.Normal); Ad2NameButton.Layer.BorderColor = UIColor.White.CGColor; Ad2NameButton.Layer.BorderWidth = 1f; AdImage3.SetImage( url: new NSUrl(ad3.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); Ad3NameButton.SetTitle(ad3.Name, UIControlState.Normal); Ad3NameButton.Layer.BorderColor = UIColor.White.CGColor; Ad3NameButton.Layer.BorderWidth = 1f; var labelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(18) }; var brokerLabelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(15) }; var valueAttribute = new UIStringAttributes { Font = UIFont.SystemFontOfSize(15), ForegroundColor = UIColor.Blue }; Ad1RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad1, labelAttribute); Ad1SerialLabel.Text = HelperMethods.GetSerialString(ad1, labelAttribute); Ad1TimeLabel.Text = HelperMethods.GetTotalTimeString(ad1, labelAttribute); Ad1LocationLabel.Text = ad1.Location; #region price changed if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated)) { Ad1PriceChangedLabel.Alpha = 0f; } if (!HelperMethods.ShowPriceChangedLabel(ad2.PriceLastUpdated)) { Ad2PriceChangeLabel.Alpha = 0f; } if (!HelperMethods.ShowPriceChangedLabel(ad3.PriceLastUpdated)) { Ad3PriceChangeLabel.Alpha = 0f; } #endregion ////Set initial state of like buttons if (DataObject.Ads[0].IsLiked) { HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]); } //webview image tap gestures AdImage1.UserInteractionEnabled = true; AdImage2.UserInteractionEnabled = true; AdImage3.UserInteractionEnabled = true; tapGesture1 = new UITapGestureRecognizer(TapImageAction1); tapGesture2 = new UITapGestureRecognizer(TapImageAction2); tapGesture3 = new UITapGestureRecognizer(TapImageAction3); int currentIndex = this.DataObject.MagazinePageIndex; int totalPages = this.DataObject.TotalPages; PageIndicator.SetIndicatorState(currentIndex, totalPages); }
public override void ViewDidLoad() { base.ViewDidLoad(); var ad1 = DataObject.Ads[0]; var ad2 = DataObject.Ads[1]; //Hide text button if broker doesn't have a cell phone if (string.IsNullOrEmpty(ad1.BrokerCellPhone)) { Ad1MessageButton.Alpha = 0f; } ; if (string.IsNullOrEmpty(ad2.BrokerCellPhone)) { Ad2MessageButton.Alpha = 0f; } ; AdImage1.SetImage( url: new NSUrl(ad1.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); //Commenting out for new detail view //AdName1.Text = ad1.Name; AdPrice1.Text = ad1.Price; if (ad1.Price.Length == 0) { AdPrice1.Text = "Call"; } Ad1BrokerButton.SetTitle(ad1.BrokerName, UIControlState.Normal); //Ad1BrokerButton.SetTitleColor(UIColor.Green, UIControlState.Normal); Ad2BrokerButton.SetTitle(ad2.BrokerName, UIControlState.Normal); Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal); Ad1NameButton.Layer.BorderColor = UIColor.White.CGColor; Ad1NameButton.Layer.BorderWidth = 1f; Ad2Image.SetImage( url: new NSUrl(ad2.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); //Ad2NameLabel.Text = ad2.Name; Ad2PriceLabel.Text = ad2.Price; if (ad2.Price.Length == 0) { Ad2PriceLabel.Text = "Call"; } Ad2NameButton.SetTitle(ad2.Name, UIControlState.Normal); Ad2NameButton.Layer.BorderColor = UIColor.White.CGColor; Ad2NameButton.Layer.BorderWidth = 1f; var labelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(18) }; Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser; Ad2TeaserLabel.Text = ad2.Teaser == string.Empty ? "Inquire for Details" : ad2.Teaser; //#region attributed labels Ad1RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad1, labelAttribute); Ad2RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad2, labelAttribute); Ad1SerialLabel.Text = HelperMethods.GetSerialString(ad1, labelAttribute); Ad2SerialLabel.Text = HelperMethods.GetSerialString(ad2, labelAttribute); Ad1TimeLabel.Text = HelperMethods.GetTotalTimeString(ad1, labelAttribute); Ad2TimeLabel.Text = HelperMethods.GetTotalTimeString(ad2, labelAttribute); Ad1LocationLabel.Text = ad1.Location; Ad2LocationLabel.Text = ad2.Location; //#endregion #region price changed if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated)) { Ad1PriceChangeLabel.Alpha = 0f; } if (!HelperMethods.ShowPriceChangedLabel(ad2.PriceLastUpdated)) { Ad2PriceChangeLabel.Alpha = 0f; } #endregion //Set initial state of like buttons if (DataObject.Ads[0].IsLiked) { HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]); } if (DataObject.Ads[1].IsLiked) { HelperMethods.SetInitialLikeButtonState(Ad2LikeButton, DataObject.Ads[1]); } //webview image tap gestures AdImage1.UserInteractionEnabled = true; Ad2Image.UserInteractionEnabled = true; //UITapGestureRecognizer tapGesture1 = new UITapGestureRecognizer(TapImageAction1); //AdImage1.AddGestureRecognizer(tapGesture1); //UITapGestureRecognizer tapGesture2 = new UITapGestureRecognizer(TapImageAction2); //Ad2Image.AddGestureRecognizer(tapGesture2); tapGesture1 = new UITapGestureRecognizer(TapImageAction1); tapGesture2 = new UITapGestureRecognizer(TapImageAction2); int currentIndex = this.DataObject.MagazinePageIndex; int totalPages = this.DataObject.TotalPages; PageIndicator.SetIndicatorState(currentIndex, totalPages); }