예제 #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);
        }
        public void NativeMap()
        {
            NativeMap <int, char> map = new NativeMap <int, char>(MapSize);

            for (int i = 0; i < map.Length; i++)
            {
                unchecked
                {
                    map.Add(i, (char)i);
                }
            }

            map.Dispose();
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (NativeMap != null)
                {
                    NativeMap.Dispose();
                }

                Control?.OnDestroy();
            }

            System.Diagnostics.Debug.WriteLine("Disposing: " + disposing);
            base.Dispose(disposing);
        }
        public void NativeMapTest()
        {
            NativeMap <int, NativeString> map = new NativeMap <int, NativeString>(4);

            Assert.AreEqual(4, map.Capacity);
            Assert.AreEqual(0, map.Length);
            Assert.IsTrue(map.IsValid);
            Assert.IsTrue(map.IsEmpty);

            map.Dispose();
            Assert.AreEqual(0, map.Capacity);
            Assert.AreEqual(0, map.Length);
            Assert.IsFalse(map.IsValid);
            Assert.IsTrue(map.IsEmpty);

            map.DisposeMapAndValues();
        }
예제 #5
0
 public virtual void Dispose(bool disposing)
 {
     NativeToManagedMap.Dispose(ref handle);
 }