void ReleaseDesignerOutlets() { if (AddToCarButton != null) { AddToCarButton.Dispose(); AddToCarButton = null; } if (btnBeneficios != null) { btnBeneficios.Dispose(); btnBeneficios = null; } if (btnFavorite != null) { btnFavorite.Dispose(); btnFavorite = null; } if (btnProductInfo != null) { btnProductInfo.Dispose(); btnProductInfo = null; } if (btnShared != null) { btnShared.Dispose(); btnShared = null; } if (CotizarButton != null) { CotizarButton.Dispose(); CotizarButton = null; } if (EmpresasView != null) { EmpresasView.Dispose(); EmpresasView = null; } if (EnterpriseNameButton != null) { EnterpriseNameButton.Dispose(); EnterpriseNameButton = null; } if (EnterpriseNameButton2 != null) { EnterpriseNameButton2.Dispose(); EnterpriseNameButton2 = null; } if (HaveLicenceButton != null) { HaveLicenceButton.Dispose(); HaveLicenceButton = null; } if (HaveLicenseTrueView != null) { HaveLicenseTrueView.Dispose(); HaveLicenseTrueView = null; } if (imgProductDetail != null) { imgProductDetail.Dispose(); imgProductDetail = null; } if (lblProductDescription != null) { lblProductDescription.Dispose(); lblProductDescription = null; } if (lblProductNameDetail != null) { lblProductNameDetail.Dispose(); lblProductNameDetail = null; } if (lblTotalQuotation != null) { lblTotalQuotation.Dispose(); lblTotalQuotation = null; } if (NoHaveLicenceButton != null) { NoHaveLicenceButton.Dispose(); NoHaveLicenceButton = null; } if (NoLicenceView != null) { NoLicenceView.Dispose(); NoLicenceView = null; } if (NoLicenceViewLayoutConstraint != null) { NoLicenceViewLayoutConstraint.Dispose(); NoLicenceViewLayoutConstraint = null; } if (NumberProductsTextField != null) { NumberProductsTextField.Dispose(); NumberProductsTextField = null; } if (NumberUsersTextField != null) { NumberUsersTextField.Dispose(); NumberUsersTextField = null; } if (OperationTypeLabel != null) { OperationTypeLabel.Dispose(); OperationTypeLabel = null; } if (SerieNumberTextField != null) { SerieNumberTextField.Dispose(); SerieNumberTextField = null; } if (TypeNameButton != null) { TypeNameButton.Dispose(); TypeNameButton = null; } if (VerifyButton != null) { VerifyButton.Dispose(); VerifyButton = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); btnBeneficios.TouchUpInside += (sender, e) => { AlertView("Beneficios y caracteristicas", Product.BenefitsCharacteristics); }; HaveLicenceButton.Layer.BorderColor = UIColor.LightGray.CGColor; HaveLicenceButton.Layer.BorderWidth = 2.0f; HaveLicenceButton.Layer.CornerRadius = 8; NoHaveLicenceButton.Layer.BorderColor = UIColor.LightGray.CGColor; NoHaveLicenceButton.Layer.BorderWidth = 2.0f; NoHaveLicenceButton.Layer.CornerRadius = 8; VerifyButton.Layer.BorderColor = UIColor.LightGray.CGColor; VerifyButton.Layer.BorderWidth = 2.0f; VerifyButton.Layer.CornerRadius = 8; AddToCarButton.Layer.CornerRadius = 8; CotizarButton.Layer.CornerRadius = 8; NumberUsersTextField.Text = "1"; NumberProductsTextField.Text = "1"; NumberUsersTextField.AddTarget(ValueNoUserChanged, UIControlEvent.EditingChanged); NumberProductsTextField.AddTarget(ValueNoProductsChanged, UIControlEvent.EditingChanged); btnProductInfo.TouchUpInside += (sender, e) => { UIApplication.SharedApplication.OpenUrl(new NSUrl(Product.ProductInfoUrl)); }; // Cuando se hace click en el corazon // Guardamos localmente el producto en liteDB btnFavorite.Clicked += (sender, e) => { // Verificamos si el producto existe var favoriteProduct = AppRuntime.MarketliteDB.ExistFavoriteProduct(Product); if (favoriteProduct == null) { // Insertamos en liteDB los resultados var resultInsert = AppRuntime.MarketliteDB.FavoriteProduct(Product); if (resultInsert.IsSucess) { btnFavorite.TintColor = UIColor.Red; string AlertMessage = string.Format("Se ha agregado el producto {0} a tus favoritos.", Product.Name); AlertView("Favoritos", AlertMessage); } } else { // Insertamos en liteDB los resultados var resultDelete = AppRuntime.MarketliteDB.DeleteFavoriteProduct(Product); if (resultDelete.IsSucess) { btnFavorite.TintColor = null; string AlertMessage = string.Format("Se ha eliminado el producto {0} de tus favoritos.", Product.Name); AlertView("Favoritos", AlertMessage); } } }; var result = AppRuntime.MarketData.getProdyctById(ProductID); if (result.ServiceResponseStatus.IsSuccess) { Product = result.Product; imgProductDetail.Image = MarketHelper.FromUrl(Product.Image); lblProductNameDetail.Text = Product.Name; lblProductDescription.Text = Product.FullDescription; // Revisamos si esta marcado como favorito // y lo pintamos de rojo // Verificamos si el producto existe var favoriteProduct = AppRuntime.MarketliteDB.ExistFavoriteProduct(Product); if (favoriteProduct == null) { btnFavorite.TintColor = null; } else { btnFavorite.TintColor = UIColor.Red; } // Cargamos la informacion para poder realizar la cotizacion LoadQuotation(result.Product.ProductQuotation); } CotizarButton.TouchUpInside += (sender, e) => { calculateQuotation(); }; }