public LevelGenerator(LevelControllerBase _levelController, LevelGenerationDataBase _levelGenerationData, LevelHolderBase _levelHolder, SimpleFactory <LevelIconBase> _levelIconFactory , MapViewBase _mapView) { levelController = _levelController; levelGenerationData = _levelGenerationData; levelHolder = _levelHolder; levelIconFactory = _levelIconFactory; mapView = _mapView; }
public override void Refresh(ChallengeResponseModel challengeResponse) { Crashlytics.Instance.Log("ChallengeDetailViewController_Refresh()"); base.Refresh(challengeResponse); if (challengeResponse == null) { return; } Challenge = challengeResponse.Challenge; TimeText.Text = Challenge.NextEventCountDown; PointsText.Text = "+" + Challenge.PointValue.ToString() + " pts"; ChallengeTextLbl.Text = Challenge.Name; var navigationDelegate = new ChallengeDetailWebViewNavigationDelegate(); navigationDelegate.NavigationFinished += SetupConstraint; this.WebView.NavigationDelegate = navigationDelegate; WebView.LoadHtmlString(Challenge.Desc, null); ImageService.Instance.LoadUrl(Challenge.Image).Into(ChallengeImage); if (!DidSetupMap && Challenge.LocationLat != null && Challenge.LocationLong != null) { ChallengeImage.Hidden = true; vImagePlaceholder.RemoveConstraint(cnImagePlaceholderAspect); vImagePlaceholder.AddConstraint(cnImagePlaceholderAspect = NSLayoutConstraint.Create(vImagePlaceholder, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0)); double radius = Challenge.RadiusMeters ?? 100.0; if (radius > 6000000) { radius = 6000000; } double mapRegion = radius * 2.5; CLLocationCoordinate2D mapCoordinate = new CLLocationCoordinate2D(Challenge.LocationLat.Value, Challenge.LocationLong.Value); MapViewBase.SetRegion(MKCoordinateRegion.FromDistance(mapCoordinate, mapRegion, mapRegion), true); MKCircle circle = MKCircle.Circle(mapCoordinate, radius); MapViewBase.AddOverlay(circle); MKPointAnnotation annotation = new MKPointAnnotation(); annotation.Coordinate = new CLLocationCoordinate2D(Challenge.LocationLat.Value, Challenge.LocationLong.Value); MapViewBase.AddAnnotation(annotation); DidSetupMap = true; } else { MapViewBase.Hidden = true; paddingMap.RemoveConstraint(cnMapPlaceholderAspect); paddingMap.AddConstraint(cnMapPlaceholderAspect = NSLayoutConstraint.Create(paddingMap, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0)); } CheckStatus(); }
private void MainScroll_Scrolled(object sender, EventArgs e) { MapViewBase.RemoveConstraint(cnsMapTop1); ScrollView.RemoveConstraint(cnsMapTop1); ScrollView.AddConstraint(cnsMapTop1 = NSLayoutConstraint.Create(MapViewBase, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ScrollView, NSLayoutAttribute.Top, 1, ScrollView.ContentOffset.Y)); ChallengeImage.RemoveConstraint(AspectHeight); var scrollView = (sender as UIScrollView); double offset = scrollView.ContentOffset.Y; nfloat newMultiplier = (nfloat)(ChallengeImage.Frame.Width + offset) / ChallengeImage.Frame.Width * 1.709f; AspectHeight = NSLayoutConstraint.Create(ChallengeImage, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ChallengeImage, NSLayoutAttribute.Height, newMultiplier, 0); ChallengeImage.AddConstraint(AspectHeight); }
void ReleaseDesignerOutlets() { if (AspectHeight != null) { AspectHeight.Dispose(); AspectHeight = null; } if (ChallengeImage != null) { ChallengeImage.Dispose(); ChallengeImage = null; } if (ChallengeTextLbl != null) { ChallengeTextLbl.Dispose(); ChallengeTextLbl = null; } if (cnImagePlaceholderAspect != null) { cnImagePlaceholderAspect.Dispose(); cnImagePlaceholderAspect = null; } if (cnImagesCountHeight != null) { cnImagesCountHeight.Dispose(); cnImagesCountHeight = null; } if (cnMapPlaceholderAspect != null) { cnMapPlaceholderAspect.Dispose(); cnMapPlaceholderAspect = null; } if (cnMarginCount != null) { cnMarginCount.Dispose(); cnMarginCount = null; } if (cnsMapTop1 != null) { cnsMapTop1.Dispose(); cnsMapTop1 = null; } if (cnsWebViewHeight != null) { cnsWebViewHeight.Dispose(); cnsWebViewHeight = null; } if (CountChallengeLbl != null) { CountChallengeLbl.Dispose(); CountChallengeLbl = null; } if (DetailCollectionView != null) { DetailCollectionView.Dispose(); DetailCollectionView = null; } if (DetailCollectionViewAspect != null) { DetailCollectionViewAspect.Dispose(); DetailCollectionViewAspect = null; } if (MapViewBase != null) { MapViewBase.Dispose(); MapViewBase = null; } if (NeedUploadCountText1 != null) { NeedUploadCountText1.Dispose(); NeedUploadCountText1 = null; } if (paddingMap != null) { paddingMap.Dispose(); paddingMap = null; } if (PointsImage != null) { PointsImage.Dispose(); PointsImage = null; } if (PointsText != null) { PointsText.Dispose(); PointsText = null; } if (ScrollContent != null) { ScrollContent.Dispose(); ScrollContent = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (SubmitButton != null) { SubmitButton.Dispose(); SubmitButton = null; } if (TimeText != null) { TimeText.Dispose(); TimeText = null; } if (UploadedCountText1 != null) { UploadedCountText1.Dispose(); UploadedCountText1 = null; } if (vImagePlaceholder != null) { vImagePlaceholder.Dispose(); vImagePlaceholder = null; } if (vImagesCount != null) { vImagesCount.Dispose(); vImagesCount = null; } if (WebView != null) { WebView.Dispose(); WebView = null; } }