Exemple #1
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                if (Element != null)
                {
                    MessagingCenter.Unsubscribe <Map, MapSpan>(this, MoveMessageName);
                    ((ObservableCollection <Pin>)Element.Pins).CollectionChanged -= OnCollectionChanged;
                }

                if (NativeMap != null)
                {
                    NativeMap.MyLocationEnabled = false;
                    NativeMap.SetOnCameraChangeListener(null);
                    NativeMap.InfoWindowClick -= MapOnMarkerClick;
                    NativeMap.Dispose();
                }

                Control?.OnDestroy();
            }

            base.Dispose(disposing);
        }