Esempio n. 1
0
        public void GestureDetectorConstructor()
        {
            tlog.Debug(tag, $"GestureDetectorConstructor START");

            GestureDetector ret = new GestureDetector();

            Assert.IsNotNull(ret, "should be not null");
            Assert.IsInstanceOf <GestureDetector>(ret, "should be an instance of testing target class!");

            GestureDetector newOne = new GestureDetector(ret);

            Assert.IsNotNull(newOne, "should be not null");
            Assert.IsInstanceOf <GestureDetector>(newOne, "should be an instance of testing target class!");

            GestureDetector newTwo = new GestureDetector(GestureDetector.getCPtr(ret).Handle, true);

            Assert.IsNotNull(newTwo, "should be not null");
            Assert.IsInstanceOf <GestureDetector>(newTwo, "should be an instance of testing target class!");

            ret.Dispose();
            newOne.Dispose();
            newTwo.Dispose();
            tlog.Debug(tag, $"GestureDetectorConstructor END (OK)");
            Assert.Pass("GestureDetectorConstructor");
        }
Esempio n. 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Frame> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null)
            {
                if (_gestureDetector != null)
                {
                    _gestureDetector.Dispose();
                    _gestureDetector = null;
                }

                return;
            }

            IGestureAwareView view = e.NewElement as IGestureAwareView;

            if (view == null)
            {
                throw new InvalidOperationException();
            }

            if (_gestureDetector == null)
            {
                _gestureDetector = new GestureDetector(
                    new GestureDetectorListener(view));
            }
        }
        protected override void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (Element != null)
                {
                    Element.CloseRequested -= OnCloseRequested;
                }

                if (_detector != null)
                {
                    _detector.Dispose();
                    _detector = null;
                }

                if (_scrollParent != null)
                {
                    if (_scrollParent is ScrollView scrollView)
                    {
                        scrollView.Scrolled -= OnParentScrolled;
                    }

                    if (_scrollParent is ListView listView)
                    {
                        listView.Scrolled -= OnParentScrolled;
                    }

                    if (_scrollParent is Xamarin.Forms.CollectionView collectionView)
                    {
                        collectionView.Scrolled -= OnParentScrolled;
                    }
                }

                if (_contentView != null)
                {
                    _contentView.RemoveFromParent();
                    _contentView.Dispose();
                    _contentView = null;
                }

                if (_actionView != null)
                {
                    _actionView.RemoveFromParent();
                    _actionView.Dispose();
                    _actionView = null;
                }
            }

            _isDisposed = true;

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            GenericMotion -= HandleGenericMotion;
            Touch         -= HandleTouch;

            _listener = null;
            _detector?.Dispose();
            _detector = null;

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (Element != null)
                {
                    Element.CloseRequested -= OnCloseRequested;
                }

                if (_detector != null)
                {
                    _detector.Dispose();
                    _detector = null;
                }

                if (_scrollParent != null)
                {
                    if (_scrollParent is AbsListView listView)
                    {
                        listView.ScrollStateChanged += OnParentScrollStateChanged;
                    }
                    else
                    {
                        _scrollParent.ScrollChange -= OnParentScrollChange;
                    }

                    _scrollParent = null;
                }

                if (_contentView != null)
                {
                    _contentView.RemoveFromParent();
                    _contentView.Dispose();
                    _contentView = null;
                }

                if (_actionView != null)
                {
                    _actionView.RemoveFromParent();
                    _actionView.Dispose();
                    _actionView = null;
                }
            }

            _isDisposed = true;

            base.Dispose(disposing);
        }
Esempio n. 6
0
        public void GestureDetectorAssign()
        {
            tlog.Debug(tag, $"GestureDetectorAssign START");
            GestureDetector ret    = new GestureDetector();
            GestureDetector newOne = new GestureDetector();

            newOne = ret;
            ret.Dispose();
            newOne.Dispose();
            tlog.Debug(tag, $"GestureDetectorAssign END (OK)");
            Assert.Pass("GestureDetectorAssign");
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _disposed = true;

                _gestureDetectorListener.Clicked -= OnBackgroundClick;
                _gestureDetectorListener.Dispose();
                _gestureDetector.Dispose();
            }

            base.Dispose(disposing);
        }
Esempio n. 8
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (gestureDetector != null)
                {
                    gestureDetector.Dispose();
                    gestureDetector = null;
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 9
0
        public void GestureDetectorConstructor()
        {
            tlog.Debug(tag, $"GestureDetectorConstructor START");

            var testingTarget = new GestureDetector();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <GestureDetector>(testingTarget, "should be an instance of testing target class!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"GestureDetectorConstructor END (OK)");
            Assert.Pass("GestureDetectorConstructor");
        }
Esempio n. 10
0
        public void GestureDetectorgetCPtr()
        {
            tlog.Debug(tag, $"GestureDetectorgetCPtr START");
            GestureDetector ret = new GestureDetector();

            Assert.IsNotNull(ret, "should be not null");
            Assert.IsInstanceOf <GestureDetector>(ret, "should be an instance of testing target class!");

            global::System.Runtime.InteropServices.HandleRef ptr = GestureDetector.getCPtr(ret);

            GestureDetector newOne = null;

            ptr = GestureDetector.getCPtr(newOne);

            ret.Dispose();

            tlog.Debug(tag, $"GestureDetectorgetCPtr END (OK)");
            Assert.Pass("GestureDetectorgetCPtr");
        }
Esempio n. 11
0
        private void Initialize()
        {
            _invalidate = () => { RunOnUIThread(RefreshGraphicsWithTryCatch); };

            SetBackgroundColor(Color.Transparent);
            _canvas?.Dispose();
            _canvas = RenderMode == SkiaRenderMode.Software ? StartSoftwareRenderMode() : StartHardwareRenderMode();
            _mainLooperHandler?.Dispose();
            _mainLooperHandler = new Handler(Looper.MainLooper);

            SetViewportSize(); // todo: check if size is available, perhaps we need a load event

            Touch += MapView_Touch;

            var listener = new MapControlGestureListener();

            listener.Fling += OnFling;
            _gestureDetector?.Dispose();
            _gestureDetector = new GestureDetector(Context, listener);
            _gestureDetector.SingleTapConfirmed += OnSingleTapped;
            _gestureDetector.DoubleTap          += OnDoubleTapped;
        }
Esempio n. 12
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !disposed)
            {
                _detector.Dispose();
                _detector = null;

                _listener.Dispose();
                _listener = null;

                if (_bitmap != null)
                {
                    _bitmap.Recycle();
                    _bitmap.Dispose();
                    _bitmap = null;
                }

                disposed = true;
            }

            base.Dispose(disposing);
        }
Esempio n. 13
0
        public void Dispose()
        {
            if (_gestureDetector != null)
            {
                _gestureDetector.Dispose();
            }

            if (_reader != null)
            {
                _reader.Dispose();
            }

            if (_gestureAnalysis != null)
            {
                _gestureAnalysis = null;
            }

            if (_sensor != null)
            {
                _sensor.Close();
                _sensor = null;
            }
        }
Esempio n. 14
0
        public void GestureDetectorgetCPtr()
        {
            tlog.Debug(tag, $"GestureDetectorgetCPtr START");

            var testingTarget = new GestureDetector();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <GestureDetector>(testingTarget, "should be an instance of testing target class!");

            try
            {
                GestureDetector.getCPtr(testingTarget);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"GestureDetectorgetCPtr END (OK)");
            Assert.Pass("GestureDetectorgetCPtr");
        }
Esempio n. 15
0
 protected override void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             if (mContext != null)
             {
                 mContext.Dispose();
             }
             if (gestureDetector != null)
             {
                 gestureDetector.Dispose();
             }
             if (matrix != null)
             {
                 matrix.Dispose();
             }
         }
         disposed = true;
         base.Dispose(disposing);
     }
 }