protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Used in Callout to see feature details in PopupViewer _infoIcon = await RuntimeImage.FromStreamAsync(Assets.Open("info.png")); // Used to demonstrate display of EditSummary in PopupViewer // Provides credentials to token-secured layer that has editor-tracking enabled AuthenticationManager.Current.ChallengeHandler = new ChallengeHandler(async(info) => { return(await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, "user1", "user1")); }); mapView = FindViewById <MapView>(Resource.Id.mapView); mapView.GeoViewTapped += mapView_GeoViewTapped; // Webmap configured with Popup mapView.Map = new Map(new Uri("https://www.arcgis.com/home/item.html?id=d4fe39d300c24672b1821fa8450b6ae2")); popupViewer = FindViewById <UI.Controls.PopupViewer>(Resource.Id.popupViewer); scaleLine = FindViewById <UI.Controls.ScaleLine>(Resource.Id.scaleLine); scaleLine.MapView = mapView; compass = FindViewById <UI.Controls.Compass>(Resource.Id.compass); compass.GeoView = mapView; }
internal Compass(UI.Controls.Compass nativeCompass) { NativeCompass = nativeCompass; #if NETFX_CORE nativeCompass.SizeChanged += (o, e) => InvalidateMeasure(); #endif var tapRecognizer = new TapGestureRecognizer(); tapRecognizer.Command = new TapCommand(ResetRotation); GestureRecognizers.Add(tapRecognizer); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CompassMapViewSample); mapView = FindViewById <MapView>(Resource.Id.mapView); mapView.Map = new Map(Basemap.CreateLightGrayCanvasVector()); compass = FindViewById <UI.Controls.Compass>(Resource.Id.compass); compass.GeoView = mapView; compass.AutoHide = false; var slider = FindViewById <SeekBar>(Resource.Id.sizeSlider); slider.Max = 100; slider.Progress = 30; slider.Min = 10; slider.ProgressChanged += Slider_ProgressChanged; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); mapView = FindViewById <MapView>(Resource.Id.mapView); mapView.Map = new Map(Basemap.CreateStreets()); scaleLine = FindViewById <UI.Controls.ScaleLine>(Resource.Id.scaleLine); scaleLine.MapView = mapView; compass = FindViewById <UI.Controls.Compass>(Resource.Id.compass); compass.GeoView = mapView; }
protected override void OnElementChanged(ElementChangedEventArgs <Compass> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.SizeChanged -= Element_SizeChanged; } if (e.NewElement != null) { if (Control == null) { #if __ANDROID__ UI.Controls.Compass ctrl = new UI.Controls.Compass(Context); #else UI.Controls.Compass ctrl = new UI.Controls.Compass(); #endif ctrl.GeoView = Element.GeoView?.GetNativeGeoView(); ctrl.Heading = Element.Heading; ctrl.AutoHide = Element.AutoHide; #if NETFX_CORE ctrl.Margin = new Windows.UI.Xaml.Thickness(0, 0, 1, 0); ctrl.RegisterPropertyChangedCallback(UI.Controls.Compass.HeadingProperty, (d, args) => UpdateHeadingFromNativeCompass()); #elif !NETSTANDARD2_0 ctrl.PropertyChanged += (s, args) => { if (args.PropertyName == nameof(UI.Controls.Compass.Heading)) { UpdateHeadingFromNativeCompass(); } }; #endif SetNativeControl(ctrl); UpdateHeadingFromNativeCompass(); } e.NewElement.SizeChanged += Element_SizeChanged; } }