public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { AircraftDetails item = TableItems[indexPath.Row]; UITableViewCell cell; if (item.IsDescriptionButton) { cell = tableView.DequeueReusableCell(CellButtonIdentifier); var buttonCell = cell as AircraftDetailsButtonCell; buttonCell.UpdateCell(item); buttonCell.AircraftDescriptionButton.TouchUpInside -= AdSortButton_TouchUpInside; buttonCell.AircraftDescriptionButton.TouchUpInside += AdSortButton_TouchUpInside; return(buttonCell); } else { if (item.IsSpecs || item.IsRange) { cell = tableView.DequeueReusableCell(CellButtonOnlyIdentifier); var justButtonCell = cell as AircraftDetailsJustButtonCell; justButtonCell.ButtonProperty.TouchUpInside -= TechnicalSpecButton_TouchUpInside; justButtonCell.ButtonProperty.TouchUpInside -= AdRGButton_TouchUpInside; if (item.IsRange) { justButtonCell.ButtonProperty.TouchUpInside += AdRGButton_TouchUpInside; } if (item.IsSpecs) { justButtonCell.ButtonProperty.TouchUpInside += TechnicalSpecButton_TouchUpInside; } justButtonCell.UpdateCell(item); return(justButtonCell); } else { cell = tableView.DequeueReusableCell(CellLabelIdentifier); var labelCell = cell as AircraftDetailsLabelCell; labelCell.UpdateCell(item); return(labelCell); } } }
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 void UpdateCell(AircraftDetails item) { }
public void UpdateCell(AircraftDetails item) { this.button.SetTitle(item.Description, UIControlState.Normal); }
public void UpdateCell(AircraftDetails item) { this.aircraftLabel.Text = item.Label; this.aircraftDescription.SetTitle(item.Description, UIControlState.Normal); }
public void UpdateCell(AircraftDetails item) { this.aircraftLabel.Text = item.Label; this.aircraftDetails.Text = item.Description; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem( UIImage.FromFile("new_home.png"), UIBarButtonItemStyle.Plain, (sender, args) => { NavigationController.PopViewController(true); }), true); //Hide text button if broker doesn't have a cell phone if (string.IsNullOrEmpty(DataObject.Ads[0].BrokerCellPhone)) { AdMessages1.Alpha = 0f; } ; var ad1 = DataObject.Ads[0]; try { FeaturedLabel.Hidden = !ad1.IsFeatured; AdImage1.SetImage( url: new NSUrl(ad1.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); } catch (Exception ex) { string debugLine = ex.Message; } var labelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(18) }; var brokerLabelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(15) }; var brokerValueAttribute = new UIStringAttributes { Font = UIFont.SystemFontOfSize(15), ForegroundColor = UIColor.Blue }; Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal); Ad1NameButton.Layer.BorderWidth = 1; Ad1NameButton.Layer.BorderColor = UIColor.White.CGColor; Ad1NameButton.Layer.CornerRadius = 5; string price = ""; if (ad1.Price.Length == 0) { price = "Call"; } else { price = ad1.Price; } AircraftDetails[] aircraftDetails; if (ad1.IsFeatured) { var airframeDetails = ad1.FeaturedSpec.AirframeDetails.Replace("<br>", "\n"); var engineDetails = ad1.FeaturedSpec.EngDetails.Replace("<br>", "\n"); var interiorDetails = ad1.FeaturedSpec.IntDetails.Replace("<br>", "\n"); var exteriorDetails = ad1.FeaturedSpec.ExtDetails.Replace("<br>", "\n"); var maintenanceDetails = ad1.FeaturedSpec.Maintenance.Replace("<br>", "\n"); var avionicsDetails = ad1.FeaturedSpec.AvDetails.Replace("<br>", "\n"); var additionalDetails = ad1.FeaturedSpec.DescriptionDetails.Replace("<br>", "\n"); aircraftDetails = new AircraftDetails[] { new AircraftDetails("Price:", price, false), new AircraftDetails("Offered by:", ad1.BrokerName, true), new AircraftDetails("Registration:", HelperMethods.GetRegistrationString(ad1, labelAttribute), false), new AircraftDetails("Serial Number:", HelperMethods.GetSerialString(ad1, labelAttribute), false), new AircraftDetails("Time:", HelperMethods.GetTotalTimeString(ad1, labelAttribute), false), new AircraftDetails("Location:", ad1.Location, false), new AircraftDetails("Summary:", ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser, false), new AircraftDetails("AIRFRAME:", airframeDetails == "" ? "N/A" : airframeDetails, false), new AircraftDetails("ENGINE(S):", engineDetails == "" ? "N/A" : engineDetails, false), new AircraftDetails("INTERIOR:", interiorDetails == "" ? "N/A" : interiorDetails, false), new AircraftDetails("EXTERIOR:", exteriorDetails == "" ? "N/A" : exteriorDetails, false), new AircraftDetails("MAINTENANCE:", maintenanceDetails == "" ? "N/A" : maintenanceDetails, false), new AircraftDetails("AVIONICS:", avionicsDetails == "" ? "N/A" : avionicsDetails, false), new AircraftDetails("ADDITIONAL DETAILS:", additionalDetails == "" ? "N/A" : additionalDetails, false) }; } else { aircraftDetails = new AircraftDetails[] { new AircraftDetails("Price:", price, false), new AircraftDetails("Offered by:", ad1.BrokerName, true), new AircraftDetails("Registration:", HelperMethods.GetRegistrationString(ad1, labelAttribute), false), new AircraftDetails("Serial Number:", HelperMethods.GetSerialString(ad1, labelAttribute), false), new AircraftDetails("Time:", HelperMethods.GetTotalTimeString(ad1, labelAttribute), false), new AircraftDetails("Location:", ad1.Location, false), new AircraftDetails("Summary:", ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser, false), }; } #region price changed if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated)) { Ad1PriceChangeLabel.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; tapGesture1 = new UITapGestureRecognizer(TapImageAction1); int currentIndex = this.DataObject.MagazinePageIndex; int totalPages = this.DataObject.TotalPages; PageIndicator.SetIndicatorState(currentIndex, totalPages); loadSpeciafication(); //SpecTableView.RegisterClassForCellReuse(typeof(AircraftDetailsLabelCell), AircraftDetailsTableSource.CellLabelIdentifier); SpecTableView.Source = new AircraftDetailsTableSource(aircraftDetails, DataObject.Ads[0]); }