public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); //like, share, and email broker button event wiring AdEmail1.TouchUpInside += SendEmail_TouchUpInside; Ad2EmailButton.TouchUpInside += SendEmail_TouchUpInside; AdShare1.TouchUpInside += AdShare_TouchUpInside; Ad2ShareButton.TouchUpInside += AdShare_TouchUpInside; AdLike1.TouchUpInside += AdLike_TouchUpInside; Ad2LikeButton.TouchUpInside += AdLike_TouchUpInside; Ad1TechnicalSpecButton.TouchUpInside += TechnicalSpecButton_TouchUpInside; Ad2TechnicalSpecButton.TouchUpInside += TechnicalSpecButton_TouchUpInside; Ad1NameButton.TouchUpInside += AdSortButton_TouchUpInside; Ad2NameButton.TouchUpInside += AdSortButton_TouchUpInside; Ad1DetailButton.TouchUpInside += Ad1DetailButton_TouchUpInside; Ad2DetailButton.TouchUpInside += Ad2DetailButton_TouchUpInside; Ad1BrokerButton.TouchUpInside += AdSortButton_TouchUpInside; Ad2BrokerButton.TouchUpInside += AdSortButton_TouchUpInside; AdImage1.AddGestureRecognizer(tapGesture1); Ad2Image.AddGestureRecognizer(tapGesture2); Ad1MessageButton.TouchUpInside += AdMessages_TouchUpInside; Ad2MessageButton.TouchUpInside += AdMessages_TouchUpInside; Ad1RGButton.TouchUpInside += AdRGButton_TouchUpInside; Ad2RGButton.TouchUpInside += AdRGButton_TouchUpInside; }
void ReleaseDesignerOutlets() { if (Ad1BrokerButton != null) { Ad1BrokerButton.Dispose(); Ad1BrokerButton = null; } if (Ad1DetailButton != null) { Ad1DetailButton.Dispose(); Ad1DetailButton = null; } if (Ad1DetailView != null) { Ad1DetailView.Dispose(); Ad1DetailView = null; } if (Ad1LocationLabel != null) { Ad1LocationLabel.Dispose(); Ad1LocationLabel = null; } if (Ad1MessageButton != null) { Ad1MessageButton.Dispose(); Ad1MessageButton = null; } if (Ad1NameButton != null) { Ad1NameButton.Dispose(); Ad1NameButton = null; } if (Ad1PriceChangeLabel != null) { Ad1PriceChangeLabel.Dispose(); Ad1PriceChangeLabel = null; } if (Ad1RegistrationLabel != null) { Ad1RegistrationLabel.Dispose(); Ad1RegistrationLabel = null; } if (Ad1RGButton != null) { Ad1RGButton.Dispose(); Ad1RGButton = null; } if (Ad1SerialLabel != null) { Ad1SerialLabel.Dispose(); Ad1SerialLabel = null; } if (Ad1TeaserLabel != null) { Ad1TeaserLabel.Dispose(); Ad1TeaserLabel = null; } if (Ad1TechnicalSpecButton != null) { Ad1TechnicalSpecButton.Dispose(); Ad1TechnicalSpecButton = null; } if (Ad1TimeLabel != null) { Ad1TimeLabel.Dispose(); Ad1TimeLabel = null; } if (Ad2BrokerButton != null) { Ad2BrokerButton.Dispose(); Ad2BrokerButton = null; } if (Ad2DetailButton != null) { Ad2DetailButton.Dispose(); Ad2DetailButton = null; } if (Ad2DetailView != null) { Ad2DetailView.Dispose(); Ad2DetailView = null; } if (Ad2EmailButton != null) { Ad2EmailButton.Dispose(); Ad2EmailButton = null; } if (Ad2Image != null) { Ad2Image.Dispose(); Ad2Image = null; } if (Ad2LikeButton != null) { Ad2LikeButton.Dispose(); Ad2LikeButton = null; } if (Ad2LocationLabel != null) { Ad2LocationLabel.Dispose(); Ad2LocationLabel = null; } if (Ad2MessageButton != null) { Ad2MessageButton.Dispose(); Ad2MessageButton = null; } if (Ad2NameButton != null) { Ad2NameButton.Dispose(); Ad2NameButton = null; } if (Ad2PriceChangeLabel != null) { Ad2PriceChangeLabel.Dispose(); Ad2PriceChangeLabel = null; } if (Ad2PriceLabel != null) { Ad2PriceLabel.Dispose(); Ad2PriceLabel = null; } if (Ad2RegistrationLabel != null) { Ad2RegistrationLabel.Dispose(); Ad2RegistrationLabel = null; } if (Ad2RGButton != null) { Ad2RGButton.Dispose(); Ad2RGButton = null; } if (Ad2SerialLabel != null) { Ad2SerialLabel.Dispose(); Ad2SerialLabel = null; } if (Ad2ShareButton != null) { Ad2ShareButton.Dispose(); Ad2ShareButton = null; } if (Ad2TeaserLabel != null) { Ad2TeaserLabel.Dispose(); Ad2TeaserLabel = null; } if (Ad2TechnicalSpecButton != null) { Ad2TechnicalSpecButton.Dispose(); Ad2TechnicalSpecButton = null; } if (Ad2TimeLabel != null) { Ad2TimeLabel.Dispose(); Ad2TimeLabel = null; } if (AdEmail1 != null) { AdEmail1.Dispose(); AdEmail1 = null; } if (AdImage1 != null) { AdImage1.Dispose(); AdImage1 = null; } if (AdLike1 != null) { AdLike1.Dispose(); AdLike1 = null; } if (AdPrice1 != null) { AdPrice1.Dispose(); AdPrice1 = null; } if (AdShare1 != null) { AdShare1.Dispose(); AdShare1 = null; } if (PageIndicator != null) { PageIndicator.Dispose(); PageIndicator = null; } }
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); }